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 TypeMethodDescriptionlong
Calculates the epoch for the current server time.long
calculateEpochForMillis
(long millis) Calculates the epoch's starting millis to which the given millis timestamp belongs.boolean
long
getEpochForDate
(Date date) Calculates the epoch's starting millis to which the given millis timestamp belongs.long
getName()
org.bson.types.ObjectId
getTitle()
int
hashCode()
boolean
Whether or not the leaderboard has started its first epoch yet.void
setEpochInterval
(long epochInterval) void
setFirstEpochTimestamp
(Timestamp firstEpochTimestamp) void
void
setObjectId
(org.bson.types.ObjectId objectId) void
setScoreStrategyType
(Leaderboard.ScoreStrategyType scoreStrategyType) void
setScoreUnits
(String scoreUnits) void
setTimeStrategyType
(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_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
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
-
hashCode
public int hashCode()
-