Program: 76609
Project: 76609
Buggy source:
/** 
 * Invoke the base class prefire() method, and if it returns true, dequeue the next event from the event queue, advance time to its time stamp, and mark its destination actor for firing. If there are multiple events on the queue with the same time stamp that are destined for the same actor, dequeue all of them, making them available in the input ports of the destination actor. If the time stamp is greater than the stop time, or there are no events on the event queue, then return false, which will have the effect of stopping the simulation.
 * @return True if there is an actor to fire.
 * @exception CloneNotSupportedException If the base class throws it.
 * @exception IllegalActionException If the base class throws it.
 * @exception NameDuplicationException If the base class throws it.
 */
public boolean prefire() throws CloneNotSupportedException, IllegalActionException, NameDuplicationException {
  _actorToFire=null;
  if (super.prefire()) {
    DEEvent currentEvent=null;
    FIFOQueue fifo=new FIFOQueue();
    while (true) {
      try {
        currentEvent=(DEEvent)_cQueue.take();
      }
 catch (      IllegalAccessException ex) {
        break;
      }
      if (_actorToFire == null) {
        _actorToFire=currentEvent.actor;
        _currentTime=currentEvent.key.timeStamp();
        if (_currentTime < _startTime)         _startTime=_currentTime;
        if (_currentTime > _stopTime)         return false;
        DEReceiver rec=currentEvent.receiver;
        if (rec != null) {
          rec._triggerEvent(currentEvent.token);
        }
      }
 else {
        if (currentEvent.key.timeStamp() != _currentTime) {
          fifo.put(currentEvent);
          break;
        }
 else {
          if (currentEvent.actor == _actorToFire) {
            DEReceiver rec=currentEvent.receiver;
            if (rec != null) {
              rec._triggerEvent(currentEvent.token);
            }
          }
 else {
            fifo.put(currentEvent);
          }
        }
      }
    }
    while (fifo.size() > 0) {
      DEEvent event=(DEEvent)fifo.take();
      _cQueue.put(event.key,event);
    }
  }
  return _actorToFire != null;
}

Fixed version (ground truth):
/** 
 * Invoke the base class prefire() method, and if it returns true, dequeue the next event from the event queue, advance time to its time stamp, and mark its destination actor for firing. If there are multiple events on the queue with the same time stamp that are destined for the same actor, dequeue all of them, making them available in the input ports of the destination actor. If the time stamp is greater than the stop time, or there are no events on the event queue, then return false, which will have the effect of stopping the simulation.
 * @return True if there is an actor to fire.
 * @exception CloneNotSupportedException If the base class throws it.
 * @exception IllegalActionException If the base class throws it.
 * @exception NameDuplicationException If the base class throws it.
 */
public boolean prefire() throws CloneNotSupportedException, IllegalActionException, NameDuplicationException {
  _actorToFire=null;
  if (super.prefire()) {
    DEEvent currentEvent=null;
    FIFOQueue fifo=new FIFOQueue();
    while (true) {
      try {
        currentEvent=(DEEvent)_cQueue.take();
      }
 catch (      IllegalAccessException ex) {
        break;
      }
      if (_actorToFire == null) {
        _actorToFire=currentEvent.actor;
        _currentTime=currentEvent.key.timeStamp();
        if (_currentTime < _startTime) {
          if (_startTimeInitialized) {
            throw new InternalErrorException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
          }
          _startTime=_currentTime;
          _startTimeInitialized=true;
        }
        if (_currentTime > _stopTime) {
          return false;
        }
        DEReceiver rec=currentEvent.receiver;
        if (rec != null) {
          rec._triggerEvent(currentEvent.token);
        }
      }
 else {
        if (currentEvent.key.timeStamp() != _currentTime) {
          fifo.put(currentEvent);
          break;
        }
 else {
          if (currentEvent.actor == _actorToFire) {
            DEReceiver rec=currentEvent.receiver;
            if (rec != null) {
              rec._triggerEvent(currentEvent.token);
            }
 else {
              throw new InternalErrorException("String_Node_Str" + "String_Node_Str");
            }
          }
 else {
            fifo.put(currentEvent);
          }
        }
      }
    }
    while (fifo.size() > 0) {
      DEEvent event=(DEEvent)fifo.take();
      _cQueue.put(event.key,event);
    }
  }
  return _actorToFire != null;
}