Package it.polimi.ingsw.Model
Class TowerStorage
java.lang.Object
it.polimi.ingsw.Model.TowerStorage
- All Implemented Interfaces:
Serializable
A container for a set of
Towers of the same TowerColour- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTowerStorage(TowerColour colour, int amount) Creates the storage and fills it up with towers -
Method Summary
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
colour
-
storage
-
-
Constructor Details
-
TowerStorage
Creates the storage and fills it up with towers- Parameters:
colour- the colour of the towers in storageamount- how many towers will be added to the storage
-
-
Method Details
-
getColour
Get the colour of the storedTowers- Returns:
- the
TowerColourthis storage handles
-
extractTower
Extract a tower from storage.- Returns:
- the extracted
Toweror null if the storage is empty
-
getTowerCount
public int getTowerCount()Get the amount of towers left in storage- Returns:
- the amount of
Towers left in storage
-
pushTower
Put aTowerinto storage- Parameters:
t- the Tower to add into storage- Throws:
DuplicateElementException- if the sameTowerwas found already present in storageInvalidElementException-Towerif theTowerColourof the Tower is not the same as theTowerColourof the storage
-