mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 12:02:01 -08:00
* Tournament - Show players of tournament sorted by their tournament points.
This commit is contained in:
parent
e40b44ed79
commit
2b2594d993
4 changed files with 15 additions and 7 deletions
|
|
@ -36,7 +36,7 @@ import mage.game.tournament.TournamentPlayer;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class TournamentPlayerView implements Serializable {
|
||||
public class TournamentPlayerView implements Serializable, Comparable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final String name;
|
||||
|
|
@ -77,4 +77,9 @@ public class TournamentPlayerView implements Serializable {
|
|||
return quit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object t) {
|
||||
return ((TournamentPlayerView) t).getPoints() - this.getPoints();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ package mage.view;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import mage.game.tournament.Round;
|
||||
|
|
@ -51,9 +52,10 @@ public class TournamentView implements Serializable {
|
|||
|
||||
private final boolean watchingAllowed;
|
||||
|
||||
private final List<RoundView> rounds = new ArrayList<RoundView>();
|
||||
private final List<TournamentPlayerView> players = new ArrayList<TournamentPlayerView>();
|
||||
private final List<RoundView> rounds = new ArrayList<>();
|
||||
private final List<TournamentPlayerView> players = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public TournamentView(Tournament tournament) {
|
||||
|
||||
tournamentName = tournament.getOptions().getName();
|
||||
|
|
@ -65,6 +67,7 @@ public class TournamentView implements Serializable {
|
|||
for (TournamentPlayer player: tournament.getPlayers()) {
|
||||
players.add(new TournamentPlayerView(player));
|
||||
}
|
||||
Collections.sort(players);
|
||||
for (Round round: tournament.getRounds()) {
|
||||
rounds.add(new RoundView(round));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue