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 Xeka.
All Xekas share a single TROSSTAS, which is a graphics object. It is a constant. Its value is an ellipse with a width of 23 and a height of 27. Other classes can see its value.
All Xekas share a single asdel, which is an int. No other classes can directly ask for the value of asdel. The value of asdel starts out as 4 when the program starts. Every time a new Xeka is created, it adds 2 to asdel.
Each Xeka has its own hoNiaed, which is a list of strings. The value of hoNiaed is specified when a Xeka is created. Anyone can ask a Xeka for the value of its hoNiaed. The value of hoNiaed for a specific Xeka can never change.
Each Xeka has a har, which is a list of strings. A har is part of the internal state of a Xeka: no other classes can see the value of har or directly change it. When a Xeka is first created, the value of its har starts out as an empty mutable list.
Each Xeka has its own fai, which is a string. The value of fai is specified when a Xeka is created. Anyone can ask a Xeka for the value of its fai. Anyone can set fai to a new value.
A Xeka can esiedate. This behavior adds "diant" to har. Anyone can ask a Xeka to esiedate.
Each Xeka has a niont, which is an int. The value of niont is not part of a Xeka’s internal state; instead, it is computed on demand. The computed value of niont is the size of hoNiaed.
Each Xeka has a peMa, which is a string. The value of peMa is not part of a Xeka’s internal state; instead, it is computed on demand. The computed value of peMa is fai with two exclamation points appended.
A Xeka can hiialate. This behavior adds 3 to asdel. Anyone can ask a Xeka to hiialate.
public class Xeka {
private static GraphicsObject TROSSTAS = new Ellipse(0, 0, 23, 27);
public static int asdel;
private List<String> hoNiaed;
public List<String> har = new ArrayList<>();
private final String fai;
private int niont;
private String peMa;
public Xeka(List<String> hoNiaed, String fai) {
asdel += 2;
this.hoNiaed = hoNiaed;
this.fai = fai;
}
public static void onStart() {
asdel = 4;
}
public List<String> getHoNiaed() {
return hoNiaed;
}
public void setHoNiaed(List<String> hoNiaed) {
this.hoNiaed = hoNiaed;
}
public String getFai() {
return fai;
}
private void setEsiedate() {
har.add("diant");
}
public int getNiont() {
return hoNiaed.size();
}
public void setNiont(int niont) {
this.niont = niont;
}
public String getPeMa() {
return fai + "!!";
}
public void setPeMa(String peMa) {
this.peMa = peMa;
}
private void setHiialate() {
asdel += 3;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: