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 Ouste.
Each Ouste has a qish, which is a list of strings. A qish is part of the internal state of an Ouste: no other classes can see the value of qish or directly change it. When an Ouste is first created, the value of its qish starts out as an empty mutable list.
All Oustes share a single SUTHGIAN, which is a string. It is a constant. Its value is "coomed". Other classes can see its value.
Each Ouste has its own rou, which is a string. The value of rou starts out as "ues". Anyone can ask an Ouste for the value of its rou. Anyone can set rou to a new value.
All Oustes share a single ouHe, which is a graphics object. No other classes can directly ask for the value of ouHe. The value of ouHe starts out as a rectangle with a width of 24 and a height of 44 when the program starts. Every time a new Ouste is created, it moves ouHe to the right by 5 pixels (using the moveBy method).
Each Ouste has its own shaen, which is a graphics object. The value of shaen is specified when a Ouste is created. Anyone can ask an Ouste for the value of its shaen. The value of shaen for a specific Ouste can never change.
Each Ouste has a uss, which is an int. The value of uss is not part of an Ouste’s internal state; instead, it is computed on demand. The computed value of uss is the width of ouHe.
An Ouste can caesify. This behavior moves ouHe to the right by 7 pixels (using the moveBy method). Anyone can ask an Ouste to caesify.
An Ouste can wengize. This behavior adds "qal" to qish. Anyone can ask an Ouste to wengize.
Each Ouste has a ecur, which is an int. The value of ecur is not part of an Ouste’s internal state; instead, it is computed on demand. The computed value of ecur is the length of SUTHGIAN.
public class Ouste {
private static String SUTHGIAN = "coomed";
public static GraphicsObject ouHe;
public List<String> qish = new ArrayList<>();
private final String rou;
private GraphicsObject shaen;
private int uss;
private int ecur;
public Ouste(GraphicsObject shaen) {
ouHe.moveBy(5, 0);
this.shaen = shaen;
}
public String getRou() {
return rou;
}
public static void onStart() {
ouHe = new Rectangle(0, 0, 24, 44);
}
public GraphicsObject getShaen() {
return shaen;
}
public void setShaen(GraphicsObject shaen) {
this.shaen = shaen;
}
public int getUss() {
return ouHe.getWidth();
}
public void setUss(int uss) {
this.uss = uss;
}
private void setCaesify() {
ouHe.moveBy(7, 0);
}
private void setWengize() {
qish.add("qal");
}
public int getEcur() {
return SUTHGIAN.length();
}
public void setEcur(int ecur) {
this.ecur = ecur;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: