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 "";
    }
  }
Пример #2
0
 private BattleResultsWrapper(BattleResults results) {
   super(
       results.getTeamLeaderName(),
       results.getRank(),
       results.getScore(),
       results.getSurvival(),
       results.getLastSurvivorBonus(),
       results.getBulletDamage(),
       results.getBulletDamageBonus(),
       results.getRamDamage(),
       results.getRamDamageBonus(),
       results.getFirsts(),
       results.getSeconds(),
       results.getThirds());
 }