Program: 72985
Project: 72985
Buggy source:
/** 
 * Check if event is safe to process.
 * @param event The event to be checked.
 * @return true if the event is safe to process.
 * @exception IllegalActionException If the delayOffset aparametercannot be read.
 */
private boolean _isSafeToProcess(PtidesEvent event) throws IllegalActionException {
  Object[] eventArray=_eventQueue.toArray();
  for (  Object object : eventArray) {
    PtidesEvent ptidesEvent=(PtidesEvent)object;
    if (ptidesEvent.actor() != event.actor() && ptidesEvent.ioPort() != null && event.ioPort() != null) {
      SuperdenseDependency minDelay=_getSuperdenseDependencyPair((TypedIOPort)ptidesEvent.ioPort(),(TypedIOPort)event.ioPort());
      if (event.timeStamp().getDoubleValue() - ptidesEvent.timeStamp().getDoubleValue() >= minDelay.timeValue()) {
        return false;
      }
    }
  }
  ThrottleAttributes attributes=(ThrottleAttributes)((NamedObj)event.actor()).getDecoratorAttributes(this);
  if (attributes != null && ((BooleanToken)attributes.useMaximumFutureEvents.getToken()).booleanValue()) {
    Integer maxFutureEvents=((IntToken)attributes.maximumFutureEvents.getToken()).intValue();
    if (maxFutureEvents != null) {
      int futureEvents=_getNumberOfFutureEventsFrom(event.actor());
      return (futureEvents <= maxFutureEvents);
    }
  }
  Double delayOffset=null;
  Time eventTimestamp=event.timeStamp();
  IOPort port=event.ioPort();
  if (port != null) {
    Actor actor=(Actor)port.getContainer();
    for (    Object ioPort : actor.inputPortList()) {
      Double ioPortDelayOffset=_getDoubleParameterValue((NamedObj)ioPort,"String_Node_Str");
      if (ioPortDelayOffset != null && (delayOffset == null || ioPortDelayOffset < delayOffset)) {
        delayOffset=ioPortDelayOffset;
      }
    }
  }
 else {
    attributes=(ThrottleAttributes)((NamedObj)event.actor()).getDecoratorAttributes(this);
    if (((BooleanToken)attributes.useMaximumFutureFiringTime.getToken()).booleanValue()) {
      delayOffset=Double.valueOf(((DoubleToken)attributes.maximumFutureFiringTime.getToken()).doubleValue());
    }
  }
  if (delayOffset == null || localClock.getLocalTime().compareTo(eventTimestamp.subtract(delayOffset).subtract(_clockSynchronizationErrorBound)) >= 0) {
    return true;
  }
  _setNextFireTime(eventTimestamp.subtract(delayOffset));
  return false;
}

Fixed version (ground truth):
/** 
 * Check if event is safe to process.
 * @param event The event to be checked.
 * @return true if the event is safe to process.
 * @exception IllegalActionException If the delayOffset aparametercannot be read.
 */
private boolean _isSafeToProcess(PtidesEvent event) throws IllegalActionException {
  Object[] eventArray=_eventQueue.toArray();
  for (  Object object : eventArray) {
    PtidesEvent ptidesEvent=(PtidesEvent)object;
    if (ptidesEvent.actor() != event.actor() && ptidesEvent.ioPort() != null && event.ioPort() != null) {
      SuperdenseDependency minDelay=_getSuperdenseDependencyPair((TypedIOPort)ptidesEvent.ioPort(),(TypedIOPort)event.ioPort());
      if (event.timeStamp().getDoubleValue() - ptidesEvent.timeStamp().getDoubleValue() >= minDelay.timeValue()) {
        return false;
      }
    }
  }
  ThrottleAttributes attributes=(ThrottleAttributes)((NamedObj)event.actor()).getDecoratorAttributes(this);
  if (attributes != null && ((BooleanToken)attributes.useMaximumFutureEvents.getToken()).booleanValue()) {
    Integer maxFutureEvents=((IntToken)attributes.maximumFutureEvents.getToken()).intValue();
    if (maxFutureEvents != null) {
      int futureEvents=_getNumberOfFutureEventsFrom(event.actor());
      return (futureEvents <= maxFutureEvents);
    }
  }
  Double delayOffset=null;
  Time eventTimestamp=event.timeStamp();
  IOPort port=event.ioPort();
  if (port != null) {
    Actor actor=(Actor)port.getContainer();
    for (    Object ioPort : actor.inputPortList()) {
      Double ioPortDelayOffset=_getDoubleParameterValue((NamedObj)ioPort,"String_Node_Str");
      if (ioPortDelayOffset != null && (delayOffset == null || ioPortDelayOffset < delayOffset)) {
        delayOffset=ioPortDelayOffset;
      }
    }
  }
 else {
    attributes=(ThrottleAttributes)((NamedObj)event.actor()).getDecoratorAttributes(this);
    if (attributes != null && ((BooleanToken)attributes.useMaximumFutureFiringTime.getToken()).booleanValue()) {
      delayOffset=Double.valueOf(((DoubleToken)attributes.maximumFutureFiringTime.getToken()).doubleValue());
    }
  }
  if (delayOffset == null || localClock.getLocalTime().compareTo(eventTimestamp.subtract(delayOffset).subtract(_clockSynchronizationErrorBound)) >= 0) {
    return true;
  }
  _setNextFireTime(eventTimestamp.subtract(delayOffset));
  return false;
}