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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongCalculates the epoch for the current server time.longcalculateEpochForMillis(long millis) Calculates the epoch's starting millis to which the given millis timestamp belongs.booleanlonggetEpochForDate(Date date) Calculates the epoch's starting millis to which the given millis timestamp belongs.longgetName()org.bson.types.ObjectIdgetTitle()inthashCode()booleanWhether or not the leaderboard has started its first epoch yet.voidsetEpochInterval(long epochInterval) voidsetFirstEpochTimestamp(Timestamp firstEpochTimestamp) voidvoidsetObjectId(org.bson.types.ObjectId objectId) voidsetScoreStrategyType(Leaderboard.ScoreStrategyType scoreStrategyType) voidsetScoreUnits(String scoreUnits) voidsetTimeStrategyType(Leaderboard.TimeStrategyType timeStrategyType) void
-
Constructor Details
-
MongoLeaderboard
public MongoLeaderboard()
-
-
Method Details
-
getObjectId
public org.bson.types.ObjectId getObjectId() -
setObjectId
public void setObjectId(org.bson.types.ObjectId objectId) -
getName
-
setName
-
getTimeStrategyType
-
setTimeStrategyType
-
getScoreStrategyType
-
setScoreStrategyType
-
getTitle
-
setTitle
-
getScoreUnits
-
setScoreUnits
-
getFirstEpochTimestamp
-
setFirstEpochTimestamp
-
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_EPOCHif 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_EPOCHif a global leaderboard.
-
getEpochForDate
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_EPOCHif a global leaderboard, -1L if invalid input (i.e. the given date occurs before the firstEpochTimestamp).
-
equals
-
hashCode
public int hashCode()
-