Add: Javadoc for Slot class

This commit is contained in:
MatteoPellegrino05
2026-04-19 15:29:28 +02:00
parent 031ad2256a
commit c2500292f0
@@ -1,26 +1,79 @@
package it.polimi.ingsw.gc14.Model; package it.polimi.ingsw.gc14.Model;
/**
* Represents a slot with a specific identifier and associated values
* for upper cards, lower cards, food, and minimum number of players.
* The slot configuration depends on the specified slot identifier.
*/
public class Slot { public class Slot {
// Getters // Getters
/**
* The identifier of this slot.
*/
private char slotId; private char slotId;
/**
* Returns the identifier of this slot.
*
* @return the identifier of this slot.
*/
public char getSlotId() { public char getSlotId() {
return slotId; return slotId;
} }
/**
* The number of upper cards associated with this slot.
*/
private int NUpper; private int NUpper;
/**
* Returns the number of upper cards associated with this slot.
*
* @return the number of upper cards associated with this slot.
*/
public int getNUpper(){ public int getNUpper(){
return NUpper; return NUpper;
} }
/**
* The minimum number of players required for this slot.
*/
private int nMinPlayer; private int nMinPlayer;
/**
* Returns the minimum number of players required for this slot.
*
* @return the minimum number of players required for this slot.
*/
public int getNMinPlayer() public int getNMinPlayer()
{ {
return nMinPlayer; return nMinPlayer;
} }
/**
* The number of lower cards associated with this slot.
*/
private int NLower; private int NLower;
/**
* Returns the number of lower cards associated with this slot.
*
* @return the number of lower cards associated with this slot.
*/
public int getNLower(){ public int getNLower(){
return NLower; return NLower;
} }
/**
* The amount of Food associated with this slot.
*/
private int Food; private int Food;
/**
* Returns the amount of Food associated with this slot.
*
* @return the amount of Food associated with this slot.
*/
public int getFood(){ public int getFood(){
return Food; return Food;
} }
@@ -28,7 +81,17 @@ public class Slot {
// Setters // Setters
// End setters // End setters
// Constructors // Constructors
/**
* Creates a slot with the specified identifier.
* The slot values for Food, NLower, NUpper, and minimum number of players
* are determined by the given slot identifier.
*
* @param slotId the identifier of the slot.
* @throws IllegalArgumentException if the specified slot identifier is not valid.
*/
public Slot(char slotId) throws IllegalArgumentException public Slot(char slotId) throws IllegalArgumentException
{ {
this.slotId = slotId; this.slotId = slotId;
@@ -78,6 +141,14 @@ public class Slot {
} }
} }
/**
* Returns the string representation of this slot.
* The returned string includes the slot identifier, number of upper cards,
* number of lower cards, food value, and minimum number of players.
*
* @return the string representation of this slot.
*/
@Override @Override
public String toString() { public String toString() {
return ("SlotID: "+this.getSlotId()+"\nNUpper: "+this.getNUpper()+"\nNLower: "+this.getNLower()+"\nFood: "+this.getFood()+"\nNMinPlayer: "+this.getNMinPlayer()+"\n"); return ("SlotID: "+this.getSlotId()+"\nNUpper: "+this.getNUpper()+"\nNLower: "+this.getNLower()+"\nFood: "+this.getFood()+"\nNMinPlayer: "+this.getNMinPlayer()+"\n");