Program: 75129
Project: 75129
Buggy source:
/** 
 * Execute the model for one iteration. First scan all active actors  to put all enabled and non-deferrable actors in a list and find the  minimax actors. Fire all actors once in the list. If no actor has been fired, fire the minimax actors. If still no actor has been fired, a deadlock has been detected. This concludes one basic iteration, and by default also one iteration of this director. However, if some actor has a parameter named <i>requiredFiringsPerIteration</i> defined, continue to execute basic iterations until the actor has been fired at least the number of times given in that parameter. If more than one actor has such a parameter, then the iteration will continue until all are satisfied. If the parameter  <i>runUntilDeadlockInOneIteration</i> has value true, one iteration  consists of repeatedly executing basic iterations until the actors  under control of this director have reached a deadlock.
 * @exception IllegalActionException If any actor executed by thisactor returns false in prefire().
 */
public void fire() throws IllegalActionException {
  boolean repeatBasicIteration=false;
  do {
    List minimaxActors=new LinkedList();
    int minimaxSize=Integer.MAX_VALUE;
    List toBeFiredActors=new LinkedList();
    Iterator actors=((TypedCompositeActor)getContainer()).deepEntityList().iterator();
    while (actors.hasNext()) {
      Actor actor=(Actor)actors.next();
      if (_disabledActors.contains(actor)) {
        continue;
      }
      int[] flags=(int[])_actorsFlags.get(actor);
      int canFire=flags[_ENABLING_STATUS];
      if (canFire == _ENABLED_NOT_DEFERRABLE) {
        toBeFiredActors.add(actor);
      }
      if (canFire == _ENABLED_DEFERRABLE) {
        int newSize=flags[_MAX_NUMBER_OF_TOKENS];
        if (newSize < minimaxSize) {
          minimaxActors.clear();
          minimaxActors.add(actor);
          minimaxSize=newSize;
        }
 else         if (newSize == minimaxSize) {
          minimaxActors.add(actor);
        }
      }
    }
    _firedOne=false;
    Iterator enabledActors=toBeFiredActors.iterator();
    while (enabledActors.hasNext()) {
      Actor actor=(Actor)enabledActors.next();
      _firedOne=_firedOne || _fireActor(actor);
    }
    if (!_firedOne) {
      Iterator minimaxActorsIterator=minimaxActors.iterator();
      while (minimaxActorsIterator.hasNext()) {
        Actor minimaxActor=(Actor)minimaxActorsIterator.next();
        _firedOne=_firedOne || _fireActor(minimaxActor);
      }
    }
    if (_runUntilDeadlock) {
      repeatBasicIteration=_firedOne;
    }
 else     if (_firedOne) {
      actors=_actorsToCheckNumberOfFirings.iterator();
      repeatBasicIteration=false;
      while (actors.hasNext()) {
        Actor actor=(Actor)actors.next();
        if (actor.getContainer() == null) {
          actors.remove();
          continue;
        }
        int[] flags=(int[])_actorsFlags.get(actor);
        int requiredFirings=flags[_REQUIRED_FIRINGS_PER_ITERATION];
        int firingsDone=flags[_NUMBER_OF_FIRINGS];
        if (firingsDone < requiredFirings) {
          repeatBasicIteration=true;
          break;
        }
      }
    }
 else {
      if (_debugging) {
        _debug("String_Node_Str");
      }
      repeatBasicIteration=false;
    }
  }
 while (repeatBasicIteration && !_stopRequested);
}

Fixed version (ground truth):
/** 
 * Execute the model for one iteration. First scan all active actors  to put all enabled and non-deferrable actors in a list and find the  minimax actors. Fire all actors once in the list. If no actor has been fired, fire the minimax actors. If still no actor has been fired, a deadlock has been detected. This concludes one basic iteration, and by default also one iteration of this director. However, if some actor has a parameter named <i>requiredFiringsPerIteration</i> defined, continue to execute basic iterations until the actor has been fired at least the number of times given in that parameter. If more than one actor has such a parameter, then the iteration will continue until all are satisfied. If the parameter  <i>runUntilDeadlockInOneIteration</i> has value true, one iteration  consists of repeatedly executing basic iterations until the actors  under control of this director have reached a deadlock.
 * @exception IllegalActionException If any actor executed by thisactor returns false in prefire().
 */
public void fire() throws IllegalActionException {
  boolean repeatBasicIteration=false;
  do {
    List minimaxActors=new LinkedList();
    int minimaxSize=Integer.MAX_VALUE;
    List toBeFiredActors=new LinkedList();
    Iterator actors=((TypedCompositeActor)getContainer()).deepEntityList().iterator();
    while (actors.hasNext()) {
      Actor actor=(Actor)actors.next();
      if (_disabledActors.contains(actor)) {
        continue;
      }
      int[] flags=(int[])_actorsFlags.get(actor);
      int canFire=flags[_ENABLING_STATUS];
      if (canFire == _ENABLED_NOT_DEFERRABLE) {
        toBeFiredActors.add(actor);
      }
      if (canFire == _ENABLED_DEFERRABLE) {
        int newSize=flags[_MAX_NUMBER_OF_TOKENS];
        if (newSize < minimaxSize) {
          minimaxActors.clear();
          minimaxActors.add(actor);
          minimaxSize=newSize;
        }
 else         if (newSize == minimaxSize) {
          minimaxActors.add(actor);
        }
      }
    }
    _firedOne=false;
    Iterator enabledActors=toBeFiredActors.iterator();
    while (enabledActors.hasNext()) {
      Actor actor=(Actor)enabledActors.next();
      boolean amIFired=_fireActor(actor);
      _firedOne=amIFired || _firedOne;
    }
    if (!_firedOne) {
      Iterator minimaxActorsIterator=minimaxActors.iterator();
      while (minimaxActorsIterator.hasNext()) {
        Actor minimaxActor=(Actor)minimaxActorsIterator.next();
        boolean amIFired=_fireActor(minimaxActor);
        _firedOne=amIFired || _firedOne;
      }
    }
    if (_runUntilDeadlock) {
      repeatBasicIteration=_firedOne;
    }
 else     if (_firedOne) {
      actors=_actorsToCheckNumberOfFirings.iterator();
      repeatBasicIteration=false;
      while (actors.hasNext()) {
        Actor actor=(Actor)actors.next();
        if (actor.getContainer() == null) {
          actors.remove();
          continue;
        }
        int[] flags=(int[])_actorsFlags.get(actor);
        int requiredFirings=flags[_REQUIRED_FIRINGS_PER_ITERATION];
        int firingsDone=flags[_NUMBER_OF_FIRINGS];
        if (firingsDone < requiredFirings) {
          repeatBasicIteration=true;
          break;
        }
      }
    }
 else {
      if (_debugging) {
        _debug("String_Node_Str");
      }
      repeatBasicIteration=false;
    }
  }
 while (repeatBasicIteration && !_stopRequested);
}