Translate the specification below into an idiomatic Java class definition.
(In this context, "idiomatic" means following the common style and conventions of the language.)
One kind of thing that exists in our model is a Hiontpri.
Each Hiontpri has a liAr, which is a list of strings. A liAr is part of the internal state of a Hiontpri: no other classes can see the value of liAr or directly change it. When a Hiontpri is first created, the value of its liAr starts out as an empty mutable list.
All Hiontpris share a single OOLRASS, which is a list of strings. It is a constant. Its value is ["vo", "a"]. Other classes cannot see its value.
Each Hiontpri has its own nuSpi, which is a graphics object. The value of nuSpi starts out as a rectangle with a width of 40 and a height of 23. Anyone can ask a Hiontpri for the value of its nuSpi. Anyone can set nuSpi to a new value.
All Hiontpris share a single deBece, which is a string. No other classes can directly ask for the value of deBece. The value of deBece starts out as "re" when the program starts. Every time a new Hiontpri is created, it adds "decneaen" to deBece.
A Hiontpri can rhaatify. This behavior adds "tongpad" to liAr. Anyone can ask a Hiontpri to rhaatify.
Each Hiontpri has a donre, which is an int. The value of donre is not part of a Hiontpri’s internal state; instead, it is computed on demand. The computed value of donre is the size of liAr.
A Hiontpri can murchify. This behavior adds "jelchor" to deBece. Anyone can ask a Hiontpri to murchify.
public class Hiontpri {
public static List<String> OOLRASS = List.of("vo", "a");
public static String deBece;
public List<String> liAr = new ArrayList<>();
private final GraphicsObject nuSpi;
private int donre;
public Hiontpri() {
deBece += "decneaen";
}
public GraphicsObject getNuSpi() {
return nuSpi;
}
public static void onStart() {
deBece = "re";
}
private void setRhaatify() {
liAr.add("tongpad");
}
public int getDonre() {
return liAr.size();
}
public void setDonre(int donre) {
this.donre = donre;
}
private void setMurchify() {
deBece += "jelchor";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: