Esempio n. 1
0
 @Override
 public synchronized boolean add(QueueObject to) {
   if (to == null) return false;
   playerSize += to.getNumPlayers();
   teamSize += to.getTeams().size();
   return super.add(to);
 }
Esempio n. 2
0
 public synchronized Collection<ArenaTeam> getTeams() {
   List<ArenaTeam> teams = new ArrayList<ArenaTeam>();
   for (QueueObject team : this) {
     teams.addAll(team.getTeams());
   }
   return teams;
 }
Esempio n. 3
0
 public synchronized Collection<ArenaPlayer> getArenaPlayers() {
   List<ArenaPlayer> players = new ArrayList<ArenaPlayer>();
   for (QueueObject qo : this) {
     for (ArenaTeam t : qo.getTeams()) {
       players.addAll(t.getPlayers());
     }
   }
   return players;
 }
Esempio n. 4
0
  @Override
  public boolean remove(QueueObject queueObject) {

    if (super.remove(queueObject)) {
      playerSize -= queueObject.getNumPlayers();
      teamSize -= queueObject.getTeams().size();
      return true;
    }
    return false;
  }
Esempio n. 5
0
 public synchronized ArenaTeam remove(ArenaTeam team) {
   Iterator<QueueObject> iter = this.iterator();
   while (iter.hasNext()) {
     QueueObject qo = iter.next();
     if (qo.hasTeam(team)) {
       iter.remove();
       playerSize -= qo.getNumPlayers();
       teamSize -= qo.getTeams().size();
       return team;
     }
   }
   return null;
 }
Esempio n. 6
0
 public synchronized ArenaTeam remove(ArenaPlayer p) {
   Iterator<QueueObject> iter = this.iterator();
   while (iter.hasNext()) {
     QueueObject qo = iter.next();
     if (qo.hasMember(p)) {
       iter.remove();
       playerSize--;
       teamSize -= qo.getTeams().size();
       return qo.getTeam(p);
     }
   }
   return null;
 }