Class Score

java.lang.Object
spinhex.score.Score

public class Score extends Object
Represents a score in the game, associating a username with a numeric score. This class is used to track player performance.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor that creates an empty Score object.
    Score(String username, int score)
    Creates a Score object with the specified username and score.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this Score object with the specified object for equality.
    int
    Returns the numeric score value.
    Returns the username associated with this score.
    int
    Returns a hash code value for this Score object.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Score

      public Score()
      Default constructor that creates an empty Score object. This constructor should be only used implicitly by Jackson for deserialization.
    • Score

      public Score(String username, int score)
      Creates a Score object with the specified username and score.
      Parameters:
      username - the player's username
      score - the player's numeric score
  • Method Details

    • getUsername

      public String getUsername()
      Returns the username associated with this score.
      Returns:
      the player's username
    • getScore

      public int getScore()
      Returns the numeric score value.
      Returns:
      the player's score
    • equals

      public boolean equals(Object o)
      Compares this Score object with the specified object for equality. Two Score objects are considered equal if they have the same username and score.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare this Score against
      Returns:
      true if the given object represents a Score equivalent to this Score, false otherwise
    • hashCode

      public int hashCode()
      Returns a hash code value for this Score object. The hash code is computed based on the username and score.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this Score