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 Breruo.
All Breruos share a single CHOSOSS, which is a graphics object. It is a constant. Its value is a rectangle with a width of 48 and a height of 34. Other classes cannot see its value.
Each Breruo has its own toId, which is a string. The value of toId is specified when a Breruo is created. Anyone can ask a Breruo for the value of its toId. The value of toId for a specific Breruo can never change.
Each Breruo has its own sto, which is a graphics object. The value of sto is specified when a Breruo is created. Anyone can ask a Breruo for the value of its sto. Anyone can set sto to a new value.
Each Breruo has a dic, which is an int. A dic is part of the internal state of a Breruo: no other classes can see the value of dic or directly change it. When a Breruo is first created, the value of its dic starts out as 2.
All Breruos share a single roung, which is a list of strings. No other classes can directly ask for the value of roung. The value of roung starts out as an empty mutable list when the program starts. Every time a new Breruo is created, it adds "os" to roung.
A Breruo can irtionate. This behavior moves sto to the right by 6 pixels (using the moveBy method). Anyone can ask a Breruo to irtionate.
Each Breruo has a reEdse, which is an int. The value of reEdse is not part of a Breruo’s internal state; instead, it is computed on demand. The computed value of reEdse is dic squared.
Each Breruo has a phebo, which is a string. The value of phebo is not part of a Breruo’s internal state; instead, it is computed on demand. The computed value of phebo is the first element of roung.
A Breruo can epsetize. This behavior moves sto to the right by 3 pixels (using the moveBy method). Anyone can ask a Breruo to epsetize.
public class Breruo {
public static GraphicsObject CHOSOSS = new Rectangle(0, 0, 48, 34);
public static List<String> roung;
private String toId;
private final GraphicsObject sto;
public int dic = 2;
private int reEdse;
private String phebo;
public Breruo(String toId, GraphicsObject sto) {
this.toId = toId;
this.sto = sto;
roung.add("os");
}
public String getToId() {
return toId;
}
public void setToId(String toId) {
this.toId = toId;
}
public GraphicsObject getSto() {
return sto;
}
public static void onStart() {
roung = new ArrayList<>();
}
private void setIrtionate() {
sto.moveBy(6, 0);
}
public int getReEdse() {
return dic * dic;
}
public void setReEdse(int reEdse) {
this.reEdse = reEdse;
}
public String getPhebo() {
return roung.get(0);
}
public void setPhebo(String phebo) {
this.phebo = phebo;
}
private void setEpsetize() {
sto.moveBy(3, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: