Fluency++, imports--.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@856 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2009-06-10 18:54:46 +00:00
parent 4b136b2f88
commit 0ef8cf1c58
2 changed files with 10 additions and 14 deletions
@@ -46,9 +46,6 @@ import com.samskivert.depot.clause.QueryClause;
import com.samskivert.depot.clause.Where; import com.samskivert.depot.clause.Where;
import com.samskivert.depot.expression.SQLExpression; import com.samskivert.depot.expression.SQLExpression;
import com.samskivert.depot.operator.And; import com.samskivert.depot.operator.And;
import com.samskivert.depot.operator.Equals;
import com.samskivert.depot.operator.GreaterThan;
import com.samskivert.depot.operator.In;
import com.threerings.parlor.rating.util.Percentiler; import com.threerings.parlor.rating.util.Percentiler;
@@ -86,8 +83,8 @@ public class RatingRepository extends DepotRepository
return Collections.emptyList(); return Collections.emptyList();
} }
return findAll(RatingRecord.class, return findAll(RatingRecord.class,
new Where(new And(new Equals(RatingRecord.GAME_ID, gameId), new Where(new And(RatingRecord.GAME_ID.eq(gameId),
new In(RatingRecord.PLAYER_ID, players)))); RatingRecord.PLAYER_ID.in(players))));
} }
/** /**
@@ -103,8 +100,8 @@ public class RatingRepository extends DepotRepository
ArrayList<QueryClause> clauses = Lists.newArrayList(); ArrayList<QueryClause> clauses = Lists.newArrayList();
if (since > 0L) { if (since > 0L) {
Timestamp when = new Timestamp(System.currentTimeMillis() - since); Timestamp when = new Timestamp(System.currentTimeMillis() - since);
clauses.add(new Where(new And(new Equals(RatingRecord.PLAYER_ID, playerId), clauses.add(new Where(new And(RatingRecord.PLAYER_ID.eq(playerId),
new GreaterThan(RatingRecord.LAST_UPDATED, when)))); RatingRecord.LAST_UPDATED.greaterThan(when))));
} else { } else {
clauses.add(new Where(RatingRecord.PLAYER_ID, playerId)); clauses.add(new Where(RatingRecord.PLAYER_ID, playerId));
} }
@@ -127,13 +124,13 @@ public class RatingRepository extends DepotRepository
public List<RatingRecord> getTopRatings (int gameId, int limit, long since, IntSet playerIds) public List<RatingRecord> getTopRatings (int gameId, int limit, long since, IntSet playerIds)
{ {
List<SQLExpression> where = Lists.newArrayList(); List<SQLExpression> where = Lists.newArrayList();
where.add(new Equals(RatingRecord.GAME_ID, gameId)); where.add(RatingRecord.GAME_ID.eq(gameId));
if (since > 0L) { if (since > 0L) {
where.add(new GreaterThan(RatingRecord.LAST_UPDATED, where.add(RatingRecord.LAST_UPDATED.greaterThan(
new Timestamp(System.currentTimeMillis() - since))); new Timestamp(System.currentTimeMillis() - since)));
} }
if (playerIds != null) { if (playerIds != null) {
where.add(new In(RatingRecord.PLAYER_ID, playerIds)); where.add(RatingRecord.PLAYER_ID.in(playerIds));
} }
OrderBy ob = new OrderBy( OrderBy ob = new OrderBy(
@@ -218,7 +215,7 @@ public class RatingRepository extends DepotRepository
*/ */
public void purgePlayers (Collection<Integer> playerIds) public void purgePlayers (Collection<Integer> playerIds)
{ {
deleteAll(RatingRecord.class, new Where(new In(RatingRecord.PLAYER_ID, playerIds)), null); deleteAll(RatingRecord.class, new Where(RatingRecord.PLAYER_ID.in(playerIds)), null);
} }
@Override @Override
@@ -31,7 +31,6 @@ import com.samskivert.depot.clause.FromOverride;
import com.samskivert.depot.clause.QueryClause; import com.samskivert.depot.clause.QueryClause;
import com.samskivert.depot.clause.Where; import com.samskivert.depot.clause.Where;
import com.samskivert.depot.expression.FunctionExp; import com.samskivert.depot.expression.FunctionExp;
import com.samskivert.depot.operator.In;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream; import com.threerings.io.ObjectOutputStream;
@@ -188,7 +187,7 @@ public class StatRepository extends DepotRepository
*/ */
public void purgePlayers (Collection<Integer> playerIds) public void purgePlayers (Collection<Integer> playerIds)
{ {
deleteAll(StatRecord.class, new Where(new In(StatRecord.PLAYER_ID, playerIds))); deleteAll(StatRecord.class, new Where(StatRecord.PLAYER_ID.in(playerIds)));
} }
/** /**