|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.depot.DepotRepository
com.threerings.parlor.rating.server.persist.RatingRepository
public class RatingRepository
Handles the persistent storage of per-user per-game ratings.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.samskivert.depot.DepotRepository |
|---|
com.samskivert.depot.DepotRepository.CacheStrategy |
| Field Summary |
|---|
| Fields inherited from class com.samskivert.depot.DepotRepository |
|---|
_ctx, _dataMigs |
| Constructor Summary | |
|---|---|
RatingRepository(com.samskivert.depot.PersistenceContext ctx)
Initialize the RatingRepository. |
|
| Method Summary | |
|---|---|
void |
deletePercentile(int gameId,
int gameMode)
Deletes the percentile record for the specified game and game mode. |
void |
deleteRating(int gameId,
int playerId)
Deletes the specified rating record. |
protected void |
getManagedRecords(Set<Class<? extends com.samskivert.depot.PersistentRecord>> classes)
|
Collection<RatingRecord> |
getMostRecentRatings(Collection<Integer> playerIds,
Collection<Integer> gameIds,
int gameIdSign)
Load the most recently entered rating for each of a collection of players. |
Collection<RatingRecord> |
getMostRecentRatings(Collection<Integer> playerIds,
int gameIdSign)
Load the most recently entered rating for each of a collection of players. |
RatingRecord |
getRating(int gameId,
int playerId)
Loads the rating for the given player for the given game and returns it as a RatingRecord object, or null if the player has no previous rating for the game. |
List<RatingRecord> |
getRatings(int gameId,
Integer... players)
Fetch the ratings registered for any of the given players for the given game and return them as a list of RatingRecord objects. |
List<RatingRecord> |
getRatings(int playerId,
long since,
int count)
Fetch and return all the registered RatingRecord rows for the given player. |
List<RatingRecord> |
getTopRatings(int gameId,
int limit,
long since,
Set<Integer> playerIds)
Returns the top-ratings for the specified game. |
Percentiler |
loadPercentile(int gameId,
int gameMode)
Loads the percentile distribution associated with the specified game and mode. null will never be returned, rather a blank percentiler will be created and returned. |
Map<Integer,Percentiler> |
loadPercentiles(int gameId)
Loads all the percentile distributions associated with the specified game. |
void |
purgeGame(int gameId)
Deletes all rating and percentile records for the specified game. |
void |
purgePlayers(Collection<Integer> playerIds)
Deletes all rating records for the specified players. |
void |
setRating(int gameId,
int playerId,
int rating,
int experience)
Set the rating and experience for a given player and game. |
void |
updatePercentile(int gameId,
int gameMode,
Percentiler tiler)
Writes the supplied percentiler's data out to the database. |
| Methods inherited from class com.samskivert.depot.DepotRepository |
|---|
delete, delete, deleteAll, deleteAll, deleteAll, deleteAll, doUpdate, findAll, findAll, findAll, findAll, findAllKeys, findAllKeys, from, init, insert, load, load, load, load, loadAll, loadAll, makeValue, map, registerMigration, requireNotComputed, resolveRecords, runMigration, store, update, update, updatePartial, updatePartial, updatePartial, updatePartial, updatePartial |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Inject public RatingRepository(com.samskivert.depot.PersistenceContext ctx)
RatingRepository.
| Method Detail |
|---|
public RatingRecord getRating(int gameId,
int playerId)
RatingRecord object, or null if the player has no previous rating for the game.
public List<RatingRecord> getRatings(int gameId,
Integer... players)
RatingRecord objects. The size of this list is no less than zero
and no greater than the number of given players.
public List<RatingRecord> getRatings(int playerId,
long since,
int count)
RatingRecord rows for the given player. Ratings
will be returned in order of most recently to least recently updated.
since - ratings last updated more than this number of milliseconds in the past will be
ommitted from the result list. Supplying -1 will return all ratings regardless of age.count - the maximum number of ratings to return or -1 for all ratings.
public List<RatingRecord> getTopRatings(int gameId,
int limit,
long since,
Set<Integer> playerIds)
since - an absolute number of milliseconds (ie. 10*24*60*60*1000L). Players that have
not updated their rating within this many milliseconds in the past will be omitted from the
results. Supply zero to omit this filter.playerIds - an optional list of player ids to which to limit the top-rankings search.
public void setRating(int gameId,
int playerId,
int rating,
int experience)
public void deleteRating(int gameId,
int playerId)
public Percentiler loadPercentile(int gameId,
int gameMode)
public Map<Integer,Percentiler> loadPercentiles(int gameId)
public void updatePercentile(int gameId,
int gameMode,
Percentiler tiler)
public void deletePercentile(int gameId,
int gameMode)
public void purgeGame(int gameId)
public void purgePlayers(Collection<Integer> playerIds)
public Collection<RatingRecord> getMostRecentRatings(Collection<Integer> playerIds,
int gameIdSign)
gameIdSign - if non-zero, limits the search to game ids of matching sign
public Collection<RatingRecord> getMostRecentRatings(Collection<Integer> playerIds,
Collection<Integer> gameIds,
int gameIdSign)
gameIds - if not null, limits the search to the specific game idsgameIdSign - if non-zero, limits the search to game ids of matching signprotected void getManagedRecords(Set<Class<? extends com.samskivert.depot.PersistentRecord>> classes)
getManagedRecords in class com.samskivert.depot.DepotRepository
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||