Program: 74322
Project: 74322
Buggy source:
/** 
 * Return next event that can be fired out of a list of events that are safe to fire. This execution strategy is non preemptive, so it returns falls if the list of actorsFiring is not empty, i.e. an actor is in execution or if no event can be fired now. This is the case if - the list of eventsToFire is empty - the next event that should be fired has to be fired at real time = model time and real time is not there yet - the next event that could be fired has a wcet > next real time event.
 * @param actorsFiring Actors currently in execution.
 * @param eventsToFire Events that are safe to fire.
 * @param nextRealTimeEvent Smallest time stamp of events that have to be fired at model time = real time.
 * @param physicalTime Current physical time of the model.
 * @return The next event that can be fired.
 * @exception IllegalActionException Thrown if an execution was missed.
 */
public TimedEvent getNextEventToFire(Queue<TimedEvent> actorsFiring,List<TimedEvent> eventsToFire,Time nextRealTimeEvent,Time physicalTime) throws IllegalActionException {
  Collections.sort(eventsToFire,new WCETComparator(physicalTime));
  TimedEvent event;
  int index=0;
  while (index < eventsToFire.size()) {
    event=eventsToFire.get(index);
    Actor actorToFire=event.contents instanceof IOPort ? (Actor)((IOPort)event.contents).getContainer() : (Actor)event.contents;
    if (PtidesActorProperties.mustBeFiredAtRealTime(event.contents)) {
      if (physicalTime.compareTo(event.timeStamp) > 0) {
        _displaySchedule(actorToFire,event.timeStamp.getDoubleValue(),ScheduleEventType.MISSEDEXECUTION);
        throw new IllegalActionException("String_Node_Str");
      }
 else       if (physicalTime.compareTo(event.timeStamp) < 0) {
        index++;
        continue;
      }
    }
 else     if (physicalTime.add(PtidesActorProperties.getWCET(actorToFire)).compareTo(nextRealTimeEvent) > 0) {
      index++;
      continue;
    }
    if (!((PtidesActorProperties.isSensor(actorToFire) || PtidesActorProperties.isActuator(actorToFire)) && PtidesActorProperties.getWCET(actorToFire) == 0.0) && actorsFiring.size() > 0 || eventsToFire.size() == 0) {
      return null;
    }
    return new TimedEvent(event.timeStamp,actorToFire);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return next event that can be fired out of a list of events that are safe to fire. This execution strategy is non preemptive, so it returns falls if the list of actorsFiring is not empty, i.e. an actor is in execution or if no event can be fired now. This is the case if - the list of eventsToFire is empty - the next event that should be fired has to be fired at real time = model time and real time is not there yet - the next event that could be fired has a wcet > next real time event.
 * @param actorsFiring Actors currently in execution.
 * @param eventsToFire Events that are safe to fire.
 * @param nextRealTimeEvent Smallest time stamp of events that have to be fired at model time = real time.
 * @param physicalTime Current physical time of the model.
 * @return The next event that can be fired.
 * @exception IllegalActionException Thrown if an execution was missed.
 */
public TimedEvent getNextEventToFire(Queue<TimedEvent> actorsFiring,List<TimedEvent> eventsToFire,Time nextRealTimeEvent,Time physicalTime) throws IllegalActionException {
  Collections.sort(eventsToFire,new WCETComparator(physicalTime));
  TimedEvent event;
  int index=0;
  while (index < eventsToFire.size()) {
    event=eventsToFire.get(index);
    Actor actorToFire=event.contents instanceof IOPort ? (Actor)((IOPort)event.contents).getContainer() : (Actor)event.contents;
    if (PtidesActorProperties.mustBeFiredAtRealTime(event.contents)) {
      if (physicalTime.compareTo(event.timeStamp) > 0) {
        _displaySchedule(actorToFire,event.timeStamp.getDoubleValue(),ScheduleEventType.MISSEDEXECUTION);
        throw new IllegalActionException("String_Node_Str");
      }
 else       if (physicalTime.compareTo(event.timeStamp) < 0) {
        index++;
        continue;
      }
    }
 else     if (physicalTime.add(PtidesActorProperties.getWCET(actorToFire)).compareTo(nextRealTimeEvent) > 0) {
      index++;
      continue;
    }
    if (!((PtidesActorProperties.isSensor(actorToFire) || PtidesActorProperties.isActuator(actorToFire)) && PtidesActorProperties.getWCET(actorToFire) == 0.0) && actorsFiring.size() > 0 || eventsToFire.size() == 0) {
      return null;
    }
    eventsToFire.remove(event);
    return new TimedEvent(event.timeStamp,actorToFire);
  }
  return null;
}