Program: 75568
Project: 75568
Buggy source:
/** 
 * Output the current value of the clock.
 * @exception IllegalActionException Ifthe value in the offsets parameter is encountered that is greater than the period, or if there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  double currentTime=getDirector().getCurrentTime();
  double periodValue=((DoubleToken)period.getToken()).doubleValue();
  if (_debugging)   _debug("String_Node_Str" + currentTime + "String_Node_Str");
  _updateTentativeValues();
  _tentativeNextFiringTime=Double.NEGATIVE_INFINITY;
  _tentativeCycleCountIncrement=0;
  if (_tentativeCycleCount > 0) {
    while (_tentativeCycleStartTime + periodValue <= currentTime) {
      _tentativeCycleStartTime+=periodValue;
    }
    if (currentTime >= _tentativeCycleStartTime + _offsets[_tentativePhase]) {
      if (_tPlus) {
        if (_debugging)         _debug("String_Node_Str");
        _tentativeCurrentValue=_getValue(_tentativePhase);
        _tentativePhase++;
        if (_tentativePhase >= _offsets.length) {
          _tentativePhase=0;
          _tentativeCycleStartTime+=periodValue;
          _tentativeCycleCountIncrement++;
        }
        if (_offsets[_tentativePhase] >= periodValue) {
          throw new IllegalActionException(this,"String_Node_Str" + _tentativePhase + "String_Node_Str"+ _offsets[_tentativePhase]+ "String_Node_Str"+ "String_Node_Str"+ periodValue);
        }
        _tMinus=!_tMinus;
        _tPlus=!_tPlus;
      }
 else       if (_tMinus) {
        if (_debugging)         _debug("String_Node_Str");
        _tMinus=!_tMinus;
        _tPlus=!_tPlus;
      }
      _tentativeNextFiringTime=_tentativeCycleStartTime + _offsets[_tentativePhase];
      if (_debugging)       _debug("String_Node_Str" + _tentativeNextFiringTime);
    }
  }
  int cycleLimit=((IntToken)numberOfCycles.getToken()).intValue();
  if (cycleLimit > 0 && currentTime >= _tentativeStartTime + cycleLimit * periodValue) {
    _tentativeCurrentValue=_tentativeCurrentValue.zero();
  }
  output.send(0,_tentativeCurrentValue);
  if (_debugging)   _debug("String_Node_Str" + _tentativeCurrentValue + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Output the current value of the clock.
 * @exception IllegalActionException Ifthe value in the offsets parameter is encountered that is greater than the period, or if there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  double currentTime=getDirector().getCurrentTime();
  double periodValue=((DoubleToken)period.getToken()).doubleValue();
  if (_debugging)   _debug("String_Node_Str" + currentTime + "String_Node_Str");
  _updateTentativeValues();
  _tentativeNextFiringTime=Double.NEGATIVE_INFINITY;
  _tentativeCycleCountIncrement=0;
  if (_tentativeCycleCount > 0) {
    while (_tentativeCycleStartTime + periodValue <= currentTime) {
      _tentativeCycleStartTime+=periodValue;
    }
    if (currentTime + ((CTDirector)getDirector()).getTimeResolution() >= _tentativeCycleStartTime + _offsets[_tentativePhase]) {
      if (_tPlus) {
        if (_debugging)         _debug("String_Node_Str");
        _tentativeCurrentValue=_getValue(_tentativePhase);
        _tentativePhase++;
        if (_tentativePhase >= _offsets.length) {
          _tentativePhase=0;
          _tentativeCycleStartTime+=periodValue;
          _tentativeCycleCountIncrement++;
        }
        if (_offsets[_tentativePhase] >= periodValue) {
          throw new IllegalActionException(this,"String_Node_Str" + _tentativePhase + "String_Node_Str"+ _offsets[_tentativePhase]+ "String_Node_Str"+ "String_Node_Str"+ periodValue);
        }
        _tMinus=!_tMinus;
        _tPlus=!_tPlus;
      }
 else       if (_tMinus) {
        if (_debugging)         _debug("String_Node_Str");
        _tMinus=!_tMinus;
        _tPlus=!_tPlus;
      }
      _tentativeNextFiringTime=_tentativeCycleStartTime + _offsets[_tentativePhase];
      if (_debugging)       _debug("String_Node_Str" + _tentativeNextFiringTime);
    }
  }
  int cycleLimit=((IntToken)numberOfCycles.getToken()).intValue();
  if (cycleLimit > 0 && currentTime >= _tentativeStartTime + cycleLimit * periodValue) {
    _tentativeCurrentValue=_tentativeCurrentValue.zero();
  }
  output.send(0,_tentativeCurrentValue);
  if (_debugging)   _debug("String_Node_Str" + _tentativeCurrentValue + "String_Node_Str");
}