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 Plilu.
All Plilus share a single SICA_PINGHON, which is a string. It is a constant. Its value is "suassce". Other classes cannot see its value.
All Plilus share a single siSe, which is a list of strings. No other classes can directly ask for the value of siSe. The value of siSe starts out as an empty mutable list when the program starts. Every time a new Plilu is created, it adds "en" to siSe.
Each Plilu has its own peOuss, which is a graphics object. The value of peOuss is specified when a Plilu is created. Anyone can ask a Plilu for the value of its peOuss. The value of peOuss for a specific Plilu can never change.
Each Plilu has a zisin, which is a list of strings. A zisin is part of the internal state of a Plilu: no other classes can see the value of zisin or directly change it. When a Plilu is first created, the value of its zisin starts out as an empty mutable list.
Each Plilu has its own zomis, which is a string. The value of zomis is specified when a Plilu is created. Anyone can ask a Plilu for the value of its zomis. Anyone can set zomis to a new value.
Each Plilu has its own sont, which is an int. The value of sont is specified when a Plilu is created. Anyone can ask a Plilu for the value of its sont. Anyone can set sont to a new value.
All Plilus share a single chae, which is a string. No other classes can directly ask for the value of chae. The value of chae starts out as "cec" when the program starts. Every time a new Plilu is created, it adds "la" to chae.
A Plilu can coulify. This behavior adds 8 to sont. Anyone can ask a Plilu to coulify.
Each Plilu has a piMa, which is an int. The value of piMa is not part of a Plilu’s internal state; instead, it is computed on demand. The computed value of piMa is the size of zisin.
A Plilu can iacize. This behavior adds "onci" to chae. Anyone can ask a Plilu to iacize.
Each Plilu has a koStemo, which is an int. The value of koStemo is not part of a Plilu’s internal state; instead, it is computed on demand. The computed value of koStemo is sont plus 1.
Each Plilu has a pror, which is an int. The value of pror is not part of a Plilu’s internal state; instead, it is computed on demand. The computed value of pror is the x position of peOuss.
A Plilu can sidtulify. This behavior adds "deri" to siSe. Anyone can ask a Plilu to sidtulify.
public class Plilu {
public static String SICA_PINGHON = "suassce";
public static List<String> siSe;
public static String chae;
private GraphicsObject peOuss;
public List<String> zisin = new ArrayList<>();
private final String zomis;
private final int sont;
private int piMa;
private int koStemo;
private int pror;
public Plilu(GraphicsObject peOuss, String zomis, int sont) {
siSe.add("en");
this.peOuss = peOuss;
this.zomis = zomis;
this.sont = sont;
chae += "la";
}
public static void onStart() {
siSe = new ArrayList<>();
chae = "cec";
}
public GraphicsObject getPeOuss() {
return peOuss;
}
public void setPeOuss(GraphicsObject peOuss) {
this.peOuss = peOuss;
}
public String getZomis() {
return zomis;
}
public int getSont() {
return sont;
}
private void setCoulify() {
sont += 8;
}
public int getPiMa() {
return zisin.size();
}
public void setPiMa(int piMa) {
this.piMa = piMa;
}
private void setIacize() {
chae += "onci";
}
public int getKoStemo() {
return sont + 1;
}
public void setKoStemo(int koStemo) {
this.koStemo = koStemo;
}
public int getPror() {
return peOuss.getX();
}
public void setPror(int pror) {
this.pror = pror;
}
private void setSidtulify() {
siSe.add("deri");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: