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 Spheblo.
All Spheblos share a single hos, which is a list of strings. No other classes can directly ask for the value of hos. The value of hos starts out as an empty mutable list when the program starts. Every time a new Spheblo is created, it adds "nimmel" to hos.
Each Spheblo has a orLe, which is a string. An orLe is part of the internal state of a Spheblo: no other classes can see the value of orLe or directly change it. When a Spheblo is first created, the value of its orLe starts out as "shossblar".
All Spheblos share a single IL_RITUL, which is a graphics object. It is a constant. Its value is a rectangle with a width of 22 and a height of 46. Other classes cannot see its value.
Each Spheblo has its own brisi, which is a string. The value of brisi is specified when a Spheblo is created. Anyone can ask a Spheblo for the value of its brisi. The value of brisi for a specific Spheblo can never change.
Each Spheblo has its own edDuar, which is a graphics object. The value of edDuar is specified when a Spheblo is created. Anyone can ask a Spheblo for the value of its edDuar. Anyone can set edDuar to a new value.
Each Spheblo has a jes, which is a string. The value of jes is not part of a Spheblo’s internal state; instead, it is computed on demand. The computed value of jes is the first element of hos.
A Spheblo can wrelate. This behavior adds "lo" to hos. Anyone can ask a Spheblo to wrelate.
Each Spheblo has a veEodu, which is an int. The value of veEodu is not part of a Spheblo’s internal state; instead, it is computed on demand. The computed value of veEodu is the width of edDuar.
A Spheblo can unkotate. This behavior adds "mi" to hos. Anyone can ask a Spheblo to unkotate.
public class Spheblo {
public static List<String> hos;
public static GraphicsObject IL_RITUL = new Rectangle(0, 0, 22, 46);
public String orLe = "shossblar";
private String brisi;
private final GraphicsObject edDuar;
private String jes;
private int veEodu;
public Spheblo(String brisi, GraphicsObject edDuar) {
hos.add("nimmel");
this.brisi = brisi;
this.edDuar = edDuar;
}
public static void onStart() {
hos = new ArrayList<>();
}
public String getBrisi() {
return brisi;
}
public void setBrisi(String brisi) {
this.brisi = brisi;
}
public GraphicsObject getEdDuar() {
return edDuar;
}
public String getJes() {
return hos.get(0);
}
public void setJes(String jes) {
this.jes = jes;
}
private void setWrelate() {
hos.add("lo");
}
public int getVeEodu() {
return edDuar.getWidth();
}
public void setVeEodu(int veEodu) {
this.veEodu = veEodu;
}
private void setUnkotate() {
hos.add("mi");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: