Package model
Class Scoreboard
java.lang.Object
model.Scoreboard
Scoreboard class for the game
Contains list of Score-objects and methods for adding and retrieving scores
Also contains methods for retrieving scores from the database
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ILeaderboardDAODAO class for database connectionList of scores -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for ScoreboardScoreboard(ArrayList<Leaderboard> leaderboards) Constructor for Scoreboard -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a score to the scoreboardvoiddeleteScore(Long scoreid) Deletes a score from the scoreboardvoidfetchUserScores(Long userid, ModeType difficulty) Fetch personal scores of select difficulty, sorted by timevoidfetchWorldScores(ModeType difficulty) Fetch global scores of select difficulty, sorted by points (desc) and then time (asc)Returns the list of scorestoString()tostring method for Scoreboard
-
Field Details
-
leaderboarddao
DAO class for database connection -
scores
List of scores
-
-
Constructor Details
-
Scoreboard
public Scoreboard()Constructor for Scoreboard -
Scoreboard
Constructor for Scoreboard- Parameters:
leaderboards- list of Leaderboard-objects
-
-
Method Details
-
addScore
Adds a score to the scoreboard- Parameters:
time- time in secondspoints- pointsdifficulty- difficulty
-
getScores
Returns the list of scores- Returns:
- list of scores
-
deleteScore
Deletes a score from the scoreboard- Parameters:
scoreid- id of the score to be deleted
-
fetchWorldScores
Fetch global scores of select difficulty, sorted by points (desc) and then time (asc)- Parameters:
difficulty- difficulty of the scores
-
fetchUserScores
Fetch personal scores of select difficulty, sorted by time- Parameters:
userid- id of the userdifficulty- difficulty level of the scores
-
toString
tostring method for Scoreboard
-