Пример #1
0
 public void foreach(FightHandlerAction action) throws FightException {
   if (state == FightStateEnum.ACTIVE) {
     for (IFighter fighter : fighters) {
       action.call(fighter.getHandler());
     }
   } else {
     for (IFighter fighter : challengers) {
       action.call(fighter.getHandler());
     }
     for (IFighter fighter : defenders) {
       action.call(fighter.getHandler());
     }
   }
 }
Пример #2
0
  public void foreachTeam(FightTeamEnum team, FightHandlerAction action) throws FightException {
    switch (team) {
      case CHALLENGER:
        for (IFighter fighter : challengers) {
          action.call(fighter.getHandler());
        }
        break;

      case DEFENDER:
        for (IFighter fighter : defenders) {
          action.call(fighter.getHandler());
        }
        break;

      case SPECTATOR:
        break;
    }
  }