Program: 73812
Project: 73812
Buggy source:
/** 
 * For all events in the sensorEventQueue, transfer input events that are ready. For all events that are currently sitting at the input port, if the realTimeDelay is 0.0, then transfer them into the platform, otherwise move them into the sensorEventQueue and call fireAt() of the executive director. In either case, if the input port is a networkPort, we make sure the timestamp of the data token transmitted is set to the timestamp of the local event associated with this token.
 * @exception IllegalActionException If the port is not an opaqueinput port.
 * @param port The port to transfer tokens from.
 * @return True if at least one data token is transferred.
 */
protected boolean _transferInputs(IOPort port) throws IllegalActionException {
  if (!port.isInput() || !port.isOpaque()) {
    throw new IllegalActionException(this,port,"String_Node_Str" + "String_Node_Str");
  }
  if (port instanceof RefinementPort) {
    return super._transferInputs(port);
  }
  boolean result=false;
  Time physicalTime=getPhysicalTime();
  while (true) {
    if (_realTimeInputEventQueue.isEmpty()) {
      break;
    }
    RealTimeEvent realTimeEvent=(RealTimeEvent)_realTimeInputEventQueue.peek();
    int compare=realTimeEvent.deliveryTime.compareTo(physicalTime);
    if (compare > 0) {
      break;
    }
 else     if (compare == 0) {
      Parameter parameter=(Parameter)((NamedObj)realTimeEvent.port).getAttribute("String_Node_Str");
      double realTimeDelay=0.0;
      if (parameter != null) {
        realTimeDelay=((DoubleToken)parameter.getToken()).doubleValue();
      }
 else {
        throw new IllegalActionException("String_Node_Str");
      }
      Time lastModelTime=_currentTime;
      if (_isNetworkPort(realTimeEvent.port)) {
        _realTimeInputEventQueue.poll();
        realTimeEvent.port.sendInside(realTimeEvent.channel,realTimeEvent.token);
      }
 else {
        int lastMicrostep=_microstep;
        setTag(realTimeEvent.deliveryTime.subtract(realTimeDelay),0);
        _realTimeInputEventQueue.poll();
        realTimeEvent.port.sendInside(realTimeEvent.channel,realTimeEvent.token);
        setTag(lastModelTime,lastMicrostep);
      }
      if (_debugging) {
        _debug(getName(),"String_Node_Str" + realTimeEvent.port.getName());
      }
      result=true;
    }
 else {
      throw new IllegalActionException(realTimeEvent.port,"String_Node_Str" + "String_Node_Str" + realTimeEvent.deliveryTime + "String_Node_Str"+ physicalTime);
    }
  }
  if (_isNetworkPort(port)) {
    while (true) {
      if (!super._transferInputs(port)) {
        break;
      }
 else {
        result=true;
      }
    }
  }
  Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
  double realTimeDelay=0.0;
  if (parameter != null) {
    realTimeDelay=((DoubleToken)parameter.getToken()).doubleValue();
  }
  if (realTimeDelay == 0.0) {
    Time lastModelTime=_currentTime;
    setTag(physicalTime,0);
    result=result || super._transferInputs(port);
    setTag(lastModelTime,0);
  }
 else {
    for (int i=0; i < port.getWidth(); i++) {
      try {
        if (i < port.getWidthInside()) {
          if (port.hasToken(i)) {
            Token t=port.get(i);
            Time waitUntilTime=physicalTime.add(realTimeDelay);
            RealTimeEvent realTimeEvent=new RealTimeEvent(port,i,t,waitUntilTime);
            _realTimeInputEventQueue.add(realTimeEvent);
            result=true;
            Actor container=(Actor)getContainer();
            container.getExecutiveDirector().fireAt((Actor)container,waitUntilTime);
          }
        }
      }
 catch (      NoTokenException ex) {
        throw new InternalErrorException(this,ex,null);
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * For all events in the sensorEventQueue, transfer input events that are ready. For all events that are currently sitting at the input port, if the realTimeDelay is 0.0, then transfer them into the platform, otherwise move them into the sensorEventQueue and call fireAt() of the executive director. In either case, if the input port is a networkPort, we make sure the timestamp of the data token transmitted is set to the timestamp of the local event associated with this token.
 * @exception IllegalActionException If the port is not an opaqueinput port.
 * @param port The port to transfer tokens from.
 * @return True if at least one data token is transferred.
 */
protected boolean _transferInputs(IOPort port) throws IllegalActionException {
  if (!port.isInput() || !port.isOpaque()) {
    throw new IllegalActionException(this,port,"String_Node_Str" + "String_Node_Str");
  }
  if (port instanceof RefinementPort) {
    return super._transferInputs(port);
  }
  boolean result=false;
  Tag physicalTag=getPhysicalTag();
  while (true) {
    if (_realTimeInputEventQueue.isEmpty()) {
      break;
    }
    RealTimeEvent realTimeEvent=(RealTimeEvent)_realTimeInputEventQueue.peek();
    int compare=realTimeEvent.deliveryTag.compareTo(physicalTag);
    if (compare > 0) {
      break;
    }
 else     if (compare == 0) {
      Parameter parameter=(Parameter)((NamedObj)realTimeEvent.port).getAttribute("String_Node_Str");
      double realTimeDelay=0.0;
      if (parameter != null) {
        realTimeDelay=((DoubleToken)parameter.getToken()).doubleValue();
      }
 else {
        throw new IllegalActionException("String_Node_Str");
      }
      Time lastModelTime=_currentTime;
      if (_isNetworkPort(realTimeEvent.port)) {
        _realTimeInputEventQueue.poll();
        realTimeEvent.port.sendInside(realTimeEvent.channel,realTimeEvent.token);
      }
 else {
        int lastMicrostep=_microstep;
        setTag(realTimeEvent.deliveryTag.timestamp.subtract(realTimeDelay),realTimeEvent.deliveryTag.microstep);
        _realTimeInputEventQueue.poll();
        realTimeEvent.port.sendInside(realTimeEvent.channel,realTimeEvent.token);
        setTag(lastModelTime,lastMicrostep);
      }
      if (_debugging) {
        _debug(getName(),"String_Node_Str" + realTimeEvent.port.getName());
      }
      result=true;
    }
 else {
      throw new IllegalActionException(realTimeEvent.port,"String_Node_Str" + "String_Node_Str" + realTimeEvent.deliveryTag.timestamp + "String_Node_Str"+ realTimeEvent.deliveryTag.microstep+ "String_Node_Str"+ physicalTag.timestamp+ "String_Node_Str"+ physicalTag.microstep);
    }
  }
  if (_isNetworkPort(port)) {
    while (true) {
      if (!super._transferInputs(port)) {
        break;
      }
 else {
        result=true;
      }
    }
  }
  Parameter parameter=(Parameter)((NamedObj)port).getAttribute("String_Node_Str");
  double realTimeDelay=0.0;
  if (parameter != null) {
    realTimeDelay=((DoubleToken)parameter.getToken()).doubleValue();
  }
  if (realTimeDelay == 0.0) {
    Time lastModelTime=_currentTime;
    int lastMicrostep=_microstep;
    setTag(physicalTag.timestamp,physicalTag.microstep);
    result=result || super._transferInputs(port);
    setTag(lastModelTime,lastMicrostep);
  }
 else {
    for (int i=0; i < port.getWidth(); i++) {
      try {
        if (i < port.getWidthInside()) {
          if (port.hasToken(i)) {
            Token t=port.get(i);
            Time waitUntilTime=physicalTag.timestamp.add(realTimeDelay);
            RealTimeEvent realTimeEvent=new RealTimeEvent(port,i,t,new Tag(waitUntilTime,physicalTag.microstep));
            _realTimeInputEventQueue.add(realTimeEvent);
            result=true;
            Actor container=(Actor)getContainer();
            container.getExecutiveDirector().fireAt((Actor)container,waitUntilTime);
          }
        }
      }
 catch (      NoTokenException ex) {
        throw new InternalErrorException(this,ex,null);
      }
    }
  }
  return result;
}