Package it.polimi.ingsw.Model
Class Island
java.lang.Object
it.polimi.ingsw.Model.Island
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate static final longprivate final ArrayList<PawnColour>private Tower -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoida student can be added to the Island through this methodintgetId()If a tower is present, return a non-emptyOptionalValuevoidaTowermay 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
PawnColours 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- thePawnColourto add to the island
-
swapTower
aTowermay need to be swapped or added during the Island's lifespan, this method can be used for that- Parameters:
t- the newTowerto 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
-