Program: 75267
Project: 75267
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;
    }
    _tentativeCycleStartTime=Utilities.round(_tentativeCycleStartTime,getDirector().getTimeResolution());
    if (currentTime == _tentativeCycleStartTime + _offsets[_tentativePhase]) {
      _tentativeCurrentValue=_getValue(_tentativePhase);
      _tentativePhase++;
      if (_tentativePhase >= _offsets.length) {
        _tentativePhase=0;
        _tentativeCycleStartTime+=periodValue;
        _tentativeCycleStartTime=Utilities.round(_tentativeCycleStartTime,getDirector().getTimeResolution());
        _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);
      }
      _tentativeNextFiringTime=_tentativeCycleStartTime + _offsets[_tentativePhase];
      _tentativeNextFiringTime=Utilities.round(_tentativeNextFiringTime,getDirector().getTimeResolution());
      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;
    }
    _tentativeCycleStartTime=Utilities.round(_tentativeCycleStartTime,getDirector().getTimeResolution());
    double currentPhaseTime=_tentativeCycleStartTime + _offsets[_tentativePhase];
    currentPhaseTime=Utilities.round(currentPhaseTime,getDirector().getTimeResolution());
    if (currentTime == currentPhaseTime) {
      _tentativeCurrentValue=_getValue(_tentativePhase);
      _tentativePhase++;
      if (_tentativePhase >= _offsets.length) {
        _tentativePhase=0;
        _tentativeCycleStartTime+=periodValue;
        _tentativeCycleStartTime=Utilities.round(_tentativeCycleStartTime,getDirector().getTimeResolution());
        _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);
      }
      _tentativeNextFiringTime=_tentativeCycleStartTime + _offsets[_tentativePhase];
      _tentativeNextFiringTime=Utilities.round(_tentativeNextFiringTime,getDirector().getTimeResolution());
      if (_debugging) {
        _debug("String_Node_Str" + _tentativeNextFiringTime);
      }
      int cycleLimit=((IntToken)numberOfCycles.getToken()).intValue();
      double stopTime=Utilities.round(_tentativeStartTime + cycleLimit * periodValue,getDirector().getTimeResolution());
      if (cycleLimit > 0 && currentTime >= _tentativeStartTime + cycleLimit * periodValue) {
        _tentativeCurrentValue=_tentativeCurrentValue.zero();
      }
      output.send(0,_tentativeCurrentValue);
      if (_debugging)       _debug("String_Node_Str" + _tentativeCurrentValue + "String_Node_Str");
    }
  }
}