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
Tower
s of the same TowerColour
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTowerStorage
(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 storedTower
s- Returns:
- the
TowerColour
this storage handles
-
extractTower
Extract a tower from storage.- Returns:
- the extracted
Tower
or null if the storage is empty
-
getTowerCount
public int getTowerCount()Get the amount of towers left in storage- Returns:
- the amount of
Tower
s left in storage
-
pushTower
Put aTower
into storage- Parameters:
t
- the Tower to add into storage- Throws:
DuplicateElementException
- if the sameTower
was found already present in storageInvalidElementException
-Tower
if theTowerColour
of the Tower is not the same as theTowerColour
of the storage
-