Program: 73888
Project: 73888
Buggy source:
/** 
 * Create clusters of actor firing based on the dependencies on input firings.
 * @param outputFiringFunctions The list of firings that produces tokens to external actors.
 * @param inputFiringFunctions The list of firings that consumes external tokens.
 * @param clusteredOutputs The map from groups of input firings to the group of output firingsthat depend on the input firings.
 * @param outputInputDependence The map from each each output firing to the set of input firingsthat it depends on.
 * @param inInputConnectedPorts
 * @param inOutputConnectedPorts
 * @param firingClusters The cluster of frings.
 * @param clusters 
 * @throws IllegalActionException
 */
private void _clusterActorFirings(List<SimulationFiringFunction> outputFiringFunctions,List<SimulationFiringFunction> inputFiringFunctions,Map clusteredOutputs,Map outputInputDependence,Set<IOPort> inInputConnectedPorts,Set<IOPort> inOutputConnectedPorts,List<FiringCluster> firingClusters,Set clusters) throws IllegalActionException {
  for (Iterator firings=clusteredOutputs.keySet().iterator(); firings.hasNext(); ) {
    Set inputFirings=(Set)firings.next();
    Set clusteredFirings=new HashSet();
    FiringCluster firingCluster=new FiringCluster();
    Set searchedFirings=new HashSet();
    Set ouputFirings=(Set)clusteredOutputs.get(inputFirings);
    for (    Object ouputFiring : ouputFirings) {
      _clusterFirings((Firing)ouputFiring,clusteredFirings,searchedFirings,inputFirings,inputFiringFunctions,outputFiringFunctions,outputInputDependence);
    }
    List sortedFirings=new LinkedList(clusteredFirings);
    if (sortedFirings.size() > 0) {
      Set visitedFirings=new HashSet();
      _computeFiringDepth((Firing)sortedFirings.get(0),visitedFirings);
      FiringComparator comparator=new FiringComparator();
      Collections.sort(sortedFirings,comparator);
    }
    System.out.println("String_Node_Str");
    for (    Object f : sortedFirings) {
      firingCluster.actorFirings.add((Firing)f);
      ((Firing)f).cluster=firingCluster;
      Actor actor=((Firing)f).actor;
      if (actor instanceof ModularCompiledSDFTypedCompositeActor) {
        if (_getFiringFunction(inputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set<IOPort> inputPorts=new HashSet(actor.inputPortList());
          inputPorts.retainAll(inInputConnectedPorts);
          List<FiringFunctionPort> inputFiringPorts=((ModularCompiledSDFTypedCompositeActor)actor).getProfile().firings().get(((Firing)f).firingFunction).ports;
          for (          IOPort inputPort : inputPorts) {
            for (            FiringFunctionPort firingPort : inputFiringPorts) {
              if (firingPort.isInput && firingPort.externalPortName.equals(inputPort.getName())) {
                firingCluster.inputPorts.add(inputPort);
                break;
              }
            }
          }
        }
        if (_getFiringFunction(outputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set<IOPort> outputPorts=new HashSet(actor.outputPortList());
          outputPorts.retainAll(inOutputConnectedPorts);
          List<FiringFunctionPort> outputFiringPorts=((ModularCompiledSDFTypedCompositeActor)actor).getProfile().firings().get(((Firing)f).firingFunction).ports;
          for (          IOPort outputPort : outputPorts) {
            for (            FiringFunctionPort firingPort : outputFiringPorts) {
              if (!firingPort.isInput && firingPort.externalPortName.equals(outputPort.getName())) {
                firingCluster.outputPorts.add(outputPort);
                break;
              }
            }
          }
          firingCluster.outputPorts.addAll(outputPorts);
        }
      }
 else {
        if (_getFiringFunction(inputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set inputPorts=new HashSet(actor.inputPortList());
          inputPorts.retainAll(inInputConnectedPorts);
          firingCluster.inputPorts.addAll(inputPorts);
        }
        if (_getFiringFunction(outputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set outputPorts=new HashSet(actor.outputPortList());
          outputPorts.retainAll(inOutputConnectedPorts);
          firingCluster.outputPorts.addAll(outputPorts);
        }
      }
      System.out.println("String_Node_Str" + actor.getFullName() + "String_Node_Str"+ ((Firing)f).firingIndex+ "String_Node_Str"+ ((Firing)f).firingFunction);
    }
    firingClusters.add(firingCluster);
    clusters.add(sortedFirings);
  }
}

Fixed version (ground truth):
/** 
 * Create clusters of actor firing based on the dependencies on input firings.
 * @param outputFiringFunctions The list of firings that produces tokens to external actors.
 * @param inputFiringFunctions The list of firings that consumes external tokens.
 * @param clusteredOutputs The map from groups of input firings to the group of output firingsthat depend on the input firings.
 * @param outputInputDependence The map from each each output firing to the set of input firingsthat it depends on.
 * @param inInputConnectedPorts
 * @param inOutputConnectedPorts
 * @param firingClusters The cluster of frings.
 * @param clusters 
 * @throws IllegalActionException
 */
private void _clusterActorFirings(List<SimulationFiringFunction> outputFiringFunctions,List<SimulationFiringFunction> inputFiringFunctions,Map clusteredOutputs,Map outputInputDependence,Set<IOPort> inInputConnectedPorts,Set<IOPort> inOutputConnectedPorts,List<FiringCluster> firingClusters,Set clusters) throws IllegalActionException {
  for (Iterator firings=clusteredOutputs.keySet().iterator(); firings.hasNext(); ) {
    Set inputFirings=(Set)firings.next();
    Set clusteredFirings=new HashSet();
    FiringCluster firingCluster=new FiringCluster();
    Set searchedFirings=new HashSet();
    Set outputFirings=(Set)clusteredOutputs.get(inputFirings);
    for (    Object outputFiring : outputFirings) {
      _clusterFirings((Firing)outputFiring,clusteredFirings,searchedFirings,inputFirings,inputFiringFunctions,outputFiringFunctions,outputInputDependence);
    }
    List sortedFirings=new LinkedList(clusteredFirings);
    if (sortedFirings.size() > 0) {
      Set visitedFirings=new HashSet();
      _computeFiringDepth((Firing)sortedFirings.get(0),visitedFirings);
      FiringComparator comparator=new FiringComparator();
      Collections.sort(sortedFirings,comparator);
    }
    System.out.println("String_Node_Str");
    for (    Object f : sortedFirings) {
      firingCluster.actorFirings.add((Firing)f);
      ((Firing)f).cluster=firingCluster;
      Actor actor=((Firing)f).actor;
      if (actor instanceof ModularCompiledSDFTypedCompositeActor) {
        if (_getFiringFunction(inputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set<IOPort> inputPorts=new HashSet(actor.inputPortList());
          inputPorts.retainAll(inInputConnectedPorts);
          List<FiringFunctionPort> inputFiringPorts=((ModularCompiledSDFTypedCompositeActor)actor).getProfile().firings().get(((Firing)f).firingFunction).ports;
          for (          IOPort inputPort : inputPorts) {
            for (            FiringFunctionPort firingPort : inputFiringPorts) {
              if (firingPort.isInput && firingPort.externalPortName.equals(inputPort.getName())) {
                firingCluster.inputPorts.add(inputPort);
                break;
              }
            }
          }
        }
        if (_getFiringFunction(outputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set<IOPort> outputPorts=new HashSet(actor.outputPortList());
          outputPorts.retainAll(inOutputConnectedPorts);
          List<FiringFunctionPort> outputFiringPorts=((ModularCompiledSDFTypedCompositeActor)actor).getProfile().firings().get(((Firing)f).firingFunction).ports;
          for (          IOPort outputPort : outputPorts) {
            for (            FiringFunctionPort firingPort : outputFiringPorts) {
              if (!firingPort.isInput && firingPort.externalPortName.equals(outputPort.getName())) {
                firingCluster.outputPorts.add(outputPort);
                break;
              }
            }
          }
          firingCluster.outputPorts.addAll(outputPorts);
        }
      }
 else {
        if (_getFiringFunction(inputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set inputPorts=new HashSet(actor.inputPortList());
          inputPorts.retainAll(inInputConnectedPorts);
          firingCluster.inputPorts.addAll(inputPorts);
        }
        if (_getFiringFunction(outputFiringFunctions,actor,((Firing)f).firingFunction) != null) {
          Set outputPorts=new HashSet(actor.outputPortList());
          outputPorts.retainAll(inOutputConnectedPorts);
          firingCluster.outputPorts.addAll(outputPorts);
        }
      }
      System.out.println("String_Node_Str" + actor.getFullName() + "String_Node_Str"+ ((Firing)f).firingIndex+ "String_Node_Str"+ ((Firing)f).firingFunction);
    }
    firingClusters.add(firingCluster);
    clusters.add(sortedFirings);
  }
}