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

public class Team extends Object implements 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

    Fields
    Modifier and Type
    Field
    Description
    private int
     
    private final String
     
    private String
     
    private String
     
    private int
     
    private int
     
    private int
     
    private int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Team(String teamName, String teamLeader, String region, int numPlayers, int telephoneNum)
    This is a constructor allows for a Team object to be initialized with the information intrinsic to a handball team.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTotGoals(int goalsToAdd)
    This method adds the given number of goals to the total goals scored
    void
    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 another
    int
    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
    hashMethod that hashes all teams
    void
    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 method for returning all team information

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • teamName

      private String teamName
    • teamLeader

      private String teamLeader
    • region

      private final String region
    • numPlayers

      private int numPlayers
    • telephoneNum

      private int telephoneNum
    • totGoals

      private int totGoals
    • totWins

      private int totWins
    • totLosses

      private int totLosses
  • Constructor Details

    • Team

      public Team(String teamName, String teamLeader, String region, int numPlayers, int telephoneNum)
      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 String
      teamLeader - Name of the team leader, represented as a String
      region - The region where the team is from, represented as a String
      numPlayers - Number of players, represented as an int
      telephoneNum - Phone number attached to the team, represented as an int
  • Method Details

    • getTeamName

      public String getTeamName()
      This method retrieves the team name.
      Returns:
      Team name, represented as a String
    • setTeamName

      public void setTeamName(String teamName)
      This method changes the teamName of the object to the input String.
      Parameters:
      teamName - The new team name, represented as a String
    • getTeamLeader

      public String getTeamLeader()
      This method retrieves the team leader's name.
      Returns:
      Team leader's name, represented as a String.
    • setTeamLeader

      public void setTeamLeader(String teamLeader)
      This method changes the team leader's name to the input.
      Parameters:
      teamLeader - New name of the team leader, represented as a String
    • getRegion

      public 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

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

      public boolean equals(Object o)
      method for checking if a team object equals another
      Overrides:
      equals in class Object
      Parameters:
      o - the checking object
      Returns:
      true or false based on the result
    • hashCode

      public int hashCode()
      hashMethod that hashes all teams
      Overrides:
      hashCode in class Object
      Returns:
      hashcode for team