Program: 74188
Project: 74188
Buggy source:
/** 
 * Get the list of events that are safe to fire. Those events contain pure events and triggered events.
 * @return List of events that can be fired next.
 */
private List<TimedEvent> _getNextEventsToFire() throws IllegalActionException {
  List<TimedEvent> events=new LinkedList<TimedEvent>();
  for (  Actor actor : _eventQueues.keySet()) {
    TreeSet<Time> set=_eventQueues.get(actor);
    for (    TimedEvent event : _eventsInExecution) {
      if (event.contents == actor)       continue;
    }
    if (!set.isEmpty()) {
      Time time=set.first();
      _currentModelTime=time;
      if (actor.prefire())       events.add(new TimedEvent(time,actor));
      _currentModelTime=null;
    }
    List<IOPort> inputPorts=actor.inputPortList();
    for (    IOPort port : inputPorts) {
      if (PtidesActorProperties.portIsTriggerPort(port)) {
        Receiver[][] receivers=port.getReceivers();
        for (int i=0; i < receivers.length; i++) {
          Receiver[] recv=receivers[i];
          for (int j=0; j < recv.length; j++) {
            PtidesActorReceiver receiver=(PtidesActorReceiver)recv[j];
            Time time=receiver.getNextTime();
            if (time != null && (_isSafeToProcess(port,port,new ArrayList(),new Time(this,0.0),time))) {
              List<TimedEvent> toRemove=new ArrayList<TimedEvent>();
              for (int k=0; k < events.size(); k++) {
                TimedEvent event=events.get(k);
                if (event.contents == actor && event.timeStamp.equals(time))                 toRemove.add(event);
              }
              for (int k=0; k < toRemove.size(); k++)               events.remove(toRemove.get(k));
              events.add(new TimedEvent(time,port));
            }
          }
        }
      }
    }
  }
  return events;
}

Fixed version (ground truth):
/** 
 * Get the list of events that are safe to fire. Those events contain pure events and triggered events.
 * @return List of events that can be fired next.
 */
private List<TimedEvent> _getNextEventsToFire() throws IllegalActionException {
  List<TimedEvent> events=new LinkedList<TimedEvent>();
  for (  Actor actor : _eventQueues.keySet()) {
    TreeSet<Time> set=_eventQueues.get(actor);
    for (    TimedEvent event : _eventsInExecution) {
      if (event.contents == actor)       continue;
    }
    if (!set.isEmpty()) {
      Time time=set.first();
      _currentModelTime=time;
      if (actor.prefire())       events.add(new TimedEvent(time,actor));
      _currentModelTime=null;
    }
    List<IOPort> inputPorts=actor.inputPortList();
    for (    IOPort port : inputPorts) {
      if (PtidesActorProperties.portIsTriggerPort(port)) {
        Receiver[][] receivers=port.getReceivers();
        for (int i=0; i < receivers.length; i++) {
          Receiver[] recv=receivers[i];
          for (int j=0; j < recv.length; j++) {
            PtidesActorReceiver receiver=(PtidesActorReceiver)recv[j];
            Time time=receiver.getNextTime();
            System.out.println(((Actor)getContainer()).getDirector().getModelTime() + "String_Node_Str" + getModelTime()+ "String_Node_Str"+ time+ "String_Node_Str"+ actor);
            if (time != null && (time.compareTo(((Actor)getContainer()).getDirector().getModelTime()) <= 0 || _allUpstreamEventsHaveHigherTimestamps(port,port,new ArrayList(),new Time(this,0.0),time))) {
              System.out.println(actor);
              List<TimedEvent> toRemove=new ArrayList<TimedEvent>();
              for (int k=0; k < events.size(); k++) {
                TimedEvent event=events.get(k);
                if (event.contents == actor && event.timeStamp.equals(time))                 toRemove.add(event);
              }
              for (int k=0; k < toRemove.size(); k++)               events.remove(toRemove.get(k));
              events.add(new TimedEvent(time,port));
            }
          }
        }
      }
    }
  }
  return events;
}