/** * Is given team eliminated? * * @param team * @return */ public boolean isEliminated(String team) { validateTeam(team); Iterable<String> cert = certificates.get(team); // not calculated yet if (cert == null) { cert = calculate(team); certificates.put(team, cert); } return cert.iterator().hasNext(); }
/** * Subset R of teams that eliminates given team; null if not eliminated. * * @param team * @return */ public Iterable<String> certificateOfElimination(String team) { validateTeam(team); Iterable<String> cert = certificates.get(team); // not calculated yet if (cert == null) { cert = calculate(team); certificates.put(team, cert); } if (cert.iterator().hasNext()) { return cert; } else { return null; } }
/** * Number of remaining games for given team. * * @param team * @return */ public int remaining(String team) { validateTeam(team); return remaining[teams.indexOf(team)]; }
/** * Number of losses for given team. * * @param team * @return */ public int losses(String team) { validateTeam(team); return loses[teams.indexOf(team)]; }
/** * Number of wins for given team. * * @param team * @return */ public int wins(String team) { validateTeam(team); return wins[teams.indexOf(team)]; }
/** * Number of remaining games between team1 and team2. * * @param team1 * @param team2 * @return */ public int against(String team1, String team2) { validateTeam(team1); validateTeam(team2); return games[teams.indexOf(team1)][teams.indexOf(team2)]; }