Program: 73123
Project: 73123
Buggy source:
/** 
 * Return true if the director is ready to fire. This method is called by the container of this director to determine whether the director is ready to execute. It does <i>not</i> call prefire() on the contained actors.  If this director is not at the top level of the hierarchy, and the current time of the enclosing model is greater than the current time of this director, then this base class updates current time to match that of the enclosing model.  <p> In this base class, assume that the director is always ready to be fired, and so return true.  Domain directors should probably override this method to provide domain-specific operation.  However, they should call super.prefire() if they wish to propagate time as done here.
 * @return True.
 * @exception IllegalActionException Not thrown in this base class.
 */
public boolean prefire() throws IllegalActionException {
  _postfireReturns=true;
  if (_prefire) {
    return true;
  }
  _prefire=super.prefire();
  if (_resourceScheduling && _prefire) {
    Iterator firings=null;
    if (_savedSchedule == null) {
      Scheduler scheduler=getScheduler();
      Schedule schedule=scheduler.getSchedule();
      _savedSchedule=schedule;
      _savedSchedulePosition=0;
      firings=schedule.firingIterator();
    }
 else {
      firings=_savedSchedule.firingIterator();
      for (int i=0; i < _savedSchedulePosition; i++) {
        firings.next();
      }
    }
    Firing firing=null;
    while ((_savedIterationCount > 0 || firings.hasNext()) && !_stopRequested) {
      if (firing == null || _savedIterationCount == 0) {
        firing=(Firing)firings.next();
      }
      Actor actor=firing.getActor();
      boolean finished=_schedule(actor,null,null);
      if (!finished) {
        _prefire=false;
        return false;
      }
      if (_savedIterationCount == 0) {
        _savedIterationCount=firing.getIterationCount();
      }
      _savedIterationCount--;
      if (_savedIterationCount == 0) {
        _savedSchedulePosition++;
      }
    }
    if (_savedSchedule.size() <= _savedSchedulePosition) {
      _savedSchedule=null;
    }
  }
  return _prefire;
}

Fixed version (ground truth):
/** 
 * Return true if the director is ready to fire. This method is called by the container of this director to determine whether the director is ready to execute. It does <i>not</i> call prefire() on the contained actors.  If this director is not at the top level of the hierarchy, and the current time of the enclosing model is greater than the current time of this director, then this base class updates current time to match that of the enclosing model.  <p> In this base class, assume that the director is always ready to be fired, and so return true.  Domain directors should probably override this method to provide domain-specific operation.  However, they should call super.prefire() if they wish to propagate time as done here.
 * @return True.
 * @exception IllegalActionException Not thrown in this base class.
 */
public boolean prefire() throws IllegalActionException {
  _postfireReturns=true;
  _prefire=super.prefire();
  if (_resourceScheduling && _prefire) {
    Iterator firings=null;
    if (_savedSchedule == null) {
      Scheduler scheduler=getScheduler();
      Schedule schedule=scheduler.getSchedule();
      _savedSchedule=schedule;
      _savedSchedulePosition=0;
      firings=schedule.firingIterator();
    }
 else {
      firings=_savedSchedule.firingIterator();
      for (int i=0; i < _savedSchedulePosition; i++) {
        firings.next();
      }
    }
    Firing firing=null;
    while ((_savedIterationCount > 0 || firings.hasNext()) && !_stopRequested) {
      if (firing == null || _savedIterationCount == 0) {
        firing=(Firing)firings.next();
      }
      Actor actor=firing.getActor();
      boolean finished=_schedule(actor,null,null);
      if (!finished) {
        _prefire=false;
        return false;
      }
      if (_savedIterationCount == 0) {
        _savedIterationCount=firing.getIterationCount();
      }
      _savedIterationCount--;
      if (_savedIterationCount == 0) {
        _savedSchedulePosition++;
      }
    }
    if (_savedSchedule.size() <= _savedSchedulePosition) {
      _savedSchedule=null;
    }
  }
  return _prefire;
}