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 int
The field for theaverageScore
record component.private final Difficulty
The field for thefavouriteDifficulty
record component.private final int
The field for thegamesPlayed
record component.private final int
The field for thetotalScore
record component.private final String
The field for theusername
record component. -
Constructor Summary
ConstructorsConstructorDescriptionLeaderboardEntry
(String username, Difficulty favouriteDifficulty, int averageScore, int totalScore, int gamesPlayed) Creates an instance of aLeaderboardEntry
record class. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the value of theaverageScore
record component.final boolean
Indicates whether some other object is "equal to" this one.Returns the value of thefavouriteDifficulty
record component.int
Returns the value of thegamesPlayed
record component.final int
hashCode()
Returns a hash code value for this object.final String
toString()
Returns a string representation of this record class.int
Returns the value of thetotalScore
record component.username()
Returns the value of theusername
record component.
-
Field Details
-
username
The field for theusername
record component. -
favouriteDifficulty
The field for thefavouriteDifficulty
record component. -
averageScore
private final int averageScoreThe field for theaverageScore
record component. -
totalScore
private final int totalScoreThe field for thetotalScore
record component. -
gamesPlayed
private final int gamesPlayedThe field for thegamesPlayed
record component.
-
-
Constructor Details
-
LeaderboardEntry
public LeaderboardEntry(String username, Difficulty favouriteDifficulty, int averageScore, int totalScore, int gamesPlayed) Creates an instance of aLeaderboardEntry
record class.- Parameters:
username
- the value for theusername
record componentfavouriteDifficulty
- the value for thefavouriteDifficulty
record componentaverageScore
- the value for theaverageScore
record componenttotalScore
- the value for thetotalScore
record componentgamesPlayed
- the value for thegamesPlayed
record 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 thecompare
method from their corresponding wrapper classes. -
username
Returns the value of theusername
record component.- Returns:
- the value of the
username
record component
-
favouriteDifficulty
Returns the value of thefavouriteDifficulty
record component.- Returns:
- the value of the
favouriteDifficulty
record component
-
averageScore
public int averageScore()Returns the value of theaverageScore
record component.- Returns:
- the value of the
averageScore
record component
-
totalScore
public int totalScore()Returns the value of thetotalScore
record component.- Returns:
- the value of the
totalScore
record component
-
gamesPlayed
public int gamesPlayed()Returns the value of thegamesPlayed
record component.- Returns:
- the value of the
gamesPlayed
record component
-