Class TeamMapper

java.lang.Object
it.polimi.ingsw.Model.TeamMapper
All Implemented Interfaces:
Serializable

public class TeamMapper extends Object implements Serializable
Maps the players in the model to their respective teams and TowerStorage
See Also:
  • Field Details

  • Constructor Details

    • TeamMapper

      public TeamMapper(List<PlayerBoard> players)
      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 - a List of PlayerBoards to put into teams.
  • Method Details

    • getMutablePlayers

      public List<PlayerBoard> getMutablePlayers(TeamID tID)
      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's PlayerBoards
    • getMutableTowerStorage

      public TowerStorage getMutableTowerStorage(PlayerBoard pb)
      Get a team's tower storage
      Parameters:
      pb - the player to find the TowerStorage of
      Returns:
      a reference to TowerStorage, or null if the PlayerBoard matches no team in the game
    • getMutableTowerStorage

      public TowerStorage getMutableTowerStorage(TeamID tID)
      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

      public TeamID getTeamID(PlayerBoard pb)
      Get the team of a player
      Parameters:
      pb - the player to find the TeamID of
      Returns:
      the TeamID of the player in input or null if the PlayerBoard matches no team in the game