public RoundView(Round round) { try { for (TournamentPairing pair : round.getPairs()) { // get info of finished games from match if (pair.getMatch() != null) { for (GameInfo gameInfo : pair.getMatch().getGamesInfo()) { games.add(new TournamentGameView(round.getRoundNumber(), gameInfo.getMatchId(), gameInfo.getGameId(), gameInfo.getState(), gameInfo.getResult(), gameInfo.getPlayers(), gameInfo.getTableId())); } if (!pair.getMatch().hasEnded()) { int numberSavedGames = pair.getMatch().getGamesInfo().size(); if (pair.getMatch() != null) { int gameCount = 0; for (Game game : pair.getMatch().getGames()) { gameCount++; if (gameCount > numberSavedGames) { // only unfinished game info directly from game games.add(new TournamentGameView(round.getRoundNumber(), pair, game)); } } } } } } } catch (Exception ex) { ex.printStackTrace(); } }
MatchPlayer mp2 = match.getPlayer(pair.getPlayer2().getPlayer().getId()); if (round.getRoundNumber() == rounds.size()) { // for elimination getRoundNumber = 0 so never true here match.setTournamentRound(round.getRoundNumber()); if (tp1.getState() == TournamentPlayerState.DUELING) { if (round.getRoundNumber() == getNumberRounds()) { tp1.setState(TournamentPlayerState.FINISHED); } else { if (round.getRoundNumber() == getNumberRounds()) { tp2.setState(TournamentPlayerState.FINISHED); } else { tp1.setResults(addRoundResult(round.getRoundNumber(), pair, tp1, tp2)); tp2.setResults(addRoundResult(round.getRoundNumber(), pair, tp2, tp1)); tp.setResults(new StringBuilder(tp.getResults()).append('R').append(round.getRoundNumber()).append(' ').append("Bye ").toString()); tp.setPoints(tp.getPoints() + 3);
public boolean isRoundOver() { boolean roundIsOver = true; for (TournamentPairing pair: pairs) { if (pair.getMatch() != null) { if (!pair.getMatch().hasEnded()) { roundIsOver = false; } else { if (!pair.isAlreadyPublished()) { tournament.updateResults(); pair.setAlreadyPublished(true); if (tournament instanceof TournamentSingleElimination) { pair.eliminatePlayers(); } // if it's the last round, finish all players for the tournament if their match is finished if (getRoundNumber() == tournament.getNumberRounds()) { pair.finishPlayersThatPlayedLastRound(); } } } } } return roundIsOver; }
.setRound(round.getRoundNumber()); for (TournamentPairing pair : round.getPairs()) { Match match = pair.getMatch();