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 an Uscir.
All Uscirs share a single baPlun, which is a graphics object. No other classes can directly ask for the value of baPlun. The value of baPlun starts out as a rectangle with a width of 28 and a height of 29 when the program starts. Every time a new Uscir is created, it moves baPlun to the right by 3 pixels (using the moveBy method).
Each Uscir has its own cea, which is a string. The value of cea is specified when a Uscir is created. Anyone can ask an Uscir for the value of its cea. Anyone can set cea to a new value.
All Uscirs share a single ROLIK_UT, which is a string. It is a constant. Its value is "diool". Other classes can see its value.
Each Uscir has a loti, which is an int. A loti is part of the internal state of an Uscir: no other classes can see the value of loti or directly change it. When an Uscir is first created, the value of its loti starts out as 7.
Each Uscir has its own noss, which is a list of strings. The value of noss is specified when a Uscir is created. Anyone can ask an Uscir for the value of its noss. The value of noss for a specific Uscir can never change.
All Uscirs share a single SO_IPSEN, which is a graphics object. It is a constant. Its value is a rectangle with a width of 18 and a height of 14. Other classes can see its value.
Each Uscir has a plioc, which is a string. A plioc is part of the internal state of an Uscir: no other classes can see the value of plioc or directly change it. When an Uscir is first created, the value of its plioc starts out as "il".
Each Uscir has its own nuesa, which is an int. The value of nuesa is specified when a Uscir is created. Anyone can ask an Uscir for the value of its nuesa. The value of nuesa for a specific Uscir can never change.
Each Uscir has a icpe, which is a string. The value of icpe is not part of an Uscir’s internal state; instead, it is computed on demand. The computed value of icpe is the first element of noss.
An Uscir can peangify. This behavior adds 8 to loti. Anyone can ask an Uscir to peangify.
An Uscir can spolate. This behavior adds "destco" to plioc. Anyone can ask an Uscir to spolate.
Each Uscir has a gesh, which is a string. The value of gesh is not part of an Uscir’s internal state; instead, it is computed on demand. The computed value of gesh is ROLIK_UT with two exclamation points appended.
An Uscir can dedeonify. This behavior adds 1 to loti. Anyone can ask an Uscir to dedeonify.
Each Uscir has a seKior, which is a string. The value of seKior is not part of an Uscir’s internal state; instead, it is computed on demand. The computed value of seKior is plioc with two exclamation points appended.
An Uscir can ontnitize. This behavior moves baPlun to the right by 9 pixels (using the moveBy method). Anyone can ask an Uscir to ontnitize.
public class Uscir {
public static GraphicsObject baPlun;
private static String ROLIK_UT = "diool";
private static GraphicsObject SO_IPSEN = new Rectangle(0, 0, 18, 14);
private final String cea;
public int loti = 7;
private List<String> noss;
public String plioc = "il";
private int nuesa;
private String icpe;
private String gesh;
private String seKior;
public Uscir(String cea, List<String> noss, int nuesa) {
baPlun.moveBy(3, 0);
this.cea = cea;
this.noss = noss;
this.nuesa = nuesa;
}
public static void onStart() {
baPlun = new Rectangle(0, 0, 28, 29);
}
public String getCea() {
return cea;
}
public List<String> getNoss() {
return noss;
}
public void setNoss(List<String> noss) {
this.noss = noss;
}
public int getNuesa() {
return nuesa;
}
public void setNuesa(int nuesa) {
this.nuesa = nuesa;
}
public String getIcpe() {
return noss.get(0);
}
public void setIcpe(String icpe) {
this.icpe = icpe;
}
private void setPeangify() {
loti += 8;
}
private void setSpolate() {
plioc += "destco";
}
public String getGesh() {
return ROLIK_UT + "!!";
}
public void setGesh(String gesh) {
this.gesh = gesh;
}
private void setDedeonify() {
loti += 1;
}
public String getSeKior() {
return plioc + "!!";
}
public void setSeKior(String seKior) {
this.seKior = seKior;
}
private void setOntnitize() {
baPlun.moveBy(9, 0);
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: