Program: 72764
Project: 72764
Buggy source:
/** 
 * Detect whether the current input compared to the input on the last iteration indicates that a level crossing in the appropriate direction has occurred, if the time is within <i>errorTolerance</i> of the time at which the crossing occurs. If there is such a level crossing, then postfire will request a refiring at the current time, and the next invocation of fire() will produce the output event.
 * @exception IllegalActionException If it cannot get a token from the triggerport or cannot send a token through the output port.
 */
public void fire() throws IllegalActionException {
  ContinuousDirector dir=(ContinuousDirector)getDirector();
  double currentStepSize=dir.getCurrentStepSize();
  int microstep=dir.getIndex();
  _postponedOutputProduced=false;
  if (_debugging) {
    _debug("String_Node_Str" + dir.getModelTime() + "String_Node_Str"+ microstep+ "String_Node_Str"+ currentStepSize);
  }
  if (_postponed > 0 && _postponed == microstep) {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    output.send(0,value.getToken());
    _postponedOutputProduced=true;
  }
 else {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    output.sendClear(0);
  }
  if (trigger.getWidth() > 0 && trigger.isKnown(0) && trigger.hasToken(0)) {
    _thisTrigger=((DoubleToken)trigger.get(0)).doubleValue();
    if (_debugging) {
      _debug("String_Node_Str" + _thisTrigger);
      _debug("String_Node_Str" + _lastTrigger);
    }
    if (_lastTrigger == Double.NEGATIVE_INFINITY) {
      return;
    }
    boolean inputIsIncreasing=_thisTrigger > _lastTrigger;
    boolean inputIsDecreasing=_thisTrigger < _lastTrigger;
    if ((_lastTrigger - _level) * (_thisTrigger - _level) < 0.0 || _thisTrigger == _level) {
      if (_detectFallingCrossing && inputIsDecreasing || _detectRisingCrossing && inputIsIncreasing) {
        if (currentStepSize != 0.0 && Math.abs(_thisTrigger - _level) >= _errorTolerance) {
          if (_debugging) {
            _debug("String_Node_Str");
          }
          _eventMissed=true;
        }
 else {
          _postponed=microstep + 1;
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Detect whether the current input compared to the input on the last iteration indicates that a level crossing in the appropriate direction has occurred, if the time is within <i>errorTolerance</i> of the time at which the crossing occurs. If there is such a level crossing, then postfire will request a refiring at the current time, and the next invocation of fire() will produce the output event.
 * @exception IllegalActionException If it cannot get a token from the triggerport or cannot send a token through the output port.
 */
public void fire() throws IllegalActionException {
  ContinuousDirector dir=(ContinuousDirector)getDirector();
  double currentStepSize=dir.getCurrentStepSize();
  int microstep=dir.getIndex();
  _postponedOutputProduced=false;
  if (_debugging) {
    _debug("String_Node_Str" + dir.getModelTime() + "String_Node_Str"+ microstep+ "String_Node_Str"+ currentStepSize);
  }
  if (_postponed > 0 && _postponed <= microstep) {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    output.send(0,value.getToken());
    _postponedOutputProduced=true;
  }
 else {
    if (_debugging) {
      _debug("String_Node_Str");
    }
    output.sendClear(0);
  }
  if (trigger.getWidth() > 0 && trigger.isKnown(0) && trigger.hasToken(0)) {
    _thisTrigger=((DoubleToken)trigger.get(0)).doubleValue();
    if (_debugging) {
      _debug("String_Node_Str" + _thisTrigger);
      _debug("String_Node_Str" + _lastTrigger);
    }
    if (_lastTrigger == Double.NEGATIVE_INFINITY) {
      return;
    }
    boolean inputIsIncreasing=_thisTrigger > _lastTrigger;
    boolean inputIsDecreasing=_thisTrigger < _lastTrigger;
    if ((_lastTrigger - _level) * (_thisTrigger - _level) < 0.0 || _thisTrigger == _level) {
      if (_detectFallingCrossing && inputIsDecreasing || _detectRisingCrossing && inputIsIncreasing) {
        if (currentStepSize != 0.0 && Math.abs(_thisTrigger - _level) >= _errorTolerance) {
          if (_debugging) {
            _debug("String_Node_Str");
          }
          _eventMissed=true;
        }
 else {
          _postponed=microstep + 1;
        }
      }
    }
  }
}