Class TeamRegister
java.lang.Object
edu.ntnu.idatt1002.g106.handballapp.finalprod.backend.TeamRegister
- All Implemented Interfaces:
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
This method adds a team to the map, as long as it doesn't already existvoid
editNumPlayers
(String teamName, int newNumPlayers) This method changes the total number of players on a given team.void
editTotGoals
(String teamName, int newTotGoals) This method changes the total number of goals of a given team.void
editTotLosses
(String teamName, int newTotLosses) This method changes the number of total losses a given team has.void
editTotWins
(String teamName, int newTotWins) method that registers a teams new number of winsfindTeamBasedOnTeamName
(String teamName) This method finds a team based on the team's name from the register.method that gets a list of all teamsgetTeams()
This method retrieves the map of teams.boolean
removeTeam
(Team team) This method removes a team from the team register.toString()
toString method for returning all TeamRegister information
-
Field Details
-
teams
-
-
Constructor Details
-
TeamRegister
public TeamRegister()
-
-
Method Details
-
addTeam
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
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
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
method that registers a teams new number of wins- Parameters:
teamName
-newTotWins
- new number of wins
-
editTotLosses
This method changes the number of total losses a given team has.- Parameters:
teamName
- The team's name, represented as a StringnewTotLosses
- The new number of losses, represented as an int
-
editTotGoals
This method changes the total number of goals of a given team.- Parameters:
teamName
- The team's name, represented as a StringnewTotGoals
- The new number of goals, represented as an int
-
editNumPlayers
This method changes the total number of players on a given team.- Parameters:
teamName
- The team's name, represented as a StringnewNumPlayers
- The new number of players, represented as an int
-
getTeams
This method retrieves the map of teams.- Returns:
- Map of teams
-
getListTeams
method that gets a list of all teams- Returns:
- list with all teams
-
toString
toString method for returning all TeamRegister information
-