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; }
public Object calculateSchoolName(SeasonalAthlete seasonalAthlete) { return seasonalAthlete.getAthlete().getSchool().getName(); }
public Object calculateGamesPlayed(SeasonalAthlete seasonalAthlete) { Object ret = seasonalAthlete.getEventsPlayedCount(predicate); return convertToNumber(ret, Integer.class); }
public Object calculateAthleteFirstName(SeasonalAthlete seasonalAthlete) { return seasonalAthlete.getAthlete().getFirstName(); }