Package it.polimi.ingsw.Model
Class TeamMapper
java.lang.Object
it.polimi.ingsw.Model.TeamMapper
- All Implemented Interfaces:
Serializable
Maps the players in the model to their respective teams and
TowerStorage
- See Also:
-
Field Summary
Modifier and TypeFieldDescription(package private) final Map<PlayerBoard,
TeamID> private static final long
(package private) final Map<TeamID,
TowerStorage> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetMutablePlayers
(TeamID tID) Get a team's playersGet a team's tower storageGet a team's tower storagegetTeamID
(PlayerBoard pb) Get the team of a player
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
playerTeamMap
-
towerStorageMap
-
-
Constructor Details
-
TeamMapper
Creates a new mapper. If the players are not 4, every player gets put into its own special team. If 4 players are inputted, the first pair of players will be put in the first team, and the second pair into the second team.- Parameters:
players
- aList
ofPlayerBoard
s to put into teams.
-
-
Method Details
-
getMutablePlayers
Get a team's players- Parameters:
tID
- the ID of the Team to search players of- Returns:
- an Unmutable
List
containing references to the team'sPlayerBoard
s
-
getMutableTowerStorage
Get a team's tower storage- Parameters:
pb
- the player to find theTowerStorage
of- Returns:
- a reference to
TowerStorage
, or null if thePlayerBoard
matches no team in the game
-
getMutableTowerStorage
Get a team's tower storage- Parameters:
tID
- the ID of the Team to search the tower storage of- Returns:
- a reference to
TowerStorage
, or null if the TeamID is invalid
-
getTeamID
Get the team of a player- Parameters:
pb
- the player to find theTeamID
of- Returns:
- the
TeamID
of the player in input or null if thePlayerBoard
matches no team in the game
-