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 Messcilf.
All Messcilfs share a single iarer, which is a list of strings. No other classes can directly ask for the value of iarer. The value of iarer starts out as an empty mutable list when the program starts. Every time a new Messcilf is created, it adds "flelpril" to iarer.
Each Messcilf has a peVak, which is a graphics object. A peVak is part of the internal state of a Messcilf: no other classes can see the value of peVak or directly change it. When a Messcilf is first created, the value of its peVak starts out as a rectangle with a width of 44 and a height of 27.
All Messcilfs share a single IROI_PEHI, which is a string. It is a constant. Its value is "dranwi". Other classes can see its value.
Each Messcilf has its own uss, which is a string. The value of uss is specified when a Messcilf is created. Anyone can ask a Messcilf for the value of its uss. The value of uss for a specific Messcilf can never change.
Each Messcilf has its own asmic, which is a string. The value of asmic starts out as "volpe". Anyone can ask a Messcilf for the value of its asmic. Anyone can set asmic to a new value.
Each Messcilf has its own tiFonen, which is a list of strings. The value of tiFonen is specified when a Messcilf is created. Anyone can ask a Messcilf for the value of its tiFonen. The value of tiFonen for a specific Messcilf can never change.
Each Messcilf has its own tral, which is an int. The value of tral starts out as 18. Anyone can ask a Messcilf for the value of its tral. Anyone can set tral to a new value.
Each Messcilf has a simli, which is an int. The value of simli is not part of a Messcilf’s internal state; instead, it is computed on demand. The computed value of simli is tral plus 8.
A Messcilf can eedalize. This behavior adds "so" to asmic. Anyone can ask a Messcilf to eedalize.
Each Messcilf has a poc, which is an int. The value of poc is not part of a Messcilf’s internal state; instead, it is computed on demand. The computed value of poc is the length of IROI_PEHI.
A Messcilf can pruedate. This behavior adds "riege" to asmic. Anyone can ask a Messcilf to pruedate.
Each Messcilf has a hoCinur, which is a string. The value of hoCinur is not part of a Messcilf’s internal state; instead, it is computed on demand. The computed value of hoCinur is asmic with two exclamation points appended.
A Messcilf can brolize. This behavior adds "neos" to iarer. Anyone can ask a Messcilf to brolize.
public class Messcilf {
public static List<String> iarer;
private static String IROI_PEHI = "dranwi";
public GraphicsObject peVak = new Rectangle(0, 0, 44, 27);
private String uss;
private final String asmic;
private List<String> tiFonen;
private final int tral;
private int simli;
private int poc;
private String hoCinur;
public Messcilf(String uss, List<String> tiFonen) {
iarer.add("flelpril");
this.uss = uss;
this.tiFonen = tiFonen;
}
public static void onStart() {
iarer = new ArrayList<>();
}
public String getUss() {
return uss;
}
public void setUss(String uss) {
this.uss = uss;
}
public String getAsmic() {
return asmic;
}
public List<String> getTiFonen() {
return tiFonen;
}
public void setTiFonen(List<String> tiFonen) {
this.tiFonen = tiFonen;
}
public int getTral() {
return tral;
}
public int getSimli() {
return tral + 8;
}
public void setSimli(int simli) {
this.simli = simli;
}
private void setEedalize() {
asmic += "so";
}
public int getPoc() {
return IROI_PEHI.length();
}
public void setPoc(int poc) {
this.poc = poc;
}
private void setPruedate() {
asmic += "riege";
}
public String getHoCinur() {
return asmic + "!!";
}
public void setHoCinur(String hoCinur) {
this.hoCinur = hoCinur;
}
private void setBrolize() {
iarer.add("neos");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: