/** * Get a List of all of the players in the pool * * @pre true * @post nothing changes * @return A collection of all of the players in the hockey pool */ public List<Player> getAllPlayers() { List<Player> players = new ArrayList<Player>(); for (PoolTeam pt : m_poolTeams) { Iterator<Player> it = pt.playersIterator(); while (it.hasNext()) { players.add(it.next()); } } return players; }
/** * Resort all of the players and teams in the pool * * @pre true * @post All of the players are teams are sorted */ public void resort() { // Resort players for (PoolTeam pt : m_poolTeams) { Iterator<Player> it = pt.playersIterator(); List<Player> players = new ArrayList<Player>(); while (it.hasNext()) players.add(it.next()); pt.clearPlayers(); for (Player p : players) { pt.addPlayer(p); } } // Resort Pool Teams List<PoolTeam> tempTeamList = new ArrayList<PoolTeam>(); for (PoolTeam pt : m_poolTeams) { tempTeamList.add(pt); } m_poolTeams.clear(); for (PoolTeam pt : tempTeamList) { m_poolTeams.add(pt); } }