Class MongoLeaderboard

java.lang.Object
dev.getelements.elements.dao.mongo.model.MongoLeaderboard

@Entity(value="leaderboard", useDiscriminator=false) @Indexes(@Index(fields=@Field("name"),options=@IndexOptions(unique=true))) public class MongoLeaderboard extends Object
  • Constructor Details

    • MongoLeaderboard

      public MongoLeaderboard()
  • Method Details

    • getObjectId

      public org.bson.types.ObjectId getObjectId()
    • setObjectId

      public void setObjectId(org.bson.types.ObjectId objectId)
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getTimeStrategyType

      public Leaderboard.TimeStrategyType getTimeStrategyType()
    • setTimeStrategyType

      public void setTimeStrategyType(Leaderboard.TimeStrategyType timeStrategyType)
    • getScoreStrategyType

      public Leaderboard.ScoreStrategyType getScoreStrategyType()
    • setScoreStrategyType

      public void setScoreStrategyType(Leaderboard.ScoreStrategyType scoreStrategyType)
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • getScoreUnits

      public String getScoreUnits()
    • setScoreUnits

      public void setScoreUnits(String scoreUnits)
    • getFirstEpochTimestamp

      public Timestamp getFirstEpochTimestamp()
    • setFirstEpochTimestamp

      public void setFirstEpochTimestamp(Timestamp firstEpochTimestamp)
    • getEpochInterval

      public long getEpochInterval()
    • setEpochInterval

      public void setEpochInterval(long epochInterval)
    • hasStarted

      public boolean hasStarted()
      Whether or not the leaderboard has started its first epoch yet. If the leaderboard is not epochal, this will always return false.
      Returns:
      whether or not the leaderboard has started its first epoch yet.
    • calculateEpochForMillis

      public long calculateEpochForMillis(long millis)
      Calculates the epoch's starting millis to which the given millis timestamp belongs.
      Parameters:
      millis - the timestamp, in milliseconds, which is being looked up.
      Returns:
      the epoch in millis if an epochal leaderboard and valid input, MongoScoreId.ALL_TIME_LEADERBOARD_EPOCH if a global leaderboard, -1L if invalid input (i.e. the given millis occur before the firstEpochTimestamp).
    • calculateCurrentEpoch

      public long calculateCurrentEpoch()
      Calculates the epoch for the current server time.
      Returns:
      the epoch in millis if an epochal leaderboard and valid input, MongoScoreId.ALL_TIME_LEADERBOARD_EPOCH if a global leaderboard.
    • getEpochForDate

      public long getEpochForDate(Date date)
      Calculates the epoch's starting millis to which the given millis timestamp belongs.
      Parameters:
      date - the date being looked up.
      Returns:
      the epoch in millis if an epochal leaderboard and valid input, MongoScoreId.ALL_TIME_LEADERBOARD_EPOCH if a global leaderboard, -1L if invalid input (i.e. the given date occurs before the firstEpochTimestamp).
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object