Program: 75200
Project: 75200
Buggy source:
/** 
 * Always returns true, indicating that the (sub)system is always ready for one iteration. <P> If this is not a top-level director, some additional work is done to synchronize time with the executive director. In particular, it will compare its local time, say t, with the current time of the executive director, say t0. If t == t0, do nothing. <BR> If t > t0, then rollback to the "known good" time (which should be less than the outside time) and catch up with the outside time. <BR> If t < t0, then throw an exception because the CT subsystem should always run ahead of time. <BR> <P> If this director is not a top-level director, the iteration end time is resolved from the current time of the outside domains, say t1, the next iteration time of the outside domain, say t2, and the runAheadLength parameter of this director, say t3. The iteration end time is set to be <code>t5 = t1 + min(t2, t3)</code>.  The iteration end time may be further refined in the fire() method  due to possible event generated during the iteration.  In particular, when the first event is detected, say at t5 and t5 < t4, then the iteration ends at t5.
 * @return true Always.
 * @exception IllegalActionException If the local time isless than the current time of the executive director, or thrown by a directed actor.
 */
public boolean prefire() throws IllegalActionException {
  if (_debugging) {
    _debug(getName(),"String_Node_Str");
  }
  if (!_isTopLevel()) {
    CompositeActor container=(CompositeActor)getContainer();
    Director executiveDirector=container.getExecutiveDirector();
    _outsideTime=executiveDirector.getModelTime();
    Time localTime=getModelTime();
    double timeResolution=getTimeResolution();
    Time outsideNextIterationTime=executiveDirector.getModelNextIterationTime();
    if (_debugging) {
      _debug("String_Node_Str" + _outsideTime,"String_Node_Str" + outsideNextIterationTime,"String_Node_Str" + localTime);
    }
    if (outsideNextIterationTime.compareTo(_outsideTime) < 0) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str" + _outsideTime + "String_Node_Str"+ outsideNextIterationTime);
    }
    if (_outsideTime.compareTo(localTime) > 0) {
      throw new IllegalActionException(this,executiveDirector,"String_Node_Str" + "String_Node_Str");
    }
 else     if (_outsideTime.compareTo(localTime) < 0) {
      if (_debugging) {
        _debug(getName() + "String_Node_Str" + localTime+ "String_Node_Str"+ _knownGoodTime+ "String_Node_Str"+ _outsideTime);
      }
      _rollback();
      _catchUp();
      if (_debugging) {
        _debug("String_Node_Str" + localTime);
      }
    }
    if (_debugging) {
      _debug("String_Node_Str" + "String_Node_Str");
    }
    double aheadLength=outsideNextIterationTime.subtract(_outsideTime).getDoubleValue();
    if (_debugging) {
      _debug(getName(),"String_Node_Str" + localTime,"String_Node_Str" + _outsideTime,"String_Node_Str" + outsideNextIterationTime + "String_Node_Str"+ aheadLength);
    }
    if (aheadLength < timeResolution) {
      _setIterationEndTime(_outsideTime);
      if (_debugging) {
        _debug("String_Node_Str");
      }
    }
 else     if (aheadLength < _runAheadLength) {
      _setIterationEndTime(outsideNextIterationTime);
    }
 else {
      _setIterationEndTime(_outsideTime.add(_runAheadLength));
    }
    if (_debugging) {
      _debug(getName(),"String_Node_Str" + getIterationEndTime(),"String_Node_Str");
    }
    return true;
  }
 else {
    return super.prefire();
  }
}

Fixed version (ground truth):
/** 
 * Always returns true, indicating that the (sub)system is always ready for one iteration. <P> If this is not a top-level director, some additional work is done to synchronize time with the executive director. In particular, it will compare its local time, say t, with the current time of the executive director, say t0. If t == t0, do nothing. <BR> If t > t0, then rollback to the "known good" time (which should be less than the outside time) and catch up with the outside time. <BR> If t < t0, then throw an exception because the CT subsystem should always run ahead of time. <BR> <P> If this director is not a top-level director, the iteration end time is resolved from the current time of the outside domains, say t1, the next iteration time of the outside domain, say t2, and the runAheadLength parameter of this director, say t3. The iteration end time is set to be <code>t5 = t1 + min(t2, t3)</code>.  The iteration end time may be further refined in the fire() method  due to possible event generated during the iteration.  In particular, when the first event is detected, say at t5 and t5 < t4, then the iteration ends at t5.
 * @return true Always.
 * @exception IllegalActionException If the local time isless than the current time of the executive director, or thrown by a directed actor.
 */
public boolean prefire() throws IllegalActionException {
  if (_debugging) {
    _debug(getName(),"String_Node_Str");
  }
  if (!_isTopLevel()) {
    CompositeActor container=(CompositeActor)getContainer();
    Director executiveDirector=container.getExecutiveDirector();
    _outsideTime=executiveDirector.getModelTime();
    Time localTime=getModelTime();
    double timeResolution=getTimeResolution();
    Time outsideNextIterationTime=executiveDirector.getModelNextIterationTime();
    if (_debugging) {
      _debug("String_Node_Str" + _outsideTime,"String_Node_Str" + outsideNextIterationTime,"String_Node_Str" + localTime);
    }
    if (outsideNextIterationTime.compareTo(_outsideTime) < 0) {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str" + _outsideTime + "String_Node_Str"+ outsideNextIterationTime);
    }
    if (_outsideTime.compareTo(localTime) > 0) {
      throw new IllegalActionException(this,executiveDirector,"String_Node_Str" + "String_Node_Str");
    }
 else     if (_outsideTime.compareTo(localTime) < 0) {
      if (_debugging) {
        _debug(getName() + "String_Node_Str" + localTime+ "String_Node_Str"+ _knownGoodTime+ "String_Node_Str"+ _outsideTime);
      }
      _rollback();
      _catchUp();
      if (_debugging) {
        _debug("String_Node_Str" + localTime);
      }
    }
    if (_debugging) {
      _debug("String_Node_Str" + "String_Node_Str");
    }
    _setIterationBeginTime(getModelTime());
    double aheadLength=outsideNextIterationTime.subtract(_outsideTime).getDoubleValue();
    if (_debugging) {
      _debug(getName(),"String_Node_Str" + localTime,"String_Node_Str" + _outsideTime,"String_Node_Str" + outsideNextIterationTime + "String_Node_Str"+ aheadLength);
    }
    if (aheadLength < timeResolution) {
      _setIterationEndTime(_outsideTime);
      if (_debugging) {
        _debug("String_Node_Str");
      }
    }
 else     if (aheadLength < _runAheadLength) {
      _setIterationEndTime(outsideNextIterationTime);
    }
 else {
      _setIterationEndTime(_outsideTime.add(_runAheadLength));
    }
    if (_debugging) {
      _debug(getName(),"String_Node_Str" + getIterationEndTime(),"String_Node_Str");
    }
    return true;
  }
 else {
    return super.prefire();
  }
}