Class Team
java.lang.Object
edu.ntnu.idatt1002.g106.handballapp.finalprod.backend.Team
- All Implemented Interfaces:
Serializable
This class creates a general structure for a handball team. It, therefore, contains essential attributes and methods
for altering and retrieving the statistics.
- Author:
- Gruppe 6
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addTotGoals
(int goalsToAdd) This method adds the given number of goals to the total goals scoredvoid
addTotLosses
(int lossesToAdd) This method adds the given number of losses to the total losses.void
addTotWins
(int winsToAdd) This method adds the given number of wins to the total wins.boolean
method for checking if a team object equals anotherint
This method retrieves the number of players on the team.This method retrieves the region the team is from.This method retrieves the team leader's name.This method retrieves the team name.int
This method retrieves the telephone number connected to the team.int
This method retrieves the total amount of goals scored by a team.int
This method retrieves the total amount of losses a team has faced.int
This method retrieves the team's total amount of victories.int
hashCode()
hashMethod that hashes all teamsvoid
setNumPlayers
(int numPlayers) This method changes the number of players on a team to the given input.void
setTeamLeader
(String teamLeader) This method changes the team leader's name to the input.void
setTeamName
(String teamName) This method changes the teamName of the object to the input String.void
setTelephoneNum
(int telephoneNum) This method changes the team's telephone number to the given input.void
setTotGoals
(int totGoals) This method changes the total number of goals scored by a team to the given input.void
setTotLosses
(int totLosses) This method changes the total amount of losses of a team to the given input.void
setTotWins
(int totWins) This method changes the total amount of wins a team has to the given input.toString()
toString method for returning all team information
-
Field Details
-
teamName
-
teamLeader
-
region
-
numPlayers
private int numPlayers -
telephoneNum
private int telephoneNum -
totGoals
private int totGoals -
totWins
private int totWins -
totLosses
private int totLosses
-
-
Constructor Details
-
Team
This is a constructor allows for a Team object to be initialized with the information intrinsic to a handball team.- Parameters:
teamName
- Name of the team, represented as a StringteamLeader
- Name of the team leader, represented as a Stringregion
- The region where the team is from, represented as a StringnumPlayers
- Number of players, represented as an inttelephoneNum
- Phone number attached to the team, represented as an int
-
-
Method Details
-
getTeamName
This method retrieves the team name.- Returns:
- Team name, represented as a String
-
setTeamName
This method changes the teamName of the object to the input String.- Parameters:
teamName
- The new team name, represented as a String
-
getTeamLeader
This method retrieves the team leader's name.- Returns:
- Team leader's name, represented as a String.
-
setTeamLeader
This method changes the team leader's name to the input.- Parameters:
teamLeader
- New name of the team leader, represented as a String
-
getRegion
This method retrieves the region the team is from.- Returns:
- The region the team is from, represented as a String.
-
getNumPlayers
public int getNumPlayers()This method retrieves the number of players on the team.- Returns:
- Number of players on the team, represented as an int
-
setNumPlayers
public void setNumPlayers(int numPlayers) This method changes the number of players on a team to the given input.- Parameters:
numPlayers
- New number of players, represented as an int
-
getTelephoneNum
public int getTelephoneNum()This method retrieves the telephone number connected to the team.- Returns:
- Telephone number of the given team, represented as an int.
-
setTelephoneNum
public void setTelephoneNum(int telephoneNum) This method changes the team's telephone number to the given input.- Parameters:
telephoneNum
- New telephone number, represented as an int
-
getTotGoals
public int getTotGoals()This method retrieves the total amount of goals scored by a team.- Returns:
- Total number of goals scored, represented as an int
-
setTotGoals
public void setTotGoals(int totGoals) This method changes the total number of goals scored by a team to the given input.- Parameters:
totGoals
- New total amount of goals, given as an int
-
addTotGoals
public void addTotGoals(int goalsToAdd) This method adds the given number of goals to the total goals scored- Parameters:
goalsToAdd
- Goals to add, represented as an int
-
getTotWins
public int getTotWins()This method retrieves the team's total amount of victories.- Returns:
- Total number of wins, represented as an int
-
setTotWins
public void setTotWins(int totWins) This method changes the total amount of wins a team has to the given input.- Parameters:
totWins
- New total amount of wins, represented as an int
-
addTotWins
public void addTotWins(int winsToAdd) This method adds the given number of wins to the total wins.- Parameters:
winsToAdd
- Wins to add, given as an int
-
getTotLosses
public int getTotLosses()This method retrieves the total amount of losses a team has faced.- Returns:
- Total amount of losses, represented as an int
-
setTotLosses
public void setTotLosses(int totLosses) This method changes the total amount of losses of a team to the given input.- Parameters:
totLosses
- New total amount of losses, represented as an int
-
addTotLosses
public void addTotLosses(int lossesToAdd) This method adds the given number of losses to the total losses.- Parameters:
lossesToAdd
- Losses to add, given as an int
-
toString
toString method for returning all team information -
equals
method for checking if a team object equals another -
hashCode
public int hashCode()hashMethod that hashes all teams
-