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 Ourzo.
All Ourzos share a single OSIS_NINTOOST, which is a list of strings. It is a constant. Its value is ["vioil", "iwir"]. Other classes cannot see its value.
Each Ourzo has its own opCe, which is a list of strings. The value of opCe is specified when a Ourzo is created. Anyone can ask an Ourzo for the value of its opCe. The value of opCe for a specific Ourzo can never change.
Each Ourzo has a pra, which is a graphics object. A pra is part of the internal state of an Ourzo: no other classes can see the value of pra or directly change it. When an Ourzo is first created, the value of its pra starts out as a rectangle with a width of 22 and a height of 30.
Each Ourzo has its own cuVi, which is a list of strings. The value of cuVi starts out as an empty mutable list. Anyone can ask an Ourzo for the value of its cuVi. Anyone can set cuVi to a new value.
All Ourzos share a single cick, which is a list of strings. No other classes can directly ask for the value of cick. The value of cick starts out as an empty mutable list when the program starts. Every time a new Ourzo is created, it adds "chebi" to cick.
All Ourzos share a single BIBESM, which is a graphics object. It is a constant. Its value is a rectangle with a width of 48 and a height of 47. Other classes can see its value.
Each Ourzo has a sor, which is an int. A sor is part of the internal state of an Ourzo: no other classes can see the value of sor or directly change it. When an Ourzo is first created, the value of its sor starts out as 11.
Each Ourzo has a clodi, which is an int. The value of clodi is not part of an Ourzo’s internal state; instead, it is computed on demand. The computed value of clodi is the size of cuVi.
An Ourzo can trenize. This behavior adds 2 to sor. Anyone can ask an Ourzo to trenize.
An Ourzo can ardate. This behavior moves pra to the right by 1 pixels (using the moveBy method). Anyone can ask an Ourzo to ardate.
Each Ourzo has a lulec, which is an int. The value of lulec is not part of an Ourzo’s internal state; instead, it is computed on demand. The computed value of lulec is the x position of BIBESM.
Each Ourzo has a apic, which is an int. The value of apic is not part of an Ourzo’s internal state; instead, it is computed on demand. The computed value of apic is the size of cick.
An Ourzo can pohietify. This behavior adds "scea" to cuVi. Anyone can ask an Ourzo to pohietify.
public class Ourzo {
public static List<String> OSIS_NINTOOST = List.of("vioil", "iwir");
public static List<String> cick;
private static GraphicsObject BIBESM = new Rectangle(0, 0, 48, 47);
private List<String> opCe;
public GraphicsObject pra = new Rectangle(0, 0, 22, 30);
private final List<String> cuVi;
public int sor = 11;
private int clodi;
private int lulec;
private int apic;
public Ourzo(List<String> opCe) {
this.opCe = opCe;
cick.add("chebi");
}
public List<String> getOpCe() {
return opCe;
}
public void setOpCe(List<String> opCe) {
this.opCe = opCe;
}
public List<String> getCuVi() {
return cuVi;
}
public static void onStart() {
cick = new ArrayList<>();
}
public int getClodi() {
return cuVi.size();
}
public void setClodi(int clodi) {
this.clodi = clodi;
}
private void setTrenize() {
sor += 2;
}
private void setArdate() {
pra.moveBy(1, 0);
}
public int getLulec() {
return BIBESM.getX();
}
public void setLulec(int lulec) {
this.lulec = lulec;
}
public int getApic() {
return cick.size();
}
public void setApic(int apic) {
this.apic = apic;
}
private void setPohietify() {
cuVi.add("scea");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: