Program: 75151
Project: 75151
Buggy source:
/** 
 * Advance the current model tag to that of the earliest event in the event queue, and fire all actors that have requested or are triggered to be fired at the current tag. If <i>synchronizeToRealTime</i> is true, then before firing, wait until real time matches or exceeds the timestamp of the event. Note that the default unit for time is seconds. <p> Each actor is iterated repeatedly (prefire(), fire(), postfire()), until either it has no more input tokens, or its prefire() method returns false. <p> If there are no events in the event queue, then the behavior depends on the <i>stopWhenQueueIsEmpty</i> parameter. If it is false, then this thread will stall until events become available in the event queue. Otherwise, time will advance to the stop time and the execution will halt.
 * @exception IllegalActionException If the firing actor throws it, orevent queue is not ready, or an event is missed, or time is set backwards.
 */
public void fire() throws IllegalActionException {
  _mutationEnabled=false;
  while (true) {
    Actor actorToFire=_getNextActorToFire();
    if (actorToFire == null) {
      if (_isTopLevel()) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        _noMoreActorsToFire=true;
      }
 else {
        if (_debugging) {
          _debug("String_Node_Str" + "String_Node_Str");
        }
      }
      _microstep=0;
      return;
    }
    if (_debugging) {
      _debug("String_Node_Str" + getModelTime() + "String_Node_Str"+ _microstep);
    }
    if (actorToFire == getContainer()) {
      return;
    }
    boolean refire;
    do {
      refire=false;
      if (_debugging) {
        if (((Nameable)actorToFire).getContainer() == null) {
          _debug("String_Node_Str");
          _disableActor(actorToFire);
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_PREFIRE));
        if (!actorToFire.prefire()) {
          _debug("String_Node_Str");
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_PREFIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_FIRE));
        actorToFire.fire();
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_FIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_POSTFIRE));
        if (!actorToFire.postfire()) {
          _debug("String_Node_Str",((Nameable)actorToFire).getName());
          _disableActor(actorToFire);
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_POSTFIRE));
      }
 else {
        if (((Nameable)actorToFire).getContainer() == null) {
          _disableActor(actorToFire);
          break;
        }
        if (!actorToFire.prefire()) {
          break;
        }
        actorToFire.fire();
        if (!actorToFire.postfire()) {
          _disableActor(actorToFire);
          break;
        }
      }
      Iterator inputPorts=actorToFire.inputPortList().iterator();
      while (inputPorts.hasNext() && !refire) {
        IOPort port=(IOPort)inputPorts.next();
        for (int i=0; i < port.getWidth(); i++) {
          if (port.hasToken(i)) {
            refire=true;
            break;
          }
        }
      }
    }
 while (refire);
synchronized (_eventQueue) {
      if (!_eventQueue.isEmpty()) {
        DEEvent next=_eventQueue.get();
        if ((next.timeStamp().compareTo(getModelTime()) > 0) || next.microstep() > _microstep) {
          break;
        }
 else         if ((next.timeStamp().compareTo(getModelTime()) < 0) || next.microstep() < _microstep) {
          throw new IllegalActionException("String_Node_Str" + next.timeStamp() + "String_Node_Str"+ next.microstep()+ "String_Node_Str"+ "String_Node_Str"+ getModelTime()+ "String_Node_Str"+ _microstep+ "String_Node_Str");
        }
 else {
        }
      }
    }
  }
  _mutationEnabled=true;
  _validateSchedule();
  _mutationEnabled=false;
  if (_debugging) {
    _debug("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Advance the current model tag to that of the earliest event in the event queue, and fire all actors that have requested or are triggered to be fired at the current tag. If <i>synchronizeToRealTime</i> is true, then before firing, wait until real time matches or exceeds the timestamp of the event. Note that the default unit for time is seconds. <p> Each actor is iterated repeatedly (prefire(), fire(), postfire()), until either it has no more input tokens, or its prefire() method returns false. <p> If there are no events in the event queue, then the behavior depends on the <i>stopWhenQueueIsEmpty</i> parameter. If it is false, then this thread will stall until events become available in the event queue. Otherwise, time will advance to the stop time and the execution will halt.
 * @exception IllegalActionException If the firing actor throws it, orevent queue is not ready, or an event is missed, or time is set backwards.
 */
public void fire() throws IllegalActionException {
  _mutationEnabled=false;
  while (true) {
    Actor actorToFire=_getNextActorToFire();
    if (actorToFire == null) {
      if (_isTopLevel()) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        _noMoreActorsToFire=true;
      }
 else {
        if (_debugging) {
          _debug("String_Node_Str" + "String_Node_Str");
        }
      }
      return;
    }
    if (actorToFire == getContainer()) {
      return;
    }
    if (_debugging) {
      _debug("String_Node_Str" + getModelTime() + "String_Node_Str"+ _microstep);
    }
    boolean refire;
    do {
      refire=false;
      if (_debugging) {
        if (((Nameable)actorToFire).getContainer() == null) {
          _debug("String_Node_Str");
          _disableActor(actorToFire);
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_PREFIRE));
        if (!actorToFire.prefire()) {
          _debug("String_Node_Str");
          break;
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_PREFIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_FIRE));
        actorToFire.fire();
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_FIRE));
        _debug(new FiringEvent(this,actorToFire,FiringEvent.BEFORE_POSTFIRE));
        if (!actorToFire.postfire()) {
          _debug("String_Node_Str",((Nameable)actorToFire).getName());
          _disableActor(actorToFire);
        }
        _debug(new FiringEvent(this,actorToFire,FiringEvent.AFTER_POSTFIRE));
      }
 else {
        if (((Nameable)actorToFire).getContainer() == null) {
          _disableActor(actorToFire);
          break;
        }
        if (!actorToFire.prefire()) {
          break;
        }
        actorToFire.fire();
        if (!actorToFire.postfire()) {
          _disableActor(actorToFire);
          break;
        }
      }
      Iterator inputPorts=actorToFire.inputPortList().iterator();
      while (inputPorts.hasNext() && !refire) {
        IOPort port=(IOPort)inputPorts.next();
        for (int i=0; i < port.getWidth(); i++) {
          if (port.hasToken(i)) {
            refire=true;
            break;
          }
        }
      }
    }
 while (refire);
synchronized (_eventQueue) {
      if (!_eventQueue.isEmpty()) {
        DEEvent next=_eventQueue.get();
        if ((next.timeStamp().compareTo(getModelTime()) > 0)) {
          _microstep=0;
          break;
        }
 else         if (next.microstep() > _microstep) {
          break;
        }
 else         if ((next.timeStamp().compareTo(getModelTime()) < 0) || next.microstep() < _microstep) {
          throw new IllegalActionException("String_Node_Str" + next.timeStamp() + "String_Node_Str"+ next.microstep()+ "String_Node_Str"+ "String_Node_Str"+ getModelTime()+ "String_Node_Str"+ _microstep+ "String_Node_Str");
        }
 else {
        }
      }
    }
  }
  _mutationEnabled=true;
  _validateSchedule();
  _mutationEnabled=false;
  if (_debugging) {
    _debug("String_Node_Str");
  }
}