Program: 76344
Project: 76344
Buggy source:
/** 
 * Solve the Balance Equations for the list of connected Actors. For each actor, determine the ratio that determines the rate at which it should fire relative to the other actors for the graph to be live and operate within bounded memory.   This ratio is known as the fractional firing of the actor.
 * @param Actors The actors that we are interested in.
 * @return A LLMap that associates each actor with its fractionalfiring.
 * @exception NotSchedulableException If the graph is not consistentunder the synchronous dataflow model.
 * @exception NotSchedulableException If the graph is not connected.
 * @exception IllegalActionException If any called method throws it.
 */
private LLMap _solveBalanceEquations(Enumeration Actors) throws NotSchedulableException, IllegalActionException {
  LLMap firings=new LLMap();
  CircularList remainingActors=new CircularList();
  CircularList pendingActors=new CircularList();
  boolean done=false;
  remainingActors.appendElements(Actors);
  Enumeration enumActors=remainingActors.elements();
  while (enumActors.hasMoreElements()) {
    ComponentEntity e=(ComponentEntity)enumActors.nextElement();
    firings.putAt(e,Fraction.ZERO);
  }
  try {
    Actor a=(Actor)remainingActors.take();
    firings.putAt(a,new Fraction(1));
    pendingActors.insertLast(a);
  }
 catch (  NoSuchElementException e) {
    return firings;
  }
  while (!done)   try {
    _debug("String_Node_Str");
    _debug(pendingActors.toString());
    Actor currentActor=(Actor)pendingActors.take();
    _debug("String_Node_Str" + ((ComponentEntity)currentActor).getName());
    Enumeration AllPorts=((ComponentEntity)currentActor).getPorts();
    while (AllPorts.hasMoreElements()) {
      IOPort currentPort=(IOPort)AllPorts.nextElement();
      if (currentPort.isInput())       _propagateInputPort(currentPort,firings,remainingActors,pendingActors);
      if (currentPort.isOutput())       _propagateOutputPort(currentPort,firings,remainingActors,pendingActors);
    }
  }
 catch (  NoSuchElementException e) {
    done=true;
    if (remainingActors.elements().hasMoreElements()) {
      String msg="String_Node_Str";
      Enumeration actors=remainingActors.elements();
      while (actors.hasMoreElements()) {
        NamedObj actor=(NamedObj)(actors.nextElement());
        msg+=actor.getFullName() + "String_Node_Str";
      }
      throw new NotSchedulableException(msg);
    }
  }
  return firings;
}

Fixed version (ground truth):
/** 
 * Solve the Balance Equations for the list of connected Actors. For each actor, determine the ratio that determines the rate at which it should fire relative to the other actors for the graph to be live and operate within bounded memory.   This ratio is known as the fractional firing of the actor.
 * @param Actors The actors that we are interested in.
 * @return A Map that associates each actor with its fractionalfiring.
 * @exception NotSchedulableException If the graph is not consistentunder the synchronous dataflow model.
 * @exception NotSchedulableException If the graph is not connected.
 * @exception IllegalActionException If any called method throws it.
 */
private Map _solveBalanceEquations(List Actors) throws NotSchedulableException, IllegalActionException {
  Map firings=new TreeMap(new NamedObjComparator());
  LinkedList remainingActors=new LinkedList();
  LinkedList pendingActors=new LinkedList();
  boolean done=false;
  remainingActors.addAll(Actors);
  Iterator enumActors=remainingActors.iterator();
  while (enumActors.hasNext()) {
    ComponentEntity e=(ComponentEntity)enumActors.next();
    firings.put(e,Fraction.ZERO);
  }
  try {
    Actor a=(Actor)remainingActors.removeFirst();
    firings.put(a,new Fraction(1));
    pendingActors.addLast(a);
  }
 catch (  NoSuchElementException e) {
    return firings;
  }
  while (!done)   try {
    _debug("String_Node_Str");
    _debug(pendingActors.toString());
    Actor currentActor=(Actor)pendingActors.removeFirst();
    _debug("String_Node_Str" + ((ComponentEntity)currentActor).getName());
    Enumeration AllPorts=((ComponentEntity)currentActor).getPorts();
    while (AllPorts.hasMoreElements()) {
      IOPort currentPort=(IOPort)AllPorts.nextElement();
      if (currentPort.isInput())       _propagateInputPort(currentPort,firings,remainingActors,pendingActors);
      if (currentPort.isOutput())       _propagateOutputPort(currentPort,firings,remainingActors,pendingActors);
    }
  }
 catch (  NoSuchElementException e) {
    done=true;
    Iterator actors=remainingActors.iterator();
    if (actors.hasNext()) {
      String msg="String_Node_Str";
      while (actors.hasNext()) {
        NamedObj actor=(NamedObj)(actors.next());
        msg+=actor.getFullName() + "String_Node_Str";
      }
      throw new NotSchedulableException(msg);
    }
  }
  return firings;
}