Class Slot
java.lang.Object
it.polimi.ingsw.gc14.Model.Slot
- All Implemented Interfaces:
Serializable
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe amount of Food associated with this slot.private final intThe number of lower cards associated with this slot.private intThe minimum number of players required for this slot.private final intThe number of upper cards associated with this slot.private final charThe identifier of this slot. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks equality between thisSlotand another object.intgetFood()Returns the amount of Food associated with this slot.intReturns the number of lower cards associated with this slot.intReturns the minimum number of players required for this slot.intReturns the number of upper cards associated with this slot.charReturns the identifier of this slot.inthashCode()Returns the hash code for thisSlot, derived fromslotId.toString()Returns the string representation of this slot.Returns a compact string representation of thisSlotfor the TUI.
-
Field Details
-
slotId
private final char slotIdThe identifier of this slot. -
nUpper
private final int nUpperThe number of upper cards associated with this slot. -
nMinPlayer
private int nMinPlayerThe minimum number of players required for this slot. -
nLower
private final int nLowerThe number of lower cards associated with this slot. -
food
private final int foodThe amount of Food associated with this slot.
-
-
Constructor Details
-
Slot
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.- Parameters:
slotId- the identifier of the slot.- Throws:
IllegalArgumentException- if the specified slot identifier is not valid.
-
-
Method Details
-
getSlotId
public char getSlotId()Returns the identifier of this slot.- Returns:
- the identifier of this slot.
-
getNUpper
public int getNUpper()Returns the number of upper cards associated with this slot.- Returns:
- the number of upper cards associated with this slot.
-
getNMinPlayer
public int getNMinPlayer()Returns the minimum number of players required for this slot.- Returns:
- the minimum number of players required for this slot.
-
getNLower
public int getNLower()Returns the number of lower cards associated with this slot.- Returns:
- the number of lower cards associated with this slot.
-
getFood
public int getFood()Returns the amount of Food associated with this slot.- Returns:
- the amount of Food associated with this slot.
-
toString
-
toStringTUI
-
equals
Checks equality between thisSlotand another object. Two slots are equal if and only if they share the sameslotId. -
hashCode
-