public Object getValueAt(int row, int col) { BattleResults statistics = results[row]; switch (col) { case 0: { int place = row + 1; while (place < getRowCount() && statistics.getScore() == results[place].getScore()) { place++; } return StringUtil.getPlacementString(place); } case 1: return statistics.getTeamLeaderName(); case 2: String percent = ""; if (totalScore != 0) { percent = " (" + NumberFormat.getPercentInstance().format(statistics.getScore() / totalScore) + ")"; } return "" + (int) (statistics.getScore() + 0.5) + percent; case 3: return "" + (int) (statistics.getSurvival() + 0.5); case 4: return "" + (int) (statistics.getLastSurvivorBonus() + 0.5); case 5: return "" + (int) (statistics.getBulletDamage() + 0.5); case 6: return "" + (int) (statistics.getBulletDamageBonus() + 0.5); case 7: return "" + (int) (statistics.getRamDamage() + 0.5); case 8: return "" + (int) (statistics.getRamDamageBonus() + 0.5); case 9: return "" + statistics.getFirsts(); case 10: return "" + statistics.getSeconds(); case 11: return "" + statistics.getThirds(); default: return ""; } }
public Object getValueAt(int row, int col) { List<ContestantPeer> orderedContestants = new ArrayList<ContestantPeer>(battle.getContestants()); Collections.sort(orderedContestants); ContestantPeer r = orderedContestants.get(row); ContestantStatistics statistics = r.getStatistics(); switch (col) { case 0: { int place = row + 1; while (place < getRowCount() && statistics.getTotalScore() == orderedContestants.get(place).getStatistics().getTotalScore()) { place++; } return StringUtil.getPlacementString(place); } case 1: return ((r instanceof TeamPeer) ? "Team: " : "") + r.getName(); case 2: return "" + (int) (statistics.getTotalScore() + 0.5); case 3: return "" + (int) (statistics.getTotalSurvivalScore() + 0.5); case 4: return "" + (int) (statistics.getTotalLastSurvivorBonus() + 0.5); case 5: return "" + (int) (statistics.getTotalBulletDamageScore() + 0.5); case 6: return "" + (int) (statistics.getTotalBulletKillBonus() + 0.5); case 7: return "" + (int) (statistics.getTotalRammingDamageScore() + 0.5); case 8: return "" + (int) (statistics.getTotalRammingKillBonus() + 0.5); case 9: return "" + statistics.getTotalFirsts(); case 10: return "" + statistics.getTotalSeconds(); case 11: return "" + statistics.getTotalThirds(); default: return ""; } }