java.lang.Object
edu.ntnu.idatt1002.g106.handballapp.finalprod.backend.TeamRegister
All Implemented Interfaces:
Serializable

public class TeamRegister extends Object implements Serializable
This is a class forming the structure of a team register. It, therefore, has a map which allows teams to be navigated easily. Additionally, it contains methods that allow for the manipulation of the teams and the list.
Author:
Gruppe 6
See Also:
  • Field Details

  • Constructor Details

    • TeamRegister

      public TeamRegister()
  • Method Details

    • addTeam

      public boolean addTeam(Team team)
      This method adds a team to the map, as long as it doesn't already exist
      Parameters:
      team - Team to be added to the list
      Returns:
      Status of the action, true if it successfully added the team, otherwise false
    • removeTeam

      public boolean removeTeam(Team team)
      This method removes a team from the team register.
      Parameters:
      team - The team object to be removed
      Returns:
      Status on whether it was successfully removed, true if it was, if not then false
    • findTeamBasedOnTeamName

      public Team findTeamBasedOnTeamName(String teamName)
      This method finds a team based on the team's name from the register.
      Parameters:
      teamName - Team's name, represented as a String
      Returns:
      The team that has the given team name, null if non exist
    • editTotWins

      public void editTotWins(String teamName, int newTotWins)
      method that registers a teams new number of wins
      Parameters:
      teamName -
      newTotWins - new number of wins
    • editTotLosses

      public void editTotLosses(String teamName, int newTotLosses)
      This method changes the number of total losses a given team has.
      Parameters:
      teamName - The team's name, represented as a String
      newTotLosses - The new number of losses, represented as an int
    • editTotGoals

      public void editTotGoals(String teamName, int newTotGoals)
      This method changes the total number of goals of a given team.
      Parameters:
      teamName - The team's name, represented as a String
      newTotGoals - The new number of goals, represented as an int
    • editNumPlayers

      public void editNumPlayers(String teamName, int newNumPlayers)
      This method changes the total number of players on a given team.
      Parameters:
      teamName - The team's name, represented as a String
      newNumPlayers - The new number of players, represented as an int
    • getTeams

      public Map<String,Team> getTeams()
      This method retrieves the map of teams.
      Returns:
      Map of teams
    • getListTeams

      public List<Team> getListTeams()
      method that gets a list of all teams
      Returns:
      list with all teams
    • toString

      public String toString()
      toString method for returning all TeamRegister information
      Overrides:
      toString in class Object
      Returns:
      all TeamRegister information as a String