Add: Javadoc for Slot class
This commit is contained in:
@@ -1,26 +1,79 @@
|
||||
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 {
|
||||
// Getters
|
||||
|
||||
/**
|
||||
* The identifier of this slot.
|
||||
*/
|
||||
private char slotId;
|
||||
|
||||
/**
|
||||
* Returns the identifier of this slot.
|
||||
*
|
||||
* @return the identifier of this slot.
|
||||
*/
|
||||
public char getSlotId() {
|
||||
return slotId;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of upper cards associated with this slot.
|
||||
*/
|
||||
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(){
|
||||
return NUpper;
|
||||
}
|
||||
|
||||
/**
|
||||
* The minimum number of players required for this slot.
|
||||
*/
|
||||
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()
|
||||
{
|
||||
return nMinPlayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of lower cards associated with this slot.
|
||||
*/
|
||||
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(){
|
||||
return NLower;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount of Food associated with this slot.
|
||||
*/
|
||||
private int Food;
|
||||
|
||||
/**
|
||||
* Returns the amount of Food associated with this slot.
|
||||
*
|
||||
* @return the amount of Food associated with this slot.
|
||||
*/
|
||||
public int getFood(){
|
||||
return Food;
|
||||
}
|
||||
@@ -28,7 +81,17 @@ public class Slot {
|
||||
|
||||
// Setters
|
||||
// End setters
|
||||
|
||||
// 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
|
||||
{
|
||||
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
|
||||
public String toString() {
|
||||
return ("SlotID: "+this.getSlotId()+"\nNUpper: "+this.getNUpper()+"\nNLower: "+this.getNLower()+"\nFood: "+this.getFood()+"\nNMinPlayer: "+this.getNMinPlayer()+"\n");
|
||||
|
||||
Reference in New Issue
Block a user