Program: 74187
Project: 74187
Buggy source:
/** 
 * This method fires all actors that are safe to fire at the current physical time. In a loop, a set of events which are safe to process is selected. Then, one event is chosen that will really be processed. This choice is taken by the PlatformExecutionStrategy. <p> If there is no event selected, this director schedules a refiring for the actor by calling the fireAt() method of the enclosing director. The enclosing director will stall this platform until the model time of the enclosing director which is used as the physical time is equal to the time requested in the fireAt() or if an event was sent to the composite actor governed by this director. <p> If an event was selected, the actor is added to a set of actors in execution. If the actor has a worst case execution time > 0, this director calls the fireAt() method of the enclosing director with the current physical time increased by the WCET. After that time passed, the actor is taken out of the list of actors in execution.
 * @throws IllegalActionException Thrown if an execution was missed.
 */
public void fire() throws IllegalActionException {
  System.out.println("String_Node_Str" + this.getContainer().getName() + "String_Node_Str"+ _currentPhysicalTime);
  List<TimedEvent> eventsToFire=null;
  TimedEvent event=null;
  boolean iterate=true;
  while (iterate) {
    if (_stopRequested)     return;
    _transferAllInputs();
    if (_eventsInExecution.size() > 0) {
      TimedEvent eventInExecution=_eventsInExecution.getFirst();
      Actor actorToFire=(Actor)eventInExecution.contents;
      Time time=getFinishingTime(actorToFire);
      if (time.equals(_currentPhysicalTime)) {
        System.out.println("String_Node_Str" + _currentPhysicalTime + "String_Node_Str"+ _currentTime+ "String_Node_Str"+ actorToFire);
        _eventsInExecution.removeFirst();
        _currentModelTime=eventInExecution.timeStamp;
        if (!_fireAtTheBeginningOfTheWcet(actorToFire))         _fireActorInZeroModelTime(actorToFire);
        _transferAllOutputs();
        displaySchedule(actorToFire,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.STOP);
        if (_eventsInExecution.size() > 0)         displaySchedule((Actor)_eventsInExecution.getFirst().contents,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.START);
        if (_eventsInExecution.size() > 0)         _currentModelTime=_eventsInExecution.getFirst().timeStamp;
 else         _currentModelTime=null;
      }
    }
    eventsToFire=_getNextEventsToFire();
    Time nextRealTimeEventTime=_getNextRealTimeEventTime(eventsToFire,_eventsInExecution);
    event=_executionStrategy.getNextEventToFire(_eventsInExecution,eventsToFire,nextRealTimeEventTime,_currentPhysicalTime);
    System.out.println(_currentPhysicalTime + "String_Node_Str" + _currentTime+ "String_Node_Str"+ event);
    if (event != null) {
      _currentModelTime=event.timeStamp;
      Actor actorToFire=(Actor)event.contents;
      if (!actorToFire.prefire()) {
        _currentModelTime=null;
        continue;
      }
 else {
        TreeSet<Time> eventsForActorAndTime=_eventQueues.get(actorToFire);
        if (!eventsForActorAndTime.isEmpty()) {
          Time time=eventsForActorAndTime.first();
          if (time.equals(getModelTime())) {
            eventsForActorAndTime.remove(time);
          }
        }
        if (_eventsInExecution.size() > 0)         displaySchedule((Actor)_eventsInExecution.getFirst().contents,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.STOP);
        displaySchedule(actorToFire,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.START);
        if (_fireAtTheBeginningOfTheWcet(actorToFire)) {
          _fireActorInZeroModelTime(actorToFire);
        }
        double WCET=PtidesActorProperties.getWCET(actorToFire);
        setFinishingTime(actorToFire,_currentPhysicalTime.add(WCET));
        for (        TimedEvent eventInExecution : _eventsInExecution) {
          Actor actor=(Actor)eventInExecution.contents;
          setFinishingTime(actor,getFinishingTime(actor).add(WCET));
        }
        _eventsInExecution.addFirst(event);
      }
    }
 else {
      if (_transferAllInputs()) {
        continue;
      }
      _fireContainerAt(nextRealTimeEventTime);
      Director executiveDirector=((Actor)getContainer()).getExecutiveDirector();
      while (executiveDirector != null && !(executiveDirector instanceof PtidesDirector))       executiveDirector=((Actor)executiveDirector.getContainer()).getExecutiveDirector();
      if (executiveDirector == null)       throw new IllegalActionException("String_Node_Str");
      _currentPhysicalTime=executiveDirector.getModelTime();
      iterate=false;
    }
  }
}

Fixed version (ground truth):
/** 
 * This method fires all actors that are safe to fire at the current physical time. In a loop, a set of events which are safe to process is selected. Then, one event is chosen that will really be processed. This choice is taken by the PlatformExecutionStrategy. <p> If there is no event selected, this director schedules a refiring for the actor by calling the fireAt() method of the enclosing director. The enclosing director will stall this platform until the model time of the enclosing director which is used as the physical time is equal to the time requested in the fireAt() or if an event was sent to the composite actor governed by this director. <p> If an event was selected, the actor is added to a set of actors in execution. If the actor has a worst case execution time > 0, this director calls the fireAt() method of the enclosing director with the current physical time increased by the WCET. After that time passed, the actor is taken out of the list of actors in execution.
 * @throws IllegalActionException Thrown if an execution was missed.
 */
public void fire() throws IllegalActionException {
  System.out.println("String_Node_Str" + this.getContainer().getName() + "String_Node_Str"+ _currentPhysicalTime);
  List<TimedEvent> eventsToFire=null;
  TimedEvent event=null;
  boolean iterate=true;
  while (iterate) {
    if (_stopRequested)     return;
    _transferAllInputs();
    if (_eventsInExecution.size() > 0) {
      TimedEvent eventInExecution=_eventsInExecution.getFirst();
      Actor actorToFire=(Actor)eventInExecution.contents;
      Time time=getFinishingTime(actorToFire);
      if (time.equals(_currentPhysicalTime)) {
        System.out.println("String_Node_Str" + _currentPhysicalTime + "String_Node_Str"+ _currentTime+ "String_Node_Str"+ actorToFire);
        _eventsInExecution.removeFirst();
        _currentModelTime=eventInExecution.timeStamp;
        if (!_fireAtTheBeginningOfTheWcet(actorToFire))         _fireActorInZeroModelTime(actorToFire);
        _transferAllOutputs();
        displaySchedule(actorToFire,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.STOP);
        if (_eventsInExecution.size() > 0)         displaySchedule((Actor)_eventsInExecution.getFirst().contents,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.START);
        if (_eventsInExecution.size() > 0)         _currentModelTime=_eventsInExecution.getFirst().timeStamp;
 else         _currentModelTime=null;
      }
    }
    eventsToFire=_getNextEventsToFire();
    Time nextRealTimeEventTime=_getNextRealTimeEventTime(eventsToFire,_eventsInExecution);
    event=_executionStrategy.getNextEventToFire(_eventsInExecution,eventsToFire,nextRealTimeEventTime,_currentPhysicalTime);
    System.out.println(_currentPhysicalTime + "String_Node_Str" + _currentTime+ "String_Node_Str"+ event);
    if (event != null) {
      _currentModelTime=event.timeStamp;
      Actor actorToFire=(Actor)event.contents;
      if (!actorToFire.prefire()) {
        _currentModelTime=null;
        continue;
      }
 else {
        TreeSet<Time> eventsForActorAndTime=_eventQueues.get(actorToFire);
        if (!eventsForActorAndTime.isEmpty()) {
          Time time=eventsForActorAndTime.first();
          if (time.equals(getModelTime())) {
            eventsForActorAndTime.remove(time);
          }
        }
        if (_eventsInExecution.size() > 0)         displaySchedule((Actor)_eventsInExecution.getFirst().contents,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.STOP);
        displaySchedule(actorToFire,_currentPhysicalTime.getDoubleValue(),ScheduleEventType.START);
        if (_fireAtTheBeginningOfTheWcet(actorToFire)) {
          _fireActorInZeroModelTime(actorToFire);
        }
        double WCET=PtidesActorProperties.getWCET(actorToFire);
        setFinishingTime(actorToFire,_currentPhysicalTime.add(WCET));
        for (        TimedEvent eventInExecution : _eventsInExecution) {
          Actor actor=(Actor)eventInExecution.contents;
          setFinishingTime(actor,getFinishingTime(actor).add(WCET));
        }
        _eventsInExecution.addFirst(event);
      }
    }
 else {
      if (_transferAllInputs()) {
        continue;
      }
      _fireContainerAt(nextRealTimeEventTime);
      Director executiveDirector=((Actor)getContainer()).getExecutiveDirector();
      while (executiveDirector != null && (executiveDirector.getContainer() != executiveDirector.toplevel()))       executiveDirector=((Actor)executiveDirector.getContainer()).getExecutiveDirector();
      if (executiveDirector == null)       throw new IllegalActionException("String_Node_Str");
      _currentPhysicalTime=executiveDirector.getModelTime();
      iterate=false;
    }
  }
}