Interface PlayTime

All Known Implementing Classes:
PlayTimeProvider

public sealed interface PlayTime permits PlayTimeProvider
The PlayTime interface provides methods to manage and manipulate play time for users.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTime(int userId)
    Adds one unit of play time to the play time of a user with the given user ID.
    void
    addTime(int userId, PlayTimeType type, int time)
    Adds the specified amount of time to the play time of a user with the given user ID and play time type.
    void
    createUser(int userId)
    Creates a new user with the given user ID.
    void
    deleteUser(int userId)
    Deletes a user with the given user ID from the database.
    boolean
    existsUser(int userId)
    Checks if a user with the given user ID exists.
    int
    getTime(int userId)
    Obtains the time for the given user ID and play time type.
    void
    removeTime(int userId)
    Removes one unit of play time from the play time of a user specified with the given user ID.
    void
    removeTime(int userId, PlayTimeType type, int time)
    Removes the specified amount of time from the play time of a user with the given user ID and play time type.
    void
    resetTime(int userId)
    Resets the play time for a user with the given user ID to zero.
    void
    setTime(int userId, int time)
    Sets the play time for a user with the specified user ID.
  • Method Details

    • existsUser

      boolean existsUser(int userId)
      Checks if a user with the given user ID exists.
      Parameters:
      userId - The ID of the user to check
      Returns:
      true if a user with the given ID exists, false otherwise
    • createUser

      void createUser(int userId)
      Creates a new user with the given user ID.
      Parameters:
      userId - The ID of the user to create
    • deleteUser

      void deleteUser(int userId)
      Deletes a user with the given user ID from the database.
      Parameters:
      userId - The ID of the user to delete
    • getTime

      int getTime(int userId)
      Obtains the time for the given user ID and play time type.
      Parameters:
      userId - The ID of the user
      Returns:
      the time for the given user ID and play time type
    • setTime

      void setTime(int userId, int time)
      Sets the play time for a user with the specified user ID.
      Parameters:
      userId - The ID of the user
      time - The play time to set for the user, in seconds
    • addTime

      void addTime(int userId)
      Adds one unit of play time to the play time of a user with the given user ID.
      Parameters:
      userId - The ID of the user whose play time will be incremented by one unit
    • addTime

      void addTime(int userId, PlayTimeType type, int time)
      Adds the specified amount of time to the play time of a user with the given user ID and play time type.
      Parameters:
      userId - The ID of the user
      type - The type of play time
      time - The amount of time to add to the user's play time, in milliseconds
    • removeTime

      void removeTime(int userId)
      Removes one unit of play time from the play time of a user specified with the given user ID.
      Parameters:
      userId - The ID of the user whose play time will be decremented
    • removeTime

      void removeTime(int userId, PlayTimeType type, int time)
      Removes the specified amount of time from the play time of a user with the given user ID and play time type.
      Parameters:
      userId - The ID of the user
      type - The type of play time
      time - The amount of time to remove from the user's play time, in milliseconds
    • resetTime

      void resetTime(int userId)
      Resets the play time for a user with the given user ID to zero.
      Parameters:
      userId - The ID of the user whose play time needs to be reset