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
FieldsModifier and TypeFieldDescription(package private) final Map<PlayerBoard,TeamID> private static final long(package private) final Map<TeamID,TowerStorage> -
Constructor Summary
Constructors -
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- aListofPlayerBoards 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
Listcontaining references to the team'sPlayerBoards
-
getMutableTowerStorage
Get a team's tower storage- Parameters:
pb- the player to find theTowerStorageof- Returns:
- a reference to
TowerStorage, or null if thePlayerBoardmatches 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 theTeamIDof- Returns:
- the
TeamIDof the player in input or null if thePlayerBoardmatches no team in the game
-