@Override
public int compareTo(HandScore score) {
if (this.type.ordinal() == score.type.ordinal()) {
int numRanks = Math.min(this.ranks.size(), score.ranks.size());
int i = 0;
Rank thisRank;
Rank thatRank;
do
{
thisRank = this.ranks.get(i);
thatRank = score.ranks.get(i);
i++;
} while (thisRank == thatRank && i < numRanks);
return (i <= numRanks) ? thisRank.ordinal() - thatRank.ordinal() : 0;
}
return this.type.ordinal() - score.type.ordinal();
}