Package it.polimi.ingsw.Model
Class Island
java.lang.Object
it.polimi.ingsw.Model.Island
- All Implemented Interfaces:
- Serializable
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final intprivate static final longprivate final ArrayList<PawnColour>private Tower
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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- 
serialVersionUIDprivate static final long serialVersionUID- See Also:
 
- 
idprivate final int id
- 
students
- 
tower
 
- 
- 
Constructor Details- 
Islandpublic Island(int id) Construct an Island, assinging an ID to it.- Parameters:
- id- the id of the constructed Island.
 
 
- 
- 
Method Details- 
getIdpublic int getId()- Returns:
- the ID of the Island
 
- 
getStudents- Returns:
- the PawnColours contained in the Island
 
- 
getTowerColourIf a tower is present, return a non-emptyOptionalValue- Returns:
- the colour of the contained tower wrapped in a OptionalValue
 
- 
addStudenta student can be added to the Island through this method- Parameters:
- p- the- PawnColourto add to the island
 
- 
swapToweraTowermay need to be swapped or added during the Island's lifespan, this method can be used for that- Parameters:
- t- the new- Towerto 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
 
 
-