java.lang.Object
edu.ntnu.idatt1002.k1g4.dao.MatchDAO
The Database Access Object for the class Match.
- Version:
- 0.1
- Author:
- Callum Gran
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Method to add a match to the database.void
deleteMatch
(int matchId) Method to delete a match from the database.getMatchById
(int matchId) Gets match by id.getMatchesByCup
(int cupId) Gets matches in a cup.getMatchesByDivision
(int divisionId) Gets matches in a division.void
updateMatch
(Match match) Method to update match data.void
updateMatchScore
(int score, int teamNr, int matchId) Method update match score.
-
Constructor Details
-
MatchDAO
public MatchDAO()
-
-
Method Details
-
getMatchesByDivision
Gets matches in a division.- Parameters:
divisionId
- int: the id of the division to get matches from- Returns:
- matches ArrayList: The matches in a division with all data.
-
getMatchesByCup
Gets matches in a cup.- Parameters:
cupId
- int: the id of the cup to get matches from- Returns:
- matches ArrayList: The matches in a cup with all data.
-
getMatchById
Gets match by id.- Parameters:
matchId
- int: the id of the match- Returns:
- match Match: the match with a given id
-
updateMatchScore
public void updateMatchScore(int score, int teamNr, int matchId) Method update match score.- Parameters:
score
- the scoreteamNr
- the team nrmatchId
- the match id
-
updateMatch
Method to update match data.- Parameters:
match
- Match: the new match data to overwrite the previous data.
-
addMatch
Method to add a match to the database.- Parameters:
match
- Match: the match to add to the database.
-
deleteMatch
public void deleteMatch(int matchId) Method to delete a match from the database.- Parameters:
matchId
- int: the id of the match to delete.
-