Program: 75637
Project: 75637
Buggy source:
/** 
 * Simulate the creation of tokens by the given output port when its actor fires.  If any actors that receive tokens are then ready to fire, given that only actors in the actor list are being scheduled, then add those actors to the list of actors that are ready to schedule. update the waiting tokens map with the tokens available on each channel of each port.
 * @param outputPort The port that is creating the tokens.
 * @param createdTokens The number of tokens to create.
 * @param actorList The list of actors that are being scheduled.
 * @param readyToScheduleActorList The list of actors that are readyto be scheduled.  This will be updated if any actors that receive tokens from outputPort are now ready to fire.
 * @param waitingTokens A map from port to an array of integersrepresenting the number of tokens in each receiver of an input port. This will be updated according to the tokens that are created.
 */
private void _simulateTokensCreated(IOPort outputPort,int createdTokens,LinkedList actorList,LinkedList readyToScheduleActorList,Map waitingTokens,Map minimumBufferSize) throws IllegalActionException {
  Receiver[][] receivers=outputPort.getRemoteReceivers();
  if (_debugging) {
    _debug("String_Node_Str" + createdTokens + "String_Node_Str"+ outputPort.getFullName());
    _debug("String_Node_Str" + receivers.length);
  }
  int sourceChannel=0;
  Iterator relations=outputPort.linkedRelationList().iterator();
  while (relations.hasNext()) {
    IORelation relation=(IORelation)relations.next();
    if (relation == null) {
      continue;
    }
    Integer bufferSize=(Integer)minimumBufferSize.get(relation);
    int width=relation.getWidth();
    for (int i=0; i < width; i++, sourceChannel++) {
      if (_debugging) {
        _debug("String_Node_Str" + relation.getName() + "String_Node_Str"+ sourceChannel+ "String_Node_Str"+ receivers[sourceChannel].length);
      }
      for (int destinationIndex=0; destinationIndex < receivers[sourceChannel].length; destinationIndex++) {
        IOPort connectedPort=(IOPort)receivers[sourceChannel][destinationIndex].getContainer();
        ComponentEntity connectedActor=(ComponentEntity)connectedPort.getContainer();
        int destinationChannel=_getChannel(connectedPort,receivers[sourceChannel][destinationIndex]);
        int[] tokens=(int[])waitingTokens.get(connectedPort);
        tokens[destinationChannel]+=createdTokens;
        if (bufferSize != null && tokens[destinationChannel] > bufferSize.intValue()) {
          bufferSize=new Integer(tokens[destinationChannel]);
        }
        if (_debugging) {
          _debug("String_Node_Str" + destinationChannel + "String_Node_Str"+ connectedPort.getName());
        }
        if (actorList.contains(connectedActor)) {
          int inputCount=_countUnfulfilledInputs((Actor)connectedActor,actorList,waitingTokens);
          int firingsRemaining=_getFiringCount(connectedActor);
          if ((inputCount < 1) && (firingsRemaining > 0)) {
            readyToScheduleActorList.addLast(connectedActor);
          }
        }
      }
    }
    minimumBufferSize.put(relation,bufferSize);
  }
}

Fixed version (ground truth):
/** 
 * Simulate the creation of tokens by the given output port when its actor fires.  If any actors that receive tokens are then ready to fire, given that only actors in the actor list are being scheduled, then add those actors to the list of actors that are ready to schedule. update the waiting tokens map with the tokens available on each channel of each port.
 * @param outputPort The port that is creating the tokens.
 * @param createdTokens The number of tokens to create.
 * @param actorList The list of actors that are being scheduled.
 * @param readyToScheduleActorList The list of actors that are readyto be scheduled.  This will be updated if any actors that receive tokens from outputPort are now ready to fire.
 * @param waitingTokens A map from port to an array of integersrepresenting the number of tokens in each receiver of an input port. This will be updated according to the tokens that are created.
 */
private void _simulateTokensCreated(IOPort outputPort,int createdTokens,LinkedList actorList,LinkedList readyToScheduleActorList,Map waitingTokens,Map minimumBufferSize) throws IllegalActionException {
  Receiver[][] receivers=outputPort.getRemoteReceivers();
  if (_debugging) {
    _debug("String_Node_Str" + createdTokens + "String_Node_Str"+ outputPort.getFullName());
    _debug("String_Node_Str" + receivers.length);
    _debug("String_Node_Str" + outputPort.getWidth());
  }
  int sourceChannel=0;
  Iterator relations=outputPort.linkedRelationList().iterator();
  while (relations.hasNext()) {
    IORelation relation=(IORelation)relations.next();
    if (relation == null) {
      continue;
    }
    Integer bufferSize=(Integer)minimumBufferSize.get(relation);
    int width=relation.getWidth();
    for (int i=0; i < width; i++, sourceChannel++) {
      if (receivers[sourceChannel] == null) {
        continue;
      }
      if (_debugging) {
        _debug("String_Node_Str" + relation.getName() + "String_Node_Str"+ sourceChannel+ "String_Node_Str"+ receivers[sourceChannel].length);
      }
      for (int destinationIndex=0; destinationIndex < receivers[sourceChannel].length; destinationIndex++) {
        IOPort connectedPort=(IOPort)receivers[sourceChannel][destinationIndex].getContainer();
        ComponentEntity connectedActor=(ComponentEntity)connectedPort.getContainer();
        int destinationChannel=_getChannel(connectedPort,receivers[sourceChannel][destinationIndex]);
        int[] tokens=(int[])waitingTokens.get(connectedPort);
        tokens[destinationChannel]+=createdTokens;
        if (bufferSize != null && tokens[destinationChannel] > bufferSize.intValue()) {
          bufferSize=new Integer(tokens[destinationChannel]);
        }
        if (_debugging) {
          _debug("String_Node_Str" + destinationChannel + "String_Node_Str"+ connectedPort.getName());
        }
        if (actorList.contains(connectedActor)) {
          int inputCount=_countUnfulfilledInputs((Actor)connectedActor,actorList,waitingTokens);
          int firingsRemaining=_getFiringCount(connectedActor);
          if ((inputCount < 1) && (firingsRemaining > 0)) {
            readyToScheduleActorList.addLast(connectedActor);
          }
        }
      }
    }
    minimumBufferSize.put(relation,bufferSize);
  }
}