Program: 75899
Project: 75899
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,LinkedList actorList,Map waitingTokens) throws IllegalActionException {
  if (_debugging)   _debug("String_Node_Str" + ((Entity)a).getFullName());
  Iterator ainputPorts=a.inputPortList().iterator();
  int inputCount=0;
  while (ainputPorts.hasNext()) {
    IOPort ainputPort=(IOPort)ainputPorts.next();
    if (_debugging)     _debug("String_Node_Str" + ainputPort.getFullName());
    Iterator cports=ainputPort.deepConnectedOutPortList().iterator();
    boolean isOnlyExternalPort=true;
    while (cports.hasNext()) {
      IOPort cport=(IOPort)cports.next();
      if (actorList.contains(cport.getContainer()))       isOnlyExternalPort=false;
    }
    int threshold=getTokenConsumptionRate(ainputPort);
    if (_debugging)     _debug("String_Node_Str" + threshold);
    int[] tokens=(int[])waitingTokens.get(ainputPort);
    boolean isAlreadyFulfilled=true;
    int channel;
    for (channel=0; channel < ainputPort.getWidth(); channel++) {
      if (_debugging) {
        _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 {
  if (_debugging)   _debug("String_Node_Str" + ((Entity)a).getFullName());
  Iterator ainputPorts=a.inputPortList().iterator();
  int inputCount=0;
  while (ainputPorts.hasNext()) {
    IOPort ainputPort=(IOPort)ainputPorts.next();
    if (_debugging)     _debug("String_Node_Str" + ainputPort.getFullName());
    int threshold=getTokenConsumptionRate(ainputPort);
    if (_debugging)     _debug("String_Node_Str" + threshold);
    int[] tokens=(int[])waitingTokens.get(ainputPort);
    boolean isFulfilled=true;
    int channel;
    for (channel=0; channel < ainputPort.getWidth() && isFulfilled; channel++) {
      if (_debugging) {
        _debug("String_Node_Str" + channel);
        _debug("String_Node_Str" + tokens[channel]);
      }
      if (tokens[channel] < threshold)       isFulfilled=false;
    }
    if (!isFulfilled)     inputCount++;
  }
  return inputCount;
}