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
|
|
@ -517,7 +517,7 @@ class TournamentMatchesTableModel extends AbstractTableModel {
|
||||||
private boolean watchingAllowed;
|
private boolean watchingAllowed;
|
||||||
|
|
||||||
public void loadData(TournamentView tournament) {
|
public void loadData(TournamentView tournament) {
|
||||||
List<TournamentGameView> views = new ArrayList<TournamentGameView>();
|
List<TournamentGameView> views = new ArrayList<>();
|
||||||
watchingAllowed = tournament.isWatchingAllowed();
|
watchingAllowed = tournament.isWatchingAllowed();
|
||||||
for (RoundView round: tournament.getRounds()) {
|
for (RoundView round: tournament.getRounds()) {
|
||||||
for (TournamentGameView game: round.getGames()) {
|
for (TournamentGameView game: round.getGames()) {
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import mage.game.tournament.TournamentPlayer;
|
||||||
*
|
*
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
public class TournamentPlayerView implements Serializable {
|
public class TournamentPlayerView implements Serializable, Comparable{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
@ -77,4 +77,9 @@ public class TournamentPlayerView implements Serializable {
|
||||||
return quit;
|
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.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import mage.game.tournament.Round;
|
import mage.game.tournament.Round;
|
||||||
|
|
@ -51,9 +52,10 @@ public class TournamentView implements Serializable {
|
||||||
|
|
||||||
private final boolean watchingAllowed;
|
private final boolean watchingAllowed;
|
||||||
|
|
||||||
private final List<RoundView> rounds = new ArrayList<RoundView>();
|
private final List<RoundView> rounds = new ArrayList<>();
|
||||||
private final List<TournamentPlayerView> players = new ArrayList<TournamentPlayerView>();
|
private final List<TournamentPlayerView> players = new ArrayList<>();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public TournamentView(Tournament tournament) {
|
public TournamentView(Tournament tournament) {
|
||||||
|
|
||||||
tournamentName = tournament.getOptions().getName();
|
tournamentName = tournament.getOptions().getName();
|
||||||
|
|
@ -65,6 +67,7 @@ public class TournamentView implements Serializable {
|
||||||
for (TournamentPlayer player: tournament.getPlayers()) {
|
for (TournamentPlayer player: tournament.getPlayers()) {
|
||||||
players.add(new TournamentPlayerView(player));
|
players.add(new TournamentPlayerView(player));
|
||||||
}
|
}
|
||||||
|
Collections.sort(players);
|
||||||
for (Round round: tournament.getRounds()) {
|
for (Round round: tournament.getRounds()) {
|
||||||
rounds.add(new RoundView(round));
|
rounds.add(new RoundView(round));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,13 +59,13 @@ import org.apache.log4j.Logger;
|
||||||
public abstract class TournamentImpl implements Tournament {
|
public abstract class TournamentImpl implements Tournament {
|
||||||
|
|
||||||
protected UUID id = UUID.randomUUID();
|
protected UUID id = UUID.randomUUID();
|
||||||
protected List<Round> rounds = new CopyOnWriteArrayList<Round>();
|
protected List<Round> rounds = new CopyOnWriteArrayList<>();
|
||||||
protected Map<UUID, TournamentPlayer> players = new HashMap<UUID, TournamentPlayer>();
|
protected Map<UUID, TournamentPlayer> players = new HashMap<>();
|
||||||
protected static Random rnd = new Random();
|
protected static Random rnd = new Random();
|
||||||
protected String matchName;
|
protected String matchName;
|
||||||
protected TournamentOptions options;
|
protected TournamentOptions options;
|
||||||
protected TournamentType tournamentType;
|
protected TournamentType tournamentType;
|
||||||
protected List<ExpansionSet> sets = new ArrayList<ExpansionSet>();
|
protected List<ExpansionSet> sets = new ArrayList<>();
|
||||||
protected String setsInfoShort;
|
protected String setsInfoShort;
|
||||||
|
|
||||||
protected TableEventSource tableEventSource = new TableEventSource();
|
protected TableEventSource tableEventSource = new TableEventSource();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue