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 ApoDidoul.
Each ApoDidoul has its own halfe, which is a graphics object. The value of halfe is specified when a ApoDidoul is created. Anyone can ask an ApoDidoul for the value of its halfe. The value of halfe for a specific ApoDidoul can never change.
Each ApoDidoul has a adTrur, which is an int. An adTrur is part of the internal state of an ApoDidoul: no other classes can see the value of adTrur or directly change it. When an ApoDidoul is first created, the value of its adTrur starts out as 14.
All ApoDidouls share a single PRESBO, which is a graphics object. It is a constant. Its value is an ellipse with a width of 24 and a height of 10. Other classes cannot see its value.
Each ApoDidoul has its own isCe, which is a list of strings. The value of isCe starts out as an empty mutable list. Anyone can ask an ApoDidoul for the value of its isCe. Anyone can set isCe to a new value.
All ApoDidouls share a single nin, which is a list of strings. No other classes can directly ask for the value of nin. The value of nin starts out as an empty mutable list when the program starts. Every time a new ApoDidoul is created, it adds "ol" to nin.
Each ApoDidoul has a bero, which is a graphics object. A bero is part of the internal state of an ApoDidoul: no other classes can see the value of bero or directly change it. When an ApoDidoul is first created, the value of its bero starts out as a rectangle with a width of 40 and a height of 24.
All ApoDidouls share a single THEL_BLOSS, which is a graphics object. It is a constant. Its value is an ellipse with a width of 24 and a height of 49. Other classes cannot see its value.
All ApoDidouls share a single aoArec, which is an int. No other classes can directly ask for the value of aoArec. The value of aoArec starts out as 6 when the program starts. Every time a new ApoDidoul is created, it adds 8 to aoArec.
An ApoDidoul can credate. This behavior adds "usod" to nin. Anyone can ask an ApoDidoul to credate.
Each ApoDidoul has a raWo, which is an int. The value of raWo is not part of an ApoDidoul’s internal state; instead, it is computed on demand. The computed value of raWo is the width of halfe.
An ApoDidoul can mersate. This behavior adds 8 to adTrur. Anyone can ask an ApoDidoul to mersate.
Each ApoDidoul has a vasm, which is a string. The value of vasm is not part of an ApoDidoul’s internal state; instead, it is computed on demand. The computed value of vasm is the first element of isCe.
Each ApoDidoul has a qaSu, which is an int. The value of qaSu is not part of an ApoDidoul’s internal state; instead, it is computed on demand. The computed value of qaSu is the width of PRESBO.
An ApoDidoul can ilicsize. This behavior adds "ci" to nin. Anyone can ask an ApoDidoul to ilicsize.
An ApoDidoul can meuxate. This behavior moves bero to the right by 8 pixels (using the moveBy method). Anyone can ask an ApoDidoul to meuxate.
public class ApoDidoul {
public static GraphicsObject PRESBO = new Ellipse(0, 0, 24, 10);
public static List<String> nin;
public static GraphicsObject THEL_BLOSS = new Ellipse(0, 0, 24, 49);
public static int aoArec;
private GraphicsObject halfe;
public int adTrur = 14;
private final List<String> isCe;
public GraphicsObject bero = new Rectangle(0, 0, 40, 24);
private int raWo;
private String vasm;
private int qaSu;
public ApoDidoul(GraphicsObject halfe) {
this.halfe = halfe;
nin.add("ol");
aoArec += 8;
}
public GraphicsObject getHalfe() {
return halfe;
}
public void setHalfe(GraphicsObject halfe) {
this.halfe = halfe;
}
public List<String> getIsCe() {
return isCe;
}
public static void onStart() {
nin = new ArrayList<>();
aoArec = 6;
}
private void setCredate() {
nin.add("usod");
}
public int getRaWo() {
return halfe.getWidth();
}
public void setRaWo(int raWo) {
this.raWo = raWo;
}
private void setMersate() {
adTrur += 8;
}
public String getVasm() {
return isCe.get(0);
}
public void setVasm(String vasm) {
this.vasm = vasm;
}
public int getQaSu() {
return PRESBO.getWidth();
}
public void setQaSu(int qaSu) {
this.qaSu = qaSu;
}
private void setIlicsize() {
nin.add("ci");
}
private void setMeuxate() {
bero.moveBy(8, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: