Class Team

java.lang.Object
edu.ntnu.idatt1002.k1g4.Team

public class Team extends Object
The team represents a group of competitors playing against another team represented by the class Match
Version:
0.5
Author:
Callum Gran, Runar Indahl, Nicolai H. Brand, Brage H. Kvamme
  • Constructor Summary

    Constructors
    Constructor
    Description
    Instantiates a new Team.
    Team(Team team)
    Instantiates a new Team.
    Team(String name)
    Instantiates a new Team.
    Team(String name, boolean isCompeting)
    First constructor for the team.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Overrides the equals method from Object Teams are the same if the names are the same.
    Gets the team name.
    int
    Gets team id.
    boolean
    Gets the is competing attribute
    void
    setCompeting(boolean competing)
    Sets new status if the team is or is not competing.
    void
    Sets name of the team.
    void
    setTeamId(int teamId)
    Sets team id.
    overrides the toString method in Object Represents a team on a one liner

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Team

      public Team(String name, boolean isCompeting) throws IllegalArgumentException
      First constructor for the team.
      Parameters:
      name - String: name of the team
      isCompeting - boolean: true if the team is still eligible for matchmaking
      Throws:
      IllegalArgumentException - thrown if team name is empty.
    • Team

      public Team(String name) throws IllegalArgumentException
      Instantiates a new Team. This team has the isCompeting status set to true by default.
      Parameters:
      name - String: The name of the team
      Throws:
      IllegalArgumentException - the illegal argument exception is thrown when the name is blank.
    • Team

      public Team(Team team)
      Instantiates a new Team. Copy constructor for Team.
      Parameters:
      team - Team: the team to copy
    • Team

      public Team()
      Instantiates a new Team. This constructor is for data from the database.
  • Method Details

    • getName

      public String getName()
      Gets the team name.
      Returns:
      name String: the name of the team
    • isCompeting

      public boolean isCompeting()
      Gets the is competing attribute
      Returns:
      isCompeting boolean: if the team is competing or not
    • setCompeting

      public void setCompeting(boolean competing)
      Sets new status if the team is or is not competing.
      Parameters:
      competing - boolean: if the team is competing or not
    • getTeamId

      public int getTeamId()
      Gets team id.
      Returns:
      teamId int: the team id
    • setTeamId

      public void setTeamId(int teamId)
      Sets team id.
      Parameters:
      teamId - int: the team id
    • setName

      public void setName(String name)
      Sets name of the team.
      Parameters:
      name - String: the name to be set.
    • toString

      public String toString()
      overrides the toString method in Object Represents a team on a one liner
      Overrides:
      toString in class Object
      Returns:
      out String: String representation of a team
    • equals

      public boolean equals(Object o)
      Overrides the equals method from Object Teams are the same if the names are the same.
      Overrides:
      equals in class Object
      Parameters:
      o - Object: object to be compared
      Returns:
      boolean: true if the objects are the same, false if not