Add: JavaDoc for Inventor class

This commit is contained in:
MatteoPellegrino05
2026-04-12 17:30:23 +02:00
parent f4d0dad8ec
commit 6a96e24e11
@@ -7,18 +7,20 @@ public class Inventor extends Character {
private int icon; private int icon;
/** /**
* Returns the icon value of this Inventor card.
* *
* @return Inventor Specific Symbol * @return the icon value of this Inventor card
*/ */
public int Icon() { public int Icon() {
return icon; return icon;
} }
/** /**
* Creates an Inventor character card with the specified era and icon value.
* *
* @param Era inventor era * @param Era the era of the Inventor card
* @param icon inventor symbol * @param icon the icon value of the Inventor card
* @throws IllegalArgumentException * @throws IllegalArgumentException if {@code icon < 0} or {@code icon > 9}
*/ */
public Inventor(int Era,int icon) throws IllegalArgumentException { public Inventor(int Era,int icon) throws IllegalArgumentException {
super(Era, CharacterType.INVENTOR); super(Era, CharacterType.INVENTOR);
@@ -26,21 +28,48 @@ public class Inventor extends Character {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
this.icon = icon; this.icon = icon;
} }
/**
* Creates an Inventor character card with the specified era, icon value,
* and minimum number of players.
*
* @param Era the era of the Inventor card
* @param icon the icon value of the Inventor card
* @param nMin the minimum number of players required for the card
* @throws IllegalArgumentException if {@code icon < 0} or {@code icon > 9}
*/
public Inventor(int Era,int icon,int nMin) throws IllegalArgumentException { public Inventor(int Era,int icon,int nMin) throws IllegalArgumentException {
super(Era, CharacterType.INVENTOR,nMin); super(Era, CharacterType.INVENTOR,nMin);
if(icon<0 || icon>9) if(icon<0 || icon>9)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
this.icon = icon; this.icon = icon;
} }
/**
* Returns the string representation of this Inventor card.
*
* @return the string representation of this Inventor card
*/
@Override @Override
public String toString() { public String toString() {
return super.toString() + " Symbol:" + String.valueOf(icon); return super.toString() + " Symbol:" + String.valueOf(icon);
} }
/**
* Creates and returns a copy of this Inventor card.
*
* @return a clone of this Inventor card
*/
@Override @Override
public Character clone() { public Character clone() {
return new Inventor(getEra(),icon, getNMin()); return new Inventor(getEra(),icon, getNMin());
} }
/**
* Inserts this Inventor card into the specified player's Inventor collection.
*
* @param player the player who receives the card
*/
@Override @Override
public void insert(Player player) { public void insert(Player player) {
player.inventors.add(this); player.inventors.add(this);