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

    Fields
    Modifier and Type
    Field
    Description
    private final int
    The field for the averageScore record component.
    private final Difficulty
    The field for the favouriteDifficulty record component.
    private final int
    The field for the gamesPlayed record component.
    private final int
    The field for the totalScore record component.
    private final String
    The field for the username record component.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LeaderboardEntry(String username, Difficulty favouriteDifficulty, int averageScore, int totalScore, int gamesPlayed)
    Creates an instance of a LeaderboardEntry record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the averageScore record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the favouriteDifficulty record component.
    int
    Returns the value of the gamesPlayed record component.
    final int
    Returns a hash code value for this object.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the totalScore record component.
    Returns the value of the username record component.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • username

      private final String username
      The field for the username record component.
    • favouriteDifficulty

      private final Difficulty favouriteDifficulty
      The field for the favouriteDifficulty record component.
    • averageScore

      private final int averageScore
      The field for the averageScore record component.
    • totalScore

      private final int totalScore
      The field for the totalScore record component.
    • gamesPlayed

      private final int gamesPlayed
      The field for the gamesPlayed record component.
  • Constructor Details

    • LeaderboardEntry

      public LeaderboardEntry(String username, Difficulty favouriteDifficulty, int averageScore, int totalScore, int gamesPlayed)
      Creates an instance of a LeaderboardEntry record class.
      Parameters:
      username - the value for the username record component
      favouriteDifficulty - the value for the favouriteDifficulty record component
      averageScore - the value for the averageScore record component
      totalScore - the value for the totalScore record component
      gamesPlayed - the value for the gamesPlayed record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • username

      public String username()
      Returns the value of the username record component.
      Returns:
      the value of the username record component
    • favouriteDifficulty

      public Difficulty favouriteDifficulty()
      Returns the value of the favouriteDifficulty record component.
      Returns:
      the value of the favouriteDifficulty record component
    • averageScore

      public int averageScore()
      Returns the value of the averageScore record component.
      Returns:
      the value of the averageScore record component
    • totalScore

      public int totalScore()
      Returns the value of the totalScore record component.
      Returns:
      the value of the totalScore record component
    • gamesPlayed

      public int gamesPlayed()
      Returns the value of the gamesPlayed record component.
      Returns:
      the value of the gamesPlayed record component