Program: 74982
Project: 74982
Buggy source:
/** 
 * Generate type resolution code.  Determine the proper code put into the source to support dynamic type resolution. First, find out the different types used in the model. Second, find out the different polymorphic functions used. (note: types and functions are independent of each other). Third, append code blocks according to the functions used, and read from files according to the types referenced. Fourth, generate type resolution code, which consists of constants (MAX_NUM_TYPE, MAX_NUM_FUNC), the type map, the function map, function definitions read from the files, and function table.
 * @return The type resolution code.
 * @throws IllegalActionException If an error ocurrs when generatingthe type resolution code, or if the helper class for the model director cannot be found, or if an error occurs when the helper actor generates the type resolution code. 
 */
public String generateTypeResolutionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(comment("String_Node_Str" + getContainer().getFullName()));
  TypedCompositeActor compositeActorHelper=(TypedCompositeActor)_getHelper(getContainer());
  Iterator actors=((ptolemy.actor.CompositeActor)compositeActorHelper.getComponent()).deepEntityList().iterator();
  HashSet functions=new HashSet();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    CodeGeneratorHelper helperObject=(CodeGeneratorHelper)_getHelper((NamedObj)actor);
    functions.addAll((HashSet)helperObject.getInfo(CodeGeneratorHelper.FIELD_TYPEFUNC));
  }
  HashSet types=new HashSet();
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  Object[] typesArray=types.toArray();
  CodeStream streams[]=new CodeStream[types.size()];
  for (int i=0; i < types.size(); i++) {
    streams[i]=new CodeStream("String_Node_Str" + typesArray[i] + "String_Node_Str");
    code.append("String_Node_Str" + typesArray[i] + "String_Node_Str"+ i+ "String_Node_Str");
  }
  Object[] functionsArray=functions.toArray();
  for (int i=0; i < functions.size(); i++) {
    code.append("String_Node_Str" + functionsArray[i] + "String_Node_Str"+ i+ "String_Node_Str");
    for (int j=0; j < streams.length; j++) {
      try {
        streams[i].appendCodeBlock(functionsArray[i] + "String_Node_Str");
      }
 catch (      IllegalActionException ex) {
      }
    }
  }
  code.append("String_Node_Str" + types.size() + "String_Node_Str");
  code.append("String_Node_Str" + functions.size() + "String_Node_Str");
  code.append("String_Node_Str");
  for (int i=0; i < types.size(); i++) {
    for (int j=0; j < functions.size(); j++) {
      code.append(typesArray[i] + "String_Node_Str" + functionsArray[j]);
      if (i != types.size() - 1 || j != functions.size() - 1) {
        code.append("String_Node_Str");
      }
    }
    code.append("String_Node_Str");
  }
  code.append("String_Node_Str");
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate type resolution code.  Determine the proper code put into the source to support dynamic type resolution. First, find out the different types used in the model. Second, find out the different polymorphic functions used. (note: types and functions are independent of each other). Third, append code blocks according to the functions used, and read from files according to the types referenced. Fourth, generate type resolution code, which consists of constants (MAX_NUM_TYPE, MAX_NUM_FUNC), the type map, the function map, function definitions read from the files, and function table.
 * @return The type resolution code.
 * @throws IllegalActionException If an error ocurrs when generatingthe type resolution code, or if the helper class for the model director cannot be found, or if an error occurs when the helper actor generates the type resolution code. 
 */
public String generateTypeResolutionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(comment("String_Node_Str" + getContainer().getFullName()));
  TypedCompositeActor compositeActorHelper=(TypedCompositeActor)_getHelper(getContainer());
  Iterator actors=((ptolemy.actor.CompositeActor)compositeActorHelper.getComponent()).deepEntityList().iterator();
  HashSet functions=new HashSet();
  while (actors.hasNext()) {
    Actor actor=(Actor)actors.next();
    CodeGeneratorHelper helperObject=(CodeGeneratorHelper)_getHelper((NamedObj)actor);
    Object info=helperObject.getInfo(CodeGeneratorHelper.FIELD_TYPEFUNC);
    if (info != null) {
      functions.addAll((HashSet)info);
    }
  }
  HashSet types=new HashSet();
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  types.add("String_Node_Str");
  Object[] typesArray=types.toArray();
  CodeStream streams[]=new CodeStream[types.size()];
  for (int i=0; i < types.size(); i++) {
    streams[i]=new CodeStream("String_Node_Str" + typesArray[i] + "String_Node_Str");
    code.append("String_Node_Str" + typesArray[i] + "String_Node_Str"+ i+ "String_Node_Str");
  }
  Object[] functionsArray=functions.toArray();
  for (int i=0; i < functions.size(); i++) {
    code.append("String_Node_Str" + functionsArray[i] + "String_Node_Str"+ i+ "String_Node_Str");
    for (int j=0; j < streams.length; j++) {
      try {
        streams[i].appendCodeBlock(functionsArray[i] + "String_Node_Str");
      }
 catch (      IllegalActionException ex) {
      }
    }
  }
  code.append("String_Node_Str" + types.size() + "String_Node_Str");
  code.append("String_Node_Str" + functions.size() + "String_Node_Str");
  code.append("String_Node_Str");
  for (int i=0; i < types.size(); i++) {
    for (int j=0; j < functions.size(); j++) {
      code.append(typesArray[i] + "String_Node_Str" + functionsArray[j]);
      if (i != types.size() - 1 || j != functions.size() - 1) {
        code.append("String_Node_Str");
      }
    }
    code.append("String_Node_Str");
  }
  code.append("String_Node_Str");
  return code.toString();
}