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 Piosmnesh.
Each Piosmnesh has its own pra, which is an int. The value of pra is specified when a Piosmnesh is created. Anyone can ask a Piosmnesh for the value of its pra. The value of pra for a specific Piosmnesh can never change.
Each Piosmnesh has its own rirm, which is a graphics object. The value of rirm starts out as a rectangle with a width of 16 and a height of 11. Anyone can ask a Piosmnesh for the value of its rirm. Anyone can set rirm to a new value.
Each Piosmnesh has a saOura, which is a string. A saOura is part of the internal state of a Piosmnesh: no other classes can see the value of saOura or directly change it. When a Piosmnesh is first created, the value of its saOura starts out as "incis".
All Piosmneshs share a single busm, which is a list of strings. No other classes can directly ask for the value of busm. The value of busm starts out as an empty mutable list when the program starts. Every time a new Piosmnesh is created, it adds "assra" to busm.
All Piosmneshs share a single IO_FIATCH, which is a list of strings. It is a constant. Its value is ["pielpu", "psiche", "dudir"]. Other classes can see its value.
Each Piosmnesh has its own fuSpo, which is a graphics object. The value of fuSpo is specified when a Piosmnesh is created. Anyone can ask a Piosmnesh for the value of its fuSpo. The value of fuSpo for a specific Piosmnesh can never change.
All Piosmneshs share a single PENSUWK, which is a list of strings. It is a constant. Its value is ["nem", "jisspap"]. Other classes cannot see its value.
Each Piosmnesh has a alio, which is a string. An alio is part of the internal state of a Piosmnesh: no other classes can see the value of alio or directly change it. When a Piosmnesh is first created, the value of its alio starts out as "resxian".
A Piosmnesh can qawacate. This behavior moves rirm to the right by 4 pixels (using the moveBy method). Anyone can ask a Piosmnesh to qawacate.
Each Piosmnesh has a iaIrmip, which is an int. The value of iaIrmip is not part of a Piosmnesh’s internal state; instead, it is computed on demand. The computed value of iaIrmip is the size of busm.
Each Piosmnesh has a horen, which is an int. The value of horen is not part of a Piosmnesh’s internal state; instead, it is computed on demand. The computed value of horen is the width of fuSpo.
A Piosmnesh can nenate. This behavior adds "giertatt" to alio. Anyone can ask a Piosmnesh to nenate.
A Piosmnesh can earerize. This behavior adds "ulick" to alio. Anyone can ask a Piosmnesh to earerize.
Each Piosmnesh has a ewi, which is an int. The value of ewi is not part of a Piosmnesh’s internal state; instead, it is computed on demand. The computed value of ewi is the x position of fuSpo.
A Piosmnesh can emossize. This behavior adds "orn" to alio. Anyone can ask a Piosmnesh to emossize.
public class Piosmnesh {
public static List<String> busm;
private static List<String> IO_FIATCH = List.of("pielpu", "psiche", "dudir");
public static List<String> PENSUWK = List.of("nem", "jisspap");
private int pra;
private final GraphicsObject rirm;
public String saOura = "incis";
private GraphicsObject fuSpo;
public String alio = "resxian";
private int iaIrmip;
private int horen;
private int ewi;
public Piosmnesh(int pra, GraphicsObject fuSpo) {
this.pra = pra;
busm.add("assra");
this.fuSpo = fuSpo;
}
public int getPra() {
return pra;
}
public void setPra(int pra) {
this.pra = pra;
}
public GraphicsObject getRirm() {
return rirm;
}
public static void onStart() {
busm = new ArrayList<>();
}
public GraphicsObject getFuSpo() {
return fuSpo;
}
public void setFuSpo(GraphicsObject fuSpo) {
this.fuSpo = fuSpo;
}
private void setQawacate() {
rirm.moveBy(4, 0);
}
public int getIaIrmip() {
return busm.size();
}
public void setIaIrmip(int iaIrmip) {
this.iaIrmip = iaIrmip;
}
public int getHoren() {
return fuSpo.getWidth();
}
public void setHoren(int horen) {
this.horen = horen;
}
private void setNenate() {
alio += "giertatt";
}
private void setEarerize() {
alio += "ulick";
}
public int getEwi() {
return fuSpo.getX();
}
public void setEwi(int ewi) {
this.ewi = ewi;
}
private void setEmossize() {
alio += "orn";
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: