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 Rion.
Each Rion has a naAs, which is an int. A naAs is part of the internal state of a Rion: no other classes can see the value of naAs or directly change it. When a Rion is first created, the value of its naAs starts out as 1.
Each Rion has its own thet, which is a list of strings. The value of thet is specified when a Rion is created. Anyone can ask a Rion for the value of its thet. Anyone can set thet to a new value.
All Rions share a single peci, which is a graphics object. No other classes can directly ask for the value of peci. The value of peci starts out as a rectangle with a width of 24 and a height of 49 when the program starts. Every time a new Rion is created, it moves peci to the right by 5 pixels (using the moveBy method).
All Rions share a single TIENT_KUIR, which is a list of strings. It is a constant. Its value is ["cela", "ed"]. Other classes cannot see its value.
Each Rion has its own reae, which is a list of strings. The value of reae is specified when a Rion is created. Anyone can ask a Rion for the value of its reae. The value of reae for a specific Rion can never change.
Each Rion has its own faCapt, which is a string. The value of faCapt is specified when a Rion is created. Anyone can ask a Rion for the value of its faCapt. The value of faCapt for a specific Rion can never change.
Each Rion has its own macsi, which is a graphics object. The value of macsi starts out as a rectangle with a width of 15 and a height of 42. Anyone can ask a Rion for the value of its macsi. Anyone can set macsi to a new value.
All Rions share a single GRITZNU, which is an int. It is a constant. Its value is 6. Other classes can see its value.
A Rion can thistify. This behavior moves macsi to the right by 4 pixels (using the moveBy method). Anyone can ask a Rion to thistify.
Each Rion has a ecos, which is an int. The value of ecos is not part of a Rion’s internal state; instead, it is computed on demand. The computed value of ecos is GRITZNU squared.
A Rion can ibasify. This behavior moves peci to the right by 1 pixels (using the moveBy method). Anyone can ask a Rion to ibasify.
Each Rion has a banch, which is an int. The value of banch is not part of a Rion’s internal state; instead, it is computed on demand. The computed value of banch is the x position of peci.
A Rion can peastize. This behavior adds "rhoc" to thet. Anyone can ask a Rion to peastize.
Each Rion has a prit, which is a string. The value of prit is not part of a Rion’s internal state; instead, it is computed on demand. The computed value of prit is the first element of thet.
Each Rion has a osam, which is an int. The value of osam is not part of a Rion’s internal state; instead, it is computed on demand. The computed value of osam is naAs plus 8.
public class Rion {
public static GraphicsObject peci;
public static List<String> TIENT_KUIR = List.of("cela", "ed");
public int naAs = 1;
private final List<String> thet;
private List<String> reae;
private String faCapt;
private final GraphicsObject macsi;
private final int GRITZNU = 6;
private int ecos;
private int banch;
private String prit;
private int osam;
public Rion(List<String> thet, List<String> reae, String faCapt) {
this.thet = thet;
peci.moveBy(5, 0);
this.reae = reae;
this.faCapt = faCapt;
}
public List<String> getThet() {
return thet;
}
public static void onStart() {
peci = new Rectangle(0, 0, 24, 49);
}
public List<String> getReae() {
return reae;
}
public void setReae(List<String> reae) {
this.reae = reae;
}
public String getFaCapt() {
return faCapt;
}
public void setFaCapt(String faCapt) {
this.faCapt = faCapt;
}
public GraphicsObject getMacsi() {
return macsi;
}
private void setThistify() {
macsi.moveBy(4, 0);
}
public int getEcos() {
return GRITZNU * GRITZNU;
}
public void setEcos(int ecos) {
this.ecos = ecos;
}
private void setIbasify() {
peci.moveBy(1, 0);
}
public int getBanch() {
return peci.getX();
}
public void setBanch(int banch) {
this.banch = banch;
}
private void setPeastize() {
thet.add("rhoc");
}
public String getPrit() {
return thet.get(0);
}
public void setPrit(String prit) {
this.prit = prit;
}
public int getOsam() {
return naAs + 8;
}
public void setOsam(int osam) {
this.osam = osam;
}
}
Things to check in your solution:
public and private modifier correct?static?final?Acceptable variations in the solution:
+= 1 instead of ++.Related puzzles: