Package it.polimi.ingsw.Model
Class Island
java.lang.Object
it.polimi.ingsw.Model.Island
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
private static final long
private final ArrayList<PawnColour>
private Tower
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
a student can be added to the Island through this methodint
getId()
If a tower is present, return a non-emptyOptionalValue
void
aTower
may need to be swapped or added during the Island's lifespan, this method can be used for that
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
id
private final int id -
students
-
tower
-
-
Constructor Details
-
Island
public Island(int id) Construct an Island, assinging an ID to it.- Parameters:
id
- the id of the constructed Island.
-
-
Method Details
-
getId
public int getId()- Returns:
- the ID of the Island
-
getStudents
- Returns:
- the
PawnColour
s contained in the Island
-
getTowerColour
If a tower is present, return a non-emptyOptionalValue
- Returns:
- the colour of the contained tower wrapped in a
OptionalValue
-
addStudent
a student can be added to the Island through this method- Parameters:
p
- thePawnColour
to add to the island
-
swapTower
aTower
may need to be swapped or added during the Island's lifespan, this method can be used for that- Parameters:
t
- the newTower
to be put on the island. the old tower (if any was present) will be returned to its rightful storage automatically. The input can be null, this removes the tower from the island
-