Package it.polimi.ingsw.eriantys.model
Class Bag
java.lang.Object
it.polimi.ingsw.eriantys.model.StudentContainer
it.polimi.ingsw.eriantys.model.Bag
This class models the actual bag in the board game, which initially contains all the students discs.
It exposes a method which returns a list of
Color
, used during the game setup.- See Also:
-
Constructor Summary
ConstructorDescriptionBag()
Constructs an emptyBag
, then fills it with 26 students for each color, 130 total. -
Method Summary
Modifier and TypeMethodDescriptionboolean
isEmpty()
A method which states if theBag
is empty.protected int
remainingCapacity
(Color color) Returns the remaining capacity of the container for the specifiedColor
, an integer between 0 andMAX_STUDENTS_PER_COLOR
, or-1
ifcolor
isnull
.Sets up the islands at the start of the game.Methods inherited from class it.polimi.ingsw.eriantys.model.StudentContainer
empty, fill, getQuantity, getRepresentation, moveAllTo, moveTo, moveTo, refillFrom, swap
-
Constructor Details
-
Bag
public Bag()Constructs an emptyBag
, then fills it with 26 students for each color, 130 total.- See Also:
-
-
Method Details
-
setupDraw
Sets up the islands at the start of the game.- Returns:
- a list containing two students of each
Color
in random order - See Also:
-
isEmpty
public boolean isEmpty()A method which states if theBag
is empty.- Returns:
true
if and only if the object is empty
-
remainingCapacity
Returns the remaining capacity of the container for the specifiedColor
, an integer between 0 andMAX_STUDENTS_PER_COLOR
, or-1
ifcolor
isnull
.- Overrides:
remainingCapacity
in classStudentContainer
- Parameters:
color
- the color whose remaining capacity is returned.- Returns:
- the remaining capacity of the container for the specified
Color
, an integer between 0 andMAX_STUDENTS_PER_COLOR
, or-1
ifcolor
isnull
. - See Also:
-
StudentContainer.remainingCapacity()
-