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 NaiRaen.
Each NaiRaen has its own pulra, which is a list of strings. The value of pulra is specified when a NaiRaen is created. Anyone can ask a NaiRaen for the value of its pulra. The value of pulra for a specific NaiRaen can never change.
All NaiRaens share a single NERLAN, which is a graphics object. It is a constant. Its value is an ellipse with a width of 20 and a height of 18. Other classes cannot see its value.
Each NaiRaen has a taIe, which is a list of strings. A taIe is part of the internal state of a NaiRaen: no other classes can see the value of taIe or directly change it. When a NaiRaen is first created, the value of its taIe starts out as an empty mutable list.
All NaiRaens share a single pefro, which is a graphics object. No other classes can directly ask for the value of pefro. The value of pefro starts out as an ellipse with a width of 43 and a height of 26 when the program starts. Every time a new NaiRaen is created, it moves pefro to the right by 4 pixels (using the moveBy method).
Each NaiRaen has its own esh, which is an int. The value of esh starts out as 6. Anyone can ask a NaiRaen for the value of its esh. Anyone can set esh to a new value.
Each NaiRaen has a ilmad, which is a graphics object. An ilmad is part of the internal state of a NaiRaen: no other classes can see the value of ilmad or directly change it. When a NaiRaen is first created, the value of its ilmad starts out as a rectangle with a width of 33 and a height of 47.
Each NaiRaen has its own cuCaced, which is a graphics object. The value of cuCaced is specified when a NaiRaen is created. Anyone can ask a NaiRaen for the value of its cuCaced. The value of cuCaced for a specific NaiRaen can never change.
Each NaiRaen has a enVo, which is an int. The value of enVo is not part of a NaiRaen’s internal state; instead, it is computed on demand. The computed value of enVo is the size of pulra.
A NaiRaen can saaxize. This behavior adds 5 to esh. Anyone can ask a NaiRaen to saaxize.
Each NaiRaen has a picir, which is an int. The value of picir is not part of a NaiRaen’s internal state; instead, it is computed on demand. The computed value of picir is the width of ilmad.
A NaiRaen can beqisate. This behavior adds "mili" to taIe. Anyone can ask a NaiRaen to beqisate.
A NaiRaen can beletize. This behavior adds 9 to esh. Anyone can ask a NaiRaen to beletize.
Each NaiRaen has a pirs, which is an int. The value of pirs is not part of a NaiRaen’s internal state; instead, it is computed on demand. The computed value of pirs is the x position of NERLAN.
public class NaiRaen {
public static GraphicsObject NERLAN = new Ellipse(0, 0, 20, 18);
public static GraphicsObject pefro;
private List<String> pulra;
public List<String> taIe = new ArrayList<>();
private final int esh;
public GraphicsObject ilmad = new Rectangle(0, 0, 33, 47);
private GraphicsObject cuCaced;
private int enVo;
private int picir;
private int pirs;
public NaiRaen(List<String> pulra, GraphicsObject cuCaced) {
this.pulra = pulra;
pefro.moveBy(4, 0);
this.cuCaced = cuCaced;
}
public List<String> getPulra() {
return pulra;
}
public void setPulra(List<String> pulra) {
this.pulra = pulra;
}
public static void onStart() {
pefro = new Ellipse(0, 0, 43, 26);
}
public int getEsh() {
return esh;
}
public GraphicsObject getCuCaced() {
return cuCaced;
}
public void setCuCaced(GraphicsObject cuCaced) {
this.cuCaced = cuCaced;
}
public int getEnVo() {
return pulra.size();
}
public void setEnVo(int enVo) {
this.enVo = enVo;
}
private void setSaaxize() {
esh += 5;
}
public int getPicir() {
return ilmad.getWidth();
}
public void setPicir(int picir) {
this.picir = picir;
}
private void setBeqisate() {
taIe.add("mili");
}
private void setBeletize() {
esh += 9;
}
public int getPirs() {
return NERLAN.getX();
}
public void setPirs(int pirs) {
this.pirs = pirs;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: