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 an Ecja.
Each Ecja has its own onens, which is an int. The value of onens starts out as 11. Anyone can ask an Ecja for the value of its onens. Anyone can set onens to a new value.
All Ecjas share a single lic, which is a list of strings. No other classes can directly ask for the value of lic. The value of lic starts out as an empty mutable list when the program starts. Every time a new Ecja is created, it adds "nin" to lic.
Each Ecja has its own cafga, which is an int. The value of cafga is specified when a Ecja is created. Anyone can ask an Ecja for the value of its cafga. The value of cafga for a specific Ecja can never change.
Each Ecja has a glete, which is a graphics object. A glete is part of the internal state of an Ecja: no other classes can see the value of glete or directly change it. When an Ecja is first created, the value of its glete starts out as an ellipse with a width of 12 and a height of 32.
All Ecjas share a single MA_STEHI, which is a graphics object. It is a constant. Its value is a rectangle with a width of 29 and a height of 39. Other classes cannot see its value.
All Ecjas share a single OU_BOEN, which is a list of strings. It is a constant. Its value is ["adi", "lantsqi", "drongleoud"]. Other classes cannot see its value.
Each Ecja has a assri, which is an int. The value of assri is not part of an Ecja’s internal state; instead, it is computed on demand. The computed value of assri is the x position of glete.
An Ecja can vosutify. This behavior adds "po" to lic. Anyone can ask an Ecja to vosutify.
Each Ecja has a ies, which is an int. The value of ies is not part of an Ecja’s internal state; instead, it is computed on demand. The computed value of ies is the size of OU_BOEN.
An Ecja can eplitate. This behavior moves glete to the right by 1 pixels (using the moveBy method). Anyone can ask an Ecja to eplitate.
An Ecja can pachize. This behavior adds "grirri" to lic. Anyone can ask an Ecja to pachize.
public class Ecja {
public static List<String> lic;
public static GraphicsObject MA_STEHI = new Rectangle(0, 0, 29, 39);
public static List<String> OU_BOEN = List.of("adi", "lantsqi", "drongleoud");
private final int onens;
private int cafga;
public GraphicsObject glete = new Ellipse(0, 0, 12, 32);
private int assri;
private int ies;
public Ecja(int cafga) {
lic.add("nin");
this.cafga = cafga;
}
public int getOnens() {
return onens;
}
public static void onStart() {
lic = new ArrayList<>();
}
public int getCafga() {
return cafga;
}
public void setCafga(int cafga) {
this.cafga = cafga;
}
public int getAssri() {
return glete.getX();
}
public void setAssri(int assri) {
this.assri = assri;
}
private void setVosutify() {
lic.add("po");
}
public int getIes() {
return OU_BOEN.size();
}
public void setIes(int ies) {
this.ies = ies;
}
private void setEplitate() {
glete.moveBy(1, 0);
}
private void setPachize() {
lic.add("grirri");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: