Program: 73524
Project: 73524
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.
 * @param port The port to transfer tokens from.
 * @return True if at least one data token is transferred.
 * @exception IllegalActionException If the port is not an opaqueinput port, if the super class throws it, if physical tag cannot be evaulated, if token cannot be sent to the inside.
 */
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());
      }
      _sensorInterruptOccurred=true;
      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;
}

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.
 * @param port The port to transfer tokens from.
 * @return True if at least one data token is transferred.
 * @exception IllegalActionException If the port is not an opaqueinput port, if the super class throws it, if physical tag cannot be evaulated, if token cannot be sent to the inside, or if there exists no token in the port, but hasToken() return true.
 */
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());
      }
      _sensorInterruptOccurred=true;
      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;
        _sensorInterruptOccurred=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);
    if (super._transferInputs(port)) {
      _sensorInterruptOccurred=true;
      result=true;
    }
    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 IllegalActionException(this,ex,null);
      }
    }
  }
  return result;
}