Program: 73229
Project: 73229
Buggy source:
/** 
 * Check whether the event is safe to process. If the platform time has passed the timestamp of the event minus the delayOffset, then no later events arriving at a sensor/network port can reach the input port group of the event with an earlier timestamp, and the event may be safe-to-process. In multicore, an additional check is required since a currently processing event MAY causally affect the event  (the processing event may eventually cause an event to arrive at the  input port group of the event with an earlier timestamp). A subclass may improve this check (make less conservative) by knowing more about operation of actors and/or tokens of events.
 * @param event Event being checked if it is safe-to-process.
 * @return True if the event is safe-to-process, false otherwise.
 * @exception IllegalActionException If can't get delayOffset for a port.
 */
protected boolean _safeToProcess(PtidesEvent event) throws IllegalActionException {
  double delayOffset;
  if (event.isPureEvent()) {
    delayOffset=Double.POSITIVE_INFINITY;
  }
 else {
    delayOffset=_getDelayOffset((TypedIOPort)event.ioPort());
  }
  Time waitUntilPhysicalTime=event.timeStamp().subtract(delayOffset);
  Tag platformPhysicalTag=getPlatformPhysicalTag(platformTimeClock);
  int compare=platformPhysicalTag.timestamp.compareTo(waitUntilPhysicalTime);
  int microstep=platformPhysicalTag.microstep;
  if ((compare < 0) || compare == 0 && (microstep < event.microstep())) {
    if (_nextRunScheduler == null) {
      _nextRunScheduler=waitUntilPhysicalTime;
    }
 else     if (waitUntilPhysicalTime.compareTo(_nextRunScheduler) < 0) {
      _nextRunScheduler=waitUntilPhysicalTime;
    }
    return false;
  }
  for (  Stack<ProcessingPtidesEvents> coreStack : _currentlyProcessingEvents) {
    for (    ProcessingPtidesEvents processingEvents : coreStack) {
      PtidesEvent processingEvent=processingEvents.events.get(0);
      for (      TypedIOPort groupPort : _inputPortGroups.get((TypedIOPort)event.ioPort())) {
        if (_getSuperdenseDependencyPair((TypedIOPort)processingEvent.ioPort(),groupPort,true) != SuperdenseDependency.OPLUS_IDENTITY) {
          return false;
        }
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Check whether the event is safe to process. If the platform time has passed the timestamp of the event minus the delayOffset, then no later events arriving at a sensor/network port can reach the input port group of the event with an earlier timestamp, and the event may be safe-to-process. In multicore, an additional check is required since a currently processing event MAY causally affect the event  (the processing event may eventually cause an event to arrive at the  input port group of the event with an earlier timestamp). A subclass may improve this check (make less conservative) by knowing more about operation of actors and/or tokens of events.
 * @param event Event being checked if it is safe-to-process.
 * @return True if the event is safe-to-process, false otherwise.
 * @exception IllegalActionException If can't get delayOffset for a port.
 */
protected boolean _safeToProcess(PtidesEvent event) throws IllegalActionException {
  double delayOffset;
  if (event.isPureEvent()) {
    delayOffset=Double.POSITIVE_INFINITY;
  }
 else {
    delayOffset=_getDelayOffset((TypedIOPort)event.ioPort());
  }
  Time waitUntilPhysicalTime=event.timeStamp().subtract(delayOffset);
  Tag platformPhysicalTag=getPlatformPhysicalTag(platformTimeClock);
  int compare=platformPhysicalTag.timestamp.compareTo(waitUntilPhysicalTime);
  int microstep=platformPhysicalTag.microstep;
  if ((compare < 0) || compare == 0 && (microstep < event.microstep())) {
    if (_nextRunScheduler == null) {
      _nextRunScheduler=waitUntilPhysicalTime;
    }
 else     if (waitUntilPhysicalTime.compareTo(_nextRunScheduler) < 0) {
      _nextRunScheduler=waitUntilPhysicalTime;
    }
    return false;
  }
  for (  Stack<ProcessingPtidesEvents> coreStack : _currentlyProcessingEvents) {
    for (    ProcessingPtidesEvents processingEvents : coreStack) {
      PtidesEvent processingEvent=processingEvents.events.get(0);
      if (!_dependencyCheck(processingEvent,event)) {
        return false;
      }
    }
  }
  if (!((BooleanToken)considerTriggerPorts.getToken()).booleanValue()) {
    return true;
  }
  List<PtidesEvent> EDF=new ArrayList<PtidesEvent>(_eventQueue.size());
  for (int i=0; i < _eventQueue.size(); i++) {
    EDF.add(((PtidesListEventQueue)_eventQueue).get(i));
  }
  Collections.sort(EDF,new EDFComparator());
  for (  PtidesEvent earlierEvent : EDF) {
    if (earlierEvent.equals(event)) {
      return true;
    }
    if (!_dependencyCheck(earlierEvent,event)) {
      return false;
    }
  }
  return true;
}