Program: 72789
Project: 72789
Buggy source:
/** 
 * Return the refined step size, which is the minimum of the current step size and the suggested step size of all actors that implement ContinuousStepSizeController and that also ensures that we do not pass a breakpoint. If these actors request a step size smaller than the time resolution, then the first time this happens this method returns the time resolution. If it happens again on the next call to this method, then this method throws an exception.
 * @return The refined step size.
 * @exception IllegalActionException If the scheduler throws it or therefined step size is less than the time resolution.
 */
public double refinedStepSize() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str" + _currentStepSize);
  }
  double timeResolution=getTimeResolution();
  double refinedStep=_currentStepSize;
  Iterator stepSizeControlActors=_stepSizeControllers().iterator();
  while (stepSizeControlActors.hasNext() && !_stopRequested) {
    ContinuousStepSizeController actor=(ContinuousStepSizeController)stepSizeControlActors.next();
    refinedStep=Math.min(refinedStep,actor.refinedStepSize());
  }
  if (refinedStep < timeResolution) {
    if (!_triedTheMinimumStepSize) {
      refinedStep=timeResolution;
      _triedTheMinimumStepSize=true;
    }
 else {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + getModelTime());
    }
  }
 else {
    _triedTheMinimumStepSize=false;
  }
  if (_debugging) {
    _debug("String_Node_Str" + refinedStep);
  }
  if (!_breakpoints.isEmpty()) {
    SuperdenseTime nextBreakpoint=(SuperdenseTime)_breakpoints.first();
    Time nextBreakpointTime=nextBreakpoint.timestamp();
    int comparison=nextBreakpointTime.compareTo(_iterationBeginTime.add(refinedStep));
    if (comparison < 0) {
      refinedStep=nextBreakpointTime.subtract(_iterationBeginTime).getDoubleValue();
      if (refinedStep < 0.0) {
        throw new IllegalActionException(this,"String_Node_Str" + nextBreakpoint);
      }
      if (_debugging) {
        _debug("String_Node_Str" + refinedStep);
      }
    }
  }
  return refinedStep;
}

Fixed version (ground truth):
/** 
 * Return the refined step size, which is the minimum of the current step size and the suggested step size of all actors that implement ContinuousStepSizeController and that also ensures that we do not pass a breakpoint. If these actors request a step size smaller than the time resolution, then the first time this happens this method returns the time resolution. If it happens again on the next call to this method, then this method throws an exception.
 * @return The refined step size.
 * @exception IllegalActionException If the scheduler throws it or therefined step size is less than the time resolution.
 */
public double refinedStepSize() throws IllegalActionException {
  if (_debugging) {
    _debug("String_Node_Str" + _currentStepSize);
  }
  double timeResolution=getTimeResolution();
  double refinedStep=_currentStepSize;
  Iterator stepSizeControlActors=_stepSizeControllers().iterator();
  while (stepSizeControlActors.hasNext() && !_stopRequested) {
    ContinuousStepSizeController actor=(ContinuousStepSizeController)stepSizeControlActors.next();
    refinedStep=Math.min(refinedStep,actor.refinedStepSize());
  }
  if (refinedStep < timeResolution) {
    if (!_triedTheMinimumStepSize) {
      refinedStep=timeResolution;
      _triedTheMinimumStepSize=true;
    }
 else {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + getModelTime());
    }
  }
 else {
    _triedTheMinimumStepSize=false;
  }
  if (_debugging) {
    _debug("String_Node_Str" + refinedStep);
  }
  if (refinedStep >= _currentStepSize) {
    refinedStep=_currentStepSize * 0.5;
    if (_debugging) {
      _debug("String_Node_Str" + refinedStep);
    }
  }
  if (!_breakpoints.isEmpty()) {
    SuperdenseTime nextBreakpoint=(SuperdenseTime)_breakpoints.first();
    Time nextBreakpointTime=nextBreakpoint.timestamp();
    int comparison=nextBreakpointTime.compareTo(_iterationBeginTime.add(refinedStep));
    if (comparison < 0) {
      refinedStep=nextBreakpointTime.subtract(_iterationBeginTime).getDoubleValue();
      if (refinedStep < 0.0) {
        throw new IllegalActionException(this,"String_Node_Str" + nextBreakpoint);
      }
      if (_debugging) {
        _debug("String_Node_Str" + refinedStep);
      }
    }
  }
  return refinedStep;
}