Working on tournaments.

This commit is contained in:
marcins78@gmail.com
2012-05-01 16:42:37 +00:00
parent b6db348386
commit 980fe7fae0
2 changed files with 5 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
public class Tournament {
private Comparator<PlayerStanding> LEAGUE_STANDING_COMPARATOR =
private Comparator<PlayerStanding> STANDING_COMPARATOR =
new MultipleComparator<PlayerStanding>(
new DescComparator<PlayerStanding>(new PointsComparator()),
new GamesPlayedComparator(),
@@ -195,13 +195,13 @@ public class Tournament {
List<PlayerStanding> result = new ArrayList<PlayerStanding>(playersStandings.values());
Collections.sort(result, LEAGUE_STANDING_COMPARATOR);
Collections.sort(result, STANDING_COMPARATOR);
int standing = 0;
int position = 1;
PlayerStanding lastStanding = null;
for (PlayerStanding playerStanding : result) {
if (lastStanding == null || LEAGUE_STANDING_COMPARATOR.compare(playerStanding, lastStanding) != 0)
if (lastStanding == null || STANDING_COMPARATOR.compare(playerStanding, lastStanding) != 0)
standing = position;
playerStanding.setStanding(standing);
position++;

View File

@@ -6,4 +6,6 @@ import java.util.Map;
public interface TournamentCallback {
public void createGames(Map<String, String> pairings, Map<String, LotroDeck> playerDecks);
public void broadcastMessage(String message);
}