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

public class Match extends Object implements Serializable
Represents a match in a tournament.
Author:
Gruppe 6
See Also:
  • Field Details

    • teamScore

      private Map<String,Integer> teamScore
    • startTime

      private LocalDateTime startTime
    • numField

      private int numField
    • matchID

      private int matchID
    • roundNum

      private int roundNum
    • team1

      private Team team1
    • team2

      private Team team2
    • referee1

      private String referee1
    • referee2

      private String referee2
  • Constructor Details

    • Match

      public Match(LocalDateTime startTime, int roundNum, Team team1, Team team2, int matchID, int numField) throws IllegalArgumentException, NullPointerException
      Initializes a new Match object with necessary variables.
      Parameters:
      startTime - Start time of the match as LocalTime
      roundNum - Round the match is in as int
      team1 - First Team
      team2 - Second Team
      matchID - Identifier of the match
      numField - Number of the field to be played on
      Throws:
      IllegalArgumentException
      NullPointerException
    • Match

      public Match(LocalDateTime startTime, int numField, int matchID, int roundNum)
      the class constructor with all variables needed
      Parameters:
      startTime - starting time
      numField - the fields number
      matchID - id of the match
      roundNum - round number for the match
  • Method Details

    • addTeam

      public void addTeam(Team team1, Team team2)
      This method adds two teams to the match
      Parameters:
      team1 -
      team2 -
    • hasTeam

      public boolean hasTeam(String teamName)
      This method checks if the team is in the match based on the team name
      Parameters:
      teamName - Name of a team, represented as a String
      Returns:
      Status of whether match contains team
    • getTeam1

      public Team getTeam1()
      a getMethod for getting the first team registered
      Returns:
      team1 as a team object
    • getTeam2

      public Team getTeam2()
      a getMethod for getting the second team registered
      Returns:
      team2 as a team object
    • setScore

      public void setScore(String teamName, int score)
      Sets the score of a team during a match
      Parameters:
      teamName - Team to change score
      score - New score
    • getScoreByTeamName

      public int getScoreByTeamName(String teamName)
      This method gets the score by looking at the team
      Parameters:
      teamName - Name of the team, represented as a String
      Returns:
      Score of the given team, represented as an int
    • getStartTime

      public LocalDateTime getStartTime()
      Gets start time of match
      Returns:
      match start time
    • getNumField

      public int getNumField()
      Gets field number
      Returns:
      field number
    • getMatchID

      public int getMatchID()
      Gets match ID
      Returns:
      match ID
    • getRoundNum

      public int getRoundNum()
      Gets round number
      Returns:
      round number
    • getFinalResult

      public String getFinalResult()
      Gets final result of match
      Returns:
      final results as String
    • getWinner

      public Team getWinner()
      Gets winning team
      Returns:
      winning team as Team object
    • getLoser

      public Team getLoser()
      This method returns the losing team of the given match
      Returns:
      Team that lost
    • getPlayers

      public String getPlayers()
      a getMethod for getting teams names
      Returns:
      teams names as a vs String format
    • getTime

      public LocalTime getTime()
      method for getting start time
      Returns:
      getting start time
    • getReferee1

      public String getReferee1()
      Gets referee 1 name.
      Returns:
      referee 1 as String
    • getReferee2

      public String getReferee2()
      Gets referee 2 name.
      Returns:
      referee 2 as String
    • setReferee1

      public void setReferee1(String referee1)
      Sets referee 1 name.
      Parameters:
      referee1 - Referee 1 name
    • setReferee2

      public void setReferee2(String referee2)
      Sets referee2 name.
      Parameters:
      referee2 - Referee 2 name
    • toString

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