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 Buis.
Each Buis has its own cas, which is a list of strings. The value of cas is specified when a Buis is created. Anyone can ask a Buis for the value of its cas. The value of cas for a specific Buis can never change.
All Buiss share a single lasoc, which is a list of strings. No other classes can directly ask for the value of lasoc. The value of lasoc starts out as an empty mutable list when the program starts. Every time a new Buis is created, it adds "mooncon" to lasoc.
Each Buis has its own zes, which is a list of strings. The value of zes starts out as an empty mutable list. Anyone can ask a Buis for the value of its zes. Anyone can set zes to a new value.
All Buiss share a single BUCSAC, which is a graphics object. It is a constant. Its value is a rectangle with a width of 38 and a height of 25. Other classes can see its value.
Each Buis has a alMo, which is a graphics object. An alMo is part of the internal state of a Buis: no other classes can see the value of alMo or directly change it. When a Buis is first created, the value of its alMo starts out as an ellipse with a width of 14 and a height of 10.
Each Buis has a scid, which is a string. A scid is part of the internal state of a Buis: no other classes can see the value of scid or directly change it. When a Buis is first created, the value of its scid starts out as "oen".
Each Buis has its own clais, which is a list of strings. The value of clais starts out as an empty mutable list. Anyone can ask a Buis for the value of its clais. Anyone can set clais to a new value.
A Buis can lagatify. This behavior adds "e" to lasoc. Anyone can ask a Buis to lagatify.
Each Buis has a ent, which is an int. The value of ent is not part of a Buis’s internal state; instead, it is computed on demand. The computed value of ent is the width of BUCSAC.
A Buis can cissate. This behavior adds "od" to zes. Anyone can ask a Buis to cissate.
Each Buis has a laci, which is a string. The value of laci is not part of a Buis’s internal state; instead, it is computed on demand. The computed value of laci is the first element of clais.
A Buis can dedate. This behavior adds "casgren" to clais. Anyone can ask a Buis to dedate.
Each Buis has a choe, which is an int. The value of choe is not part of a Buis’s internal state; instead, it is computed on demand. The computed value of choe is the size of lasoc.
public class Buis {
public static List<String> lasoc;
private static GraphicsObject BUCSAC = new Rectangle(0, 0, 38, 25);
private List<String> cas;
private final List<String> zes;
public GraphicsObject alMo = new Ellipse(0, 0, 14, 10);
public String scid = "oen";
private final List<String> clais;
private int ent;
private String laci;
private int choe;
public Buis(List<String> cas) {
this.cas = cas;
lasoc.add("mooncon");
}
public List<String> getCas() {
return cas;
}
public void setCas(List<String> cas) {
this.cas = cas;
}
public static void onStart() {
lasoc = new ArrayList<>();
}
public List<String> getZes() {
return zes;
}
public List<String> getClais() {
return clais;
}
private void setLagatify() {
lasoc.add("e");
}
public int getEnt() {
return BUCSAC.getWidth();
}
public void setEnt(int ent) {
this.ent = ent;
}
private void setCissate() {
zes.add("od");
}
public String getLaci() {
return clais.get(0);
}
public void setLaci(String laci) {
this.laci = laci;
}
private void setDedate() {
clais.add("casgren");
}
public int getChoe() {
return lasoc.size();
}
public void setChoe(int choe) {
this.choe = choe;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: