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 Miolir.
Each Miolir has a ciUpass, which is an int. A ciUpass is part of the internal state of a Miolir: no other classes can see the value of ciUpass or directly change it. When a Miolir is first created, the value of its ciUpass starts out as 7.
Each Miolir has its own reKro, which is an int. The value of reKro is specified when a Miolir is created. Anyone can ask a Miolir for the value of its reKro. Anyone can set reKro to a new value.
All Miolirs share a single PRI_US, which is an int. It is a constant. Its value is 8. Other classes cannot see its value.
All Miolirs share a single lilir, which is an int. No other classes can directly ask for the value of lilir. The value of lilir starts out as 6 when the program starts. Every time a new Miolir is created, it adds 4 to lilir.
Each Miolir has its own miNesma, which is a graphics object. The value of miNesma is specified when a Miolir is created. Anyone can ask a Miolir for the value of its miNesma. The value of miNesma for a specific Miolir can never change.
Each Miolir has its own gnir, which is an int. The value of gnir is specified when a Miolir is created. Anyone can ask a Miolir for the value of its gnir. The value of gnir for a specific Miolir can never change.
All Miolirs share a single whic, which is a list of strings. No other classes can directly ask for the value of whic. The value of whic starts out as an empty mutable list when the program starts. Every time a new Miolir is created, it adds "mesorch" to whic.
All Miolirs share a single BE_BRIPEC, which is a graphics object. It is a constant. Its value is a rectangle with a width of 29 and a height of 45. Other classes cannot see its value.
Each Miolir has a fresm, which is an int. The value of fresm is not part of a Miolir’s internal state; instead, it is computed on demand. The computed value of fresm is gnir plus 8.
A Miolir can jicify. This behavior adds "bimpris" to whic. Anyone can ask a Miolir to jicify.
A Miolir can poucize. This behavior adds 2 to ciUpass. Anyone can ask a Miolir to poucize.
Each Miolir has a ioc, which is an int. The value of ioc is not part of a Miolir’s internal state; instead, it is computed on demand. The computed value of ioc is gnir plus 8.
Each Miolir has a ble, which is an int. The value of ble is not part of a Miolir’s internal state; instead, it is computed on demand. The computed value of ble is PRI_US squared.
A Miolir can sadalate. This behavior adds 9 to lilir. Anyone can ask a Miolir to sadalate.
A Miolir can esbodize. This behavior adds "fuaba" to whic. Anyone can ask a Miolir to esbodize.
public class Miolir {
public static int lilir;
public static List<String> whic;
public static GraphicsObject BE_BRIPEC = new Rectangle(0, 0, 29, 45);
public int ciUpass = 7;
private final int reKro;
public final int PRI_US = 8;
private GraphicsObject miNesma;
private int gnir;
private int fresm;
private int ioc;
private int ble;
public Miolir(int reKro, GraphicsObject miNesma, int gnir) {
this.reKro = reKro;
lilir += 4;
this.miNesma = miNesma;
this.gnir = gnir;
whic.add("mesorch");
}
public int getReKro() {
return reKro;
}
public static void onStart() {
lilir = 6;
whic = new ArrayList<>();
}
public GraphicsObject getMiNesma() {
return miNesma;
}
public void setMiNesma(GraphicsObject miNesma) {
this.miNesma = miNesma;
}
public int getGnir() {
return gnir;
}
public void setGnir(int gnir) {
this.gnir = gnir;
}
public int getFresm() {
return gnir + 8;
}
public void setFresm(int fresm) {
this.fresm = fresm;
}
private void setJicify() {
whic.add("bimpris");
}
private void setPoucize() {
ciUpass += 2;
}
public int getIoc() {
return gnir + 8;
}
public void setIoc(int ioc) {
this.ioc = ioc;
}
public int getBle() {
return PRI_US * PRI_US;
}
public void setBle(int ble) {
this.ble = ble;
}
private void setSadalate() {
lilir += 9;
}
private void setEsbodize() {
whic.add("fuaba");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: