Program: 76345
Project: 76345
Buggy source:
/** 
 * Count the number of inputports in the Actor that must be fulfilled before the actor can fire.  Ports that are connected to actors that we are not scheduling right now are assumed to be fulfilled.  Ports that have more tokens waiting on each of their channels than their input consumption rate are also already fulfilled.  All other ports are considered to be unfulfilled.
 * @param a The actor
 * @param unscheduledactors The set of actors that we are scheduling.
 * @param waitingTokens The Map of tokens currently waiting on all theinput ports.
 * @return The number of unfulfilled inputs of a.
 * @exception IllegalActionException If any called method throws it.
 */
private int _countUnfulfilledInputs(Actor a,CircularList actorList,LLMap waitingTokens) throws IllegalActionException {
  Enumeration ainputPorts=a.inputPorts();
  _debug("String_Node_Str" + ((Entity)a).getFullName());
  int inputCount=0;
  while (ainputPorts.hasMoreElements()) {
    IOPort ainputPort=(IOPort)ainputPorts.nextElement();
    _debug("String_Node_Str" + ainputPort.getFullName());
    Enumeration cports=ainputPort.deepConnectedOutPorts();
    boolean isonlyexternalport=true;
    while (cports.hasMoreElements()) {
      IOPort cport=(IOPort)cports.nextElement();
      if (actorList.includes(cport.getContainer()))       isonlyexternalport=false;
    }
    int threshold=_getTokenConsumptionRate(ainputPort);
    _debug("String_Node_Str" + threshold);
    int[] tokens=(int[])waitingTokens.at(ainputPort);
    boolean isalreadyfulfilled=true;
    int channel;
    for (channel=0; channel < ainputPort.getWidth(); channel++) {
      _debug("String_Node_Str" + channel);
      _debug("String_Node_Str" + tokens[channel]);
      if (tokens[channel] < threshold)       isalreadyfulfilled=false;
    }
    if (!isonlyexternalport && !isalreadyfulfilled)     inputCount++;
  }
  return inputCount;
}

Fixed version (ground truth):
/** 
 * Count the number of inputports in the Actor that must be fulfilled before the actor can fire.  Ports that are connected to actors that we are not scheduling right now are assumed to be fulfilled.  Ports that have more tokens waiting on each of their channels than their input consumption rate are also already fulfilled.  All other ports are considered to be unfulfilled.
 * @param a The actor
 * @param unscheduledactors The set of actors that we are scheduling.
 * @param waitingTokens The Map of tokens currently waiting on all theinput ports.
 * @return The number of unfulfilled inputs of a.
 * @exception IllegalActionException If any called method throws it.
 */
private int _countUnfulfilledInputs(Actor a,LinkedList actorList,Map waitingTokens) throws IllegalActionException {
  _debug("String_Node_Str" + ((Entity)a).getFullName());
  Enumeration ainputPorts=a.inputPorts();
  int inputCount=0;
  while (ainputPorts.hasMoreElements()) {
    IOPort ainputPort=(IOPort)ainputPorts.nextElement();
    _debug("String_Node_Str" + ainputPort.getFullName());
    Enumeration cports=ainputPort.deepConnectedOutPorts();
    boolean isonlyexternalport=true;
    while (cports.hasMoreElements()) {
      IOPort cport=(IOPort)cports.nextElement();
      if (actorList.contains(cport.getContainer()))       isonlyexternalport=false;
    }
    int threshold=_getTokenConsumptionRate(ainputPort);
    _debug("String_Node_Str" + threshold);
    int[] tokens=(int[])waitingTokens.get(ainputPort);
    boolean isalreadyfulfilled=true;
    int channel;
    for (channel=0; channel < ainputPort.getWidth(); channel++) {
      _debug("String_Node_Str" + channel);
      _debug("String_Node_Str" + tokens[channel]);
      if (tokens[channel] < threshold)       isalreadyfulfilled=false;
    }
    if (!isonlyexternalport && !isalreadyfulfilled)     inputCount++;
  }
  return inputCount;
}