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 HecChakil.
All HecChakils share a single plen, which is a list of strings. No other classes can directly ask for the value of plen. The value of plen starts out as an empty mutable list when the program starts. Every time a new HecChakil is created, it adds "insleng" to plen.
All HecChakils share a single TENROM, which is a graphics object. It is a constant. Its value is an ellipse with a width of 22 and a height of 48. Other classes can see its value.
Each HecChakil has a elShrax, which is a list of strings. An elShrax is part of the internal state of a HecChakil: no other classes can see the value of elShrax or directly change it. When a HecChakil is first created, the value of its elShrax starts out as an empty mutable list.
Each HecChakil has its own vaint, which is a list of strings. The value of vaint is specified when a HecChakil is created. Anyone can ask a HecChakil for the value of its vaint. The value of vaint for a specific HecChakil can never change.
Each HecChakil has its own ilded, which is a string. The value of ilded is specified when a HecChakil is created. Anyone can ask a HecChakil for the value of its ilded. Anyone can set ilded to a new value.
A HecChakil can weucize. This behavior adds "un" to plen. Anyone can ask a HecChakil to weucize.
Each HecChakil has a miass, which is a string. The value of miass is not part of a HecChakil’s internal state; instead, it is computed on demand. The computed value of miass is the first element of elShrax.
Each HecChakil has a medna, which is an int. The value of medna is not part of a HecChakil’s internal state; instead, it is computed on demand. The computed value of medna is the x position of TENROM.
A HecChakil can midiutify. This behavior adds "thiai" to plen. Anyone can ask a HecChakil to midiutify.
public class HecChakil {
public static List<String> plen;
private static GraphicsObject TENROM = new Ellipse(0, 0, 22, 48);
public List<String> elShrax = new ArrayList<>();
private List<String> vaint;
private final String ilded;
private String miass;
private int medna;
public HecChakil(List<String> vaint, String ilded) {
plen.add("insleng");
this.vaint = vaint;
this.ilded = ilded;
}
public static void onStart() {
plen = new ArrayList<>();
}
public List<String> getVaint() {
return vaint;
}
public void setVaint(List<String> vaint) {
this.vaint = vaint;
}
public String getIlded() {
return ilded;
}
private void setWeucize() {
plen.add("un");
}
public String getMiass() {
return elShrax.get(0);
}
public void setMiass(String miass) {
this.miass = miass;
}
public int getMedna() {
return TENROM.getX();
}
public void setMedna(int medna) {
this.medna = medna;
}
private void setMidiutify() {
plen.add("thiai");
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: