public boolean isLastGateInSection(int iGate) {
   for (JudgingSection s : judgingSections) {
     if (iGate == s.getLastGate()) {
       return true;
     }
   }
   return false;
 }
 public JudgingSection getSection(int section) {
   JudgingSection judgingSection = null;
   for (JudgingSection s : judgingSections) {
     if (s.getClientDeviceAttached()) {
       judgingSection = s;
       break;
     }
   }
   return judgingSection;
 }
 public JudgingSection updateSectionOnline(Integer section) {
   JudgingSection found = null;
   for (JudgingSection js : judgingSections) {
     if (js.getSectionNbr().compareTo(section) == 0) {
       js.setClientDeviceAttached(true);
       found = js;
       break;
     }
   }
   return found;
 }
  private void deSerialize(ObjectInputStream in) throws DuplicateBibException {
    Object o;
    try {
      while ((o = in.readObject()) != null) {
        Race raceFromSerialized = (Race) o;

        this.date = raceFromSerialized.date;
        this.name = raceFromSerialized.name;
        this.location = raceFromSerialized.location;
        setNbrGates(raceFromSerialized.nbrGates); // this.nbrGates = race.nbrGates;// = 25;
        this.upstreamGates = raceFromSerialized.upstreamGates;
        this.judgingSections = raceFromSerialized.judgingSections;
        for (JudgingSection s : judgingSections) {
          // must assign all transients, otherwise they are null and cause problsm
          s.setClientDeviceAttached(new Boolean(false));
        }

        // Race Status
        this.pendingRerun = raceFromSerialized.pendingRerun;
        this.activeRuns = raceFromSerialized.activeRuns;
        this.completedRuns = raceFromSerialized.completedRuns;

        this.startList = raceFromSerialized.startList;
        this.runsStartedOrCompletedCnt = raceFromSerialized.runsStartedOrCompletedCnt;
        this.currentRunIteration =
            raceFromSerialized.currentRunIteration; // are we on 1st runs, or 2nd runs ?
        this.racers = raceFromSerialized.racers;
        this.tagHeuerEnabled =
            raceFromSerialized.tagHeuerEnabled; // todo REMOVE ->tagHeuerEmulation =
        // raceFromSerialized.tagHeuerEmulation;
        this.microgateEnabled = raceFromSerialized.microgateEnabled;
        this.microgateEnabled = raceFromSerialized.timyEnabled;

        this.icfPenalties = raceFromSerialized.icfPenalties;
      }

    } catch (InvalidClassException ice) {
      clearRace();
      System.out.println("All data cleared, incompatible race object version information");
    } catch (EOFException io) {
      // io.printStackTrace();

    } catch (IOException io) {
      io.printStackTrace();
    } catch (ClassNotFoundException cnfe) {
      cnfe.printStackTrace();
    }
    String duplicates = lookForDuplicateBibsInTheSameClass();
    if (duplicates != null) {
      log.error(duplicates);
      throw new DuplicateBibException();
    }
  }
 public String getSectionsConnectedNamesAsString() {
   StringBuffer sb = new StringBuffer();
   boolean first = true;
   for (JudgingSection s : judgingSections) {
     if (s.getClientDeviceAttached()) {
       if (!first) {
         sb.append(",");
       }
       first = false;
       sb.append(s.getSectionNbr());
     }
   }
   if (sb.length() == 0) {
     sb.append(SECTIONS_NONE);
   }
   return sb.toString();
 }
  public boolean isGateInSection(int iGate, int section) {
    if (section == 0) { // All Sections are represented by 0 /// fixme kludge
      return true;
    }
    int currSection = 1;
    for (JudgingSection s : judgingSections) {
      if (section == currSection) {
        if (iGate >= s.getFirstGate() && iGate <= s.getLastGate()) {
          // System.out.println(iGate + " is in section " + section);
          return true;
        }
      }
      currSection++;
    }
    //        System.out.println(iGate + " is NOT in section " + section);

    return false;
  }