Class Match
java.lang.Object
edu.ntnu.idatt1002.g106.handballapp.finalprod.backend.Match
- All Implemented Interfaces:
Serializable
Represents a match in a tournament.
- Author:
- Gruppe 6
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionMatch
(LocalDateTime startTime, int numField, int matchID, int roundNum) the class constructor with all variables neededMatch
(LocalDateTime startTime, int roundNum, Team team1, Team team2, int matchID, int numField) Initializes a new Match object with necessary variables. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method adds two teams to the matchGets final result of matchgetLoser()
This method returns the losing team of the given matchint
Gets match IDint
Gets field numbera getMethod for getting teams namesGets referee 1 name.Gets referee 2 name.int
Gets round numberint
getScoreByTeamName
(String teamName) This method gets the score by looking at the teamGets start time of matchgetTeam1()
a getMethod for getting the first team registeredgetTeam2()
a getMethod for getting the second team registeredgetTime()
method for getting start timeGets winning teamboolean
This method checks if the team is in the match based on the team namevoid
setReferee1
(String referee1) Sets referee 1 name.void
setReferee2
(String referee2) Sets referee2 name.void
Sets the score of a team during a matchtoString()
toString method for returning all match information
-
Field Details
-
teamScore
-
startTime
-
numField
private int numField -
matchID
private int matchID -
roundNum
private int roundNum -
team1
-
team2
-
referee1
-
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 LocalTimeroundNum
- Round the match is in as intteam1
- First Teamteam2
- Second TeammatchID
- Identifier of the matchnumField
- Number of the field to be played on- Throws:
IllegalArgumentException
NullPointerException
-
Match
the class constructor with all variables needed- Parameters:
startTime
- starting timenumField
- the fields numbermatchID
- id of the matchroundNum
- round number for the match
-
-
Method Details
-
addTeam
This method adds two teams to the match- Parameters:
team1
-team2
-
-
hasTeam
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
a getMethod for getting the first team registered- Returns:
- team1 as a team object
-
getTeam2
a getMethod for getting the second team registered- Returns:
- team2 as a team object
-
setScore
Sets the score of a team during a match- Parameters:
teamName
- Team to change scorescore
- New score
-
getScoreByTeamName
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
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
Gets final result of match- Returns:
- final results as String
-
getWinner
Gets winning team- Returns:
- winning team as Team object
-
getLoser
This method returns the losing team of the given match- Returns:
- Team that lost
-
getPlayers
a getMethod for getting teams names- Returns:
- teams names as a vs String format
-
getTime
method for getting start time- Returns:
- getting start time
-
getReferee1
Gets referee 1 name.- Returns:
- referee 1 as String
-
getReferee2
Gets referee 2 name.- Returns:
- referee 2 as String
-
setReferee1
Sets referee 1 name.- Parameters:
referee1
- Referee 1 name
-
setReferee2
Sets referee2 name.- Parameters:
referee2
- Referee 2 name
-
toString
toString method for returning all match information
-