Package database.dao
Class LeaderboardDAO
java.lang.Object
database.dao.LeaderboardDAO
- All Implemented Interfaces:
ILeaderboardDAO
LeaderboardDAO class for the game
Contains methods for saving and retrieving scores from the database
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAllScores(Long accountid) deletes all scores of select accountbooleandeleteScore(Long scoreid) deletes a score by idgetAccountScores(Long accountid) selects top 100 scores sorted by points, then timegetAccountScoresByDifficulty(Long accountid, ModeType difficulty) selects top 100 scores of select account and difficultyreadWorldScores(ModeType difficulty) selects top 100 scores of select difficultybooleansaveScore(Leaderboard lb) Saves a score to the database
-
Constructor Details
-
LeaderboardDAO
public LeaderboardDAO()
-
-
Method Details
-
saveScore
Saves a score to the database- Specified by:
saveScorein interfaceILeaderboardDAO- Parameters:
lb- Leaderboard-object to be saved- Returns:
- true if successful, false if not
-
getAccountScores
selects top 100 scores sorted by points, then time- Specified by:
getAccountScoresin interfaceILeaderboardDAO- Parameters:
accountid- account id- Returns:
- ArrayList of Leaderboard-objects
-
getAccountScoresByDifficulty
selects top 100 scores of select account and difficulty- Specified by:
getAccountScoresByDifficultyin interfaceILeaderboardDAO- Parameters:
accountid- account iddifficulty- difficulty- Returns:
- ArrayList of Leaderboard-objects
-
readWorldScores
selects top 100 scores of select difficulty- Specified by:
readWorldScoresin interfaceILeaderboardDAO- Returns:
- ArrayList of Leaderboard-objects
-
deleteScore
deletes a score by id- Specified by:
deleteScorein interfaceILeaderboardDAO- Parameters:
scoreid- score id- Returns:
- true if successful
-
deleteAllScores
deletes all scores of select account- Specified by:
deleteAllScoresin interfaceILeaderboardDAO- Parameters:
accountid- account id
-