Record Class LeaderboardService.LeaderboardEntry
java.lang.Object
java.lang.Record
it.unisa.diem.wordageddon_g16.services.LeaderboardService.LeaderboardEntry
- Enclosing class:
LeaderboardService
public static record LeaderboardService.LeaderboardEntry(String username, Difficulty favouriteDifficulty, int averageScore, int totalScore, int gamesPlayed)
extends Record
Record interno che rappresenta una voce nella classifica.
Contiene il nome utente, la difficoltà preferita (se nota), il punteggio medio, il punteggio totale accumulato e il numero di partite giocate.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intThe field for theaverageScorerecord component.private final DifficultyThe field for thefavouriteDifficultyrecord component.private final intThe field for thegamesPlayedrecord component.private final intThe field for thetotalScorerecord component.private final StringThe field for theusernamerecord component. -
Constructor Summary
ConstructorsConstructorDescriptionLeaderboardEntry(String username, Difficulty favouriteDifficulty, int averageScore, int totalScore, int gamesPlayed) Creates an instance of aLeaderboardEntryrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theaverageScorerecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefavouriteDifficultyrecord component.intReturns the value of thegamesPlayedrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalScorerecord component.username()Returns the value of theusernamerecord component.
-
Field Details
-
username
The field for theusernamerecord component. -
favouriteDifficulty
The field for thefavouriteDifficultyrecord component. -
averageScore
private final int averageScoreThe field for theaverageScorerecord component. -
totalScore
private final int totalScoreThe field for thetotalScorerecord component. -
gamesPlayed
private final int gamesPlayedThe field for thegamesPlayedrecord component.
-
-
Constructor Details
-
LeaderboardEntry
public LeaderboardEntry(String username, Difficulty favouriteDifficulty, int averageScore, int totalScore, int gamesPlayed) Creates an instance of aLeaderboardEntryrecord class.- Parameters:
username- the value for theusernamerecord componentfavouriteDifficulty- the value for thefavouriteDifficultyrecord componentaverageScore- the value for theaverageScorerecord componenttotalScore- the value for thetotalScorerecord componentgamesPlayed- the value for thegamesPlayedrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
username
Returns the value of theusernamerecord component.- Returns:
- the value of the
usernamerecord component
-
favouriteDifficulty
Returns the value of thefavouriteDifficultyrecord component.- Returns:
- the value of the
favouriteDifficultyrecord component
-
averageScore
public int averageScore()Returns the value of theaverageScorerecord component.- Returns:
- the value of the
averageScorerecord component
-
totalScore
public int totalScore()Returns the value of thetotalScorerecord component.- Returns:
- the value of the
totalScorerecord component
-
gamesPlayed
public int gamesPlayed()Returns the value of thegamesPlayedrecord component.- Returns:
- the value of the
gamesPlayedrecord component
-