Exemplo n.º 1
0
    public Object calculateStat(String stat, SeasonalAthlete seasonalAthlete, String aggregator) {
      Object ret = null;
      if (SortParam.GAMES_PLAYED.fieldName.equalsIgnoreCase(stat)) {
        ret = calculateGamesPlayed(seasonalAthlete);
        ret = convertToNumber(ret, Integer.class);
      } else if (SortParam.LAST_NAME.fieldName.equalsIgnoreCase(stat)) {
        ret = calculateAthleteLastName(seasonalAthlete);
      } else if (SortParam.FIRST_NAME.fieldName.equalsIgnoreCase(stat)) {
        ret = calculateAthleteFirstName(seasonalAthlete);
      } else if (AVG.equalsIgnoreCase(aggregator)) {
        ret = seasonalAthlete.averageStat(stat, predicate);
        ret = convertToNumber(ret, Double.class);
      } else {
        ret = seasonalAthlete.sumStat(stat, predicate);
        ret = convertToNumber(ret, Integer.class);
      }

      return ret;
    }
Exemplo n.º 2
0
 public Object calculateSchoolName(SeasonalAthlete seasonalAthlete) {
   return seasonalAthlete.getAthlete().getSchool().getName();
 }
Exemplo n.º 3
0
    public Object calculateGamesPlayed(SeasonalAthlete seasonalAthlete) {
      Object ret = seasonalAthlete.getEventsPlayedCount(predicate);

      return convertToNumber(ret, Integer.class);
    }
Exemplo n.º 4
0
 public Object calculateAthleteFirstName(SeasonalAthlete seasonalAthlete) {
   return seasonalAthlete.getAthlete().getFirstName();
 }