Program: 75885
Project: 75885
Buggy source:
/** 
 * Return the scheduling sequence.  An exception will be thrown if the graph is not schedulable.  This occurs in the following circumstances: <ul> <li>The graph is not a connected graph. <li>No integer solution exists for the balance equations. <li>The graph contains cycles without delays (deadlock). <li>Multiple output ports are connected to the same broadcast relation. (equivalent to a non-deterministic merge) </ul>
 * @return An Enumeration of the deeply contained opaque entitiesin the firing order.
 * @exception NotScheduleableException If the CompositeActor is notschedulable.
 */
protected Enumeration _schedule() throws NotSchedulableException {
  StaticSchedulingDirector dir=(StaticSchedulingDirector)getContainer();
  CompositeActor ca=(CompositeActor)(dir.getContainer());
  LinkedList AllActors=new LinkedList();
  Iterator entities=ca.deepEntityList().iterator();
  while (entities.hasNext()) {
    ComponentEntity a=(ComponentEntity)entities.next();
    if (a instanceof Actor)     AllActors.addLast(a);
  }
  Map firings=null;
  try {
    firings=_solveBalanceEquations(AllActors);
    List deadActors=new LinkedList();
    Iterator allActor=AllActors.iterator();
    while (allActor.hasNext()) {
      ComponentEntity anActor=(ComponentEntity)allActor.next();
      Fraction theFiring=(Fraction)firings.get(anActor);
      _debug("String_Node_Str" + anActor.getName());
      _debug("String_Node_Str" + theFiring.getNumerator());
      if (theFiring.getNumerator() == 0) {
        _debug("String_Node_Str");
        deadActors.add(anActor);
      }
    }
    Iterator removeIt=deadActors.iterator();
    while (removeIt.hasNext()) {
      ComponentEntity actorToRemove=(ComponentEntity)removeIt.next();
      _debug("String_Node_Str" + actorToRemove.getName() + "String_Node_Str");
      firings.remove(actorToRemove);
      AllActors.remove(actorToRemove);
    }
    _debug("String_Node_Str" + firings.toString());
  }
 catch (  IllegalActionException ex) {
    throw new NotSchedulableException(this,"String_Node_Str" + "String_Node_Str" + ex.getMessage() + "String_Node_Str");
  }
  _normalizeFirings(firings);
  _setFiringVector(firings);
  if (_debugging) {
    _debug("String_Node_Str");
    _debug(firings.toString());
  }
  LinkedList result=_scheduleConnectedActors(AllActors);
  _setFiringVector(firings);
  if (_debugging) {
    _debug("String_Node_Str");
    _debug(firings.toString());
  }
  try {
    _setContainerRates();
  }
 catch (  IllegalActionException ex) {
    throw new NotSchedulableException(this,"String_Node_Str" + "String_Node_Str");
  }
  setValid(true);
  return Collections.enumeration(result);
}

Fixed version (ground truth):
/** 
 * Return the scheduling sequence.  An exception will be thrown if the graph is not schedulable.  This occurs in the following circumstances: <ul> <li>The graph is not a connected graph. <li>No integer solution exists for the balance equations. <li>The graph contains cycles without delays (deadlock). <li>Multiple output ports are connected to the same broadcast relation. (equivalent to a non-deterministic merge) </ul>
 * @return An Enumeration of the deeply contained opaque entitiesin the firing order.
 * @exception NotScheduleableException If the CompositeActor is notschedulable.
 */
protected Enumeration _schedule() throws NotSchedulableException {
  StaticSchedulingDirector dir=(StaticSchedulingDirector)getContainer();
  CompositeActor ca=(CompositeActor)(dir.getContainer());
  LinkedList AllActors=new LinkedList();
  Iterator entities=ca.deepEntityList().iterator();
  while (entities.hasNext()) {
    ComponentEntity a=(ComponentEntity)entities.next();
    if (a instanceof Actor)     AllActors.addLast(a);
  }
  Map firings=null;
  try {
    firings=_solveBalanceEquations(AllActors);
    List deadActors=new LinkedList();
    Iterator allActor=AllActors.iterator();
    while (allActor.hasNext()) {
      ComponentEntity anActor=(ComponentEntity)allActor.next();
      Fraction theFiring=(Fraction)firings.get(anActor);
      if (_debugging) {
        _debug("String_Node_Str" + anActor.getName());
        _debug("String_Node_Str" + theFiring.getNumerator());
      }
      if (theFiring.getNumerator() == 0) {
        if (_debugging) {
          _debug("String_Node_Str" + "String_Node_Str");
        }
        deadActors.add(anActor);
      }
    }
    Iterator removeIt=deadActors.iterator();
    while (removeIt.hasNext()) {
      ComponentEntity actorToRemove=(ComponentEntity)removeIt.next();
      if (_debugging) {
        _debug("String_Node_Str" + actorToRemove.getName() + "String_Node_Str");
      }
      firings.remove(actorToRemove);
      AllActors.remove(actorToRemove);
    }
    if (_debugging) {
      _debug("String_Node_Str" + firings.toString());
    }
  }
 catch (  IllegalActionException ex) {
    throw new NotSchedulableException(this,"String_Node_Str" + "String_Node_Str" + ex.getMessage() + "String_Node_Str");
  }
  _normalizeFirings(firings);
  _setFiringVector(firings);
  if (_debugging) {
    _debug("String_Node_Str");
    _debug(firings.toString());
  }
  LinkedList result=_scheduleConnectedActors(AllActors);
  _setFiringVector(firings);
  if (_debugging) {
    _debug("String_Node_Str");
    _debug(firings.toString());
  }
  try {
    _setContainerRates();
  }
 catch (  IllegalActionException ex) {
    throw new NotSchedulableException(this,"String_Node_Str" + "String_Node_Str");
  }
  setValid(true);
  return Collections.enumeration(result);
}