Program: 74148
Project: 74148
Buggy source:
/** 
 * Generate the content of a driver methods. For each actor update it's inputs to the  outputs stored in ports. The PORT allows double buffering, in this case the output variable is used as the port. PORT here is simply a common variable, not a PORT in  the general Ptolemy II actor sense NOTE: Duplicate ports connected through a fork are removed. IE. if an input is connected to a fork and the fork is connected to two other places... it removes the first place from the list of places and keeps the last place need to ask Jackie if there is a way to work around this b/c Reciever [][] recievers = getRecievers doesn't work.
 * @param none
 * @return code that copies outputs to a port, and inputs from a port in a driver method
 */
public String _generateInDriverCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  System.out.println("String_Node_Str");
  for (  Actor actor : (List<Actor>)((TypedCompositeActor)_director.getContainer()).deepEntityList()) {
    List inputPortList=actor.inputPortList();
    System.out.println("String_Node_Str" + actor.getDisplayName() + "String_Node_Str"+ inputPortList.size()+ "String_Node_Str");
    Iterator inputPorts=inputPortList.iterator();
    String actorDriverCode="String_Node_Str";
    String sinkReference="String_Node_Str";
    String srcReference="String_Node_Str";
    String temp="String_Node_Str";
    StringBuffer transferIn=new StringBuffer();
    StringBuffer transferOut=new StringBuffer();
    String output="String_Node_Str";
    int i=0;
    int j=0;
    CodeGeneratorHelper myHelper;
    while (inputPorts.hasNext()) {
      i=0;
      j=0;
      TypedIOPort port=(TypedIOPort)inputPorts.next();
      System.out.println("String_Node_Str" + port.getFullName());
      List<IOPort> connectedPorts=port.deepConnectedOutPortList();
      List<IOPort> connectToMe=port.sourcePortList();
      System.out.println("String_Node_Str" + connectToMe.size());
      Iterator tome=connectToMe.iterator();
      System.out.println("String_Node_Str" + connectToMe.size());
      tome=connectToMe.iterator();
      while (tome.hasNext()) {
        IOPort tempp=(IOPort)tome.next();
        System.out.println("String_Node_Str" + tempp.getFullName());
      }
      Iterator cpIterator=connectToMe.iterator();
      while (cpIterator.hasNext()) {
        TypedIOPort sourcePort=(TypedIOPort)cpIterator.next();
        if (actor instanceof CompositeActor) {
          System.out.println("String_Node_Str");
          transferIn.append(("String_Node_Str" + _eol));
        }
        System.out.println("String_Node_Str" + j + "String_Node_Str"+ connectToMe.size());
        String channelOffset[]={"String_Node_Str","String_Node_Str"};
        System.out.println("String_Node_Str" + sourcePort.getFullName() + "String_Node_Str"+ port.getFullName());
        myHelper=(CodeGeneratorHelper)this._getHelper(sourcePort.getContainer());
        channelOffset[0]=Integer.valueOf(i).toString();
        System.out.println("String_Node_Str" + channelOffset[0]);
        srcReference=this.driverGetReference((TypedIOPort)sourcePort,channelOffset,false,true,myHelper);
        System.out.println("String_Node_Str");
        myHelper=(CodeGeneratorHelper)_getHelper(actor);
        channelOffset[0]=Integer.valueOf(j).toString();
        System.out.println("String_Node_Str" + channelOffset[0]);
        sinkReference=this.driverGetReference((TypedIOPort)port,channelOffset,false,true,myHelper);
        System.out.println("String_Node_Str");
        j++;
        temp=_typeConversion(sourcePort,port);
        System.out.println("String_Node_Str" + srcReference + "String_Node_Str"+ sourcePort.getDisplayName());
        System.out.println("String_Node_Str" + sinkReference + "String_Node_Str"+ port.getDisplayName());
        String src;
        temp=_typeConversion(sourcePort,port);
        if (temp.length() == 0)         src=srcReference;
 else         src=temp + "String_Node_Str" + srcReference+ "String_Node_Str";
        actorDriverCode+=sinkReference + "String_Node_Str" + src+ "String_Node_Str"+ _eol;
      }
      i++;
    }
    System.out.println("String_Node_Str");
    System.out.println(actorDriverCode);
    ArrayList args=new ArrayList();
    args.add(_generateDriverName((NamedObj)actor) + "String_Node_Str");
    args.add(actorDriverCode);
    code.append(_generateBlockCode("String_Node_Str",args));
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate the content of a driver methods. For each actor update it's inputs to the  outputs stored in ports. The PORT allows double buffering, in this case the output variable is used as the port. PORT here is simply a common variable, not a PORT in  the general Ptolemy II actor sense NOTE: Duplicate ports connected through a fork are removed. IE. if an input is connected to a fork and the fork is connected to two other places... it removes the first place from the list of places and keeps the last place need to ask Jackie if there is a way to work around this b/c Reciever [][] recievers = getRecievers doesn't work.
 * @return code that copies outputs to a port, and inputs from a port in a driver method
 */
public String _generateInDriverCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  System.out.println("String_Node_Str");
  for (  Actor actor : (List<Actor>)((TypedCompositeActor)_director.getContainer()).deepEntityList()) {
    List inputPortList=actor.inputPortList();
    System.out.println("String_Node_Str" + actor.getDisplayName() + "String_Node_Str"+ inputPortList.size()+ "String_Node_Str");
    Iterator inputPorts=inputPortList.iterator();
    String actorDriverCode="String_Node_Str";
    String sinkReference="String_Node_Str";
    String srcReference="String_Node_Str";
    String temp="String_Node_Str";
    StringBuffer transferIn=new StringBuffer();
    StringBuffer transferOut=new StringBuffer();
    String output="String_Node_Str";
    int i=0;
    int j=0;
    CodeGeneratorHelper myHelper;
    while (inputPorts.hasNext()) {
      i=0;
      j=0;
      TypedIOPort port=(TypedIOPort)inputPorts.next();
      System.out.println("String_Node_Str" + port.getFullName());
      List<IOPort> connectedPorts=port.deepConnectedOutPortList();
      List<IOPort> connectToMe=port.sourcePortList();
      System.out.println("String_Node_Str" + connectToMe.size());
      Iterator tome=connectToMe.iterator();
      System.out.println("String_Node_Str" + connectToMe.size());
      tome=connectToMe.iterator();
      while (tome.hasNext()) {
        IOPort tempp=(IOPort)tome.next();
        System.out.println("String_Node_Str" + tempp.getFullName());
      }
      Iterator cpIterator=connectToMe.iterator();
      while (cpIterator.hasNext()) {
        TypedIOPort sourcePort=(TypedIOPort)cpIterator.next();
        if (actor instanceof CompositeActor) {
          System.out.println("String_Node_Str");
          transferIn.append(("String_Node_Str" + _eol));
        }
        System.out.println("String_Node_Str" + j + "String_Node_Str"+ connectToMe.size());
        String channelOffset[]={"String_Node_Str","String_Node_Str"};
        System.out.println("String_Node_Str" + sourcePort.getFullName() + "String_Node_Str"+ port.getFullName());
        myHelper=(CodeGeneratorHelper)this._getHelper(sourcePort.getContainer());
        channelOffset[0]=Integer.valueOf(i).toString();
        System.out.println("String_Node_Str" + channelOffset[0]);
        srcReference=this.driverGetReference((TypedIOPort)sourcePort,channelOffset,false,true,myHelper);
        System.out.println("String_Node_Str");
        myHelper=(CodeGeneratorHelper)_getHelper(actor);
        channelOffset[0]=Integer.valueOf(j).toString();
        System.out.println("String_Node_Str" + channelOffset[0]);
        sinkReference=this.driverGetReference((TypedIOPort)port,channelOffset,false,true,myHelper);
        System.out.println("String_Node_Str");
        j++;
        temp=_typeConversion(sourcePort,port);
        System.out.println("String_Node_Str" + srcReference + "String_Node_Str"+ sourcePort.getDisplayName());
        System.out.println("String_Node_Str" + sinkReference + "String_Node_Str"+ port.getDisplayName());
        String src;
        temp=_typeConversion(sourcePort,port);
        if (temp.length() == 0)         src=srcReference;
 else         src=temp + "String_Node_Str" + srcReference+ "String_Node_Str";
        actorDriverCode+=sinkReference + "String_Node_Str" + src+ "String_Node_Str"+ _eol;
      }
      i++;
    }
    System.out.println("String_Node_Str");
    System.out.println(actorDriverCode);
    ArrayList args=new ArrayList();
    args.add(_generateDriverName((NamedObj)actor) + "String_Node_Str");
    args.add(actorDriverCode);
    code.append(_generateBlockCode("String_Node_Str",args));
  }
  return code.toString();
}