Program: 72919
Project: 72919
Buggy source:
/** 
 * Generate the initialize code for the associated DE director.
 * @return The generated initialize code.
 * @exception IllegalActionException If the adapter associated withan actor throws it while generating initialize code for the actor.
 */
public String generateInitializeFunctionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  ptolemy.actor.Director director=(ptolemy.actor.Director)getComponent();
  CompositeActor container=((CompositeActor)_director.getContainer());
  List actorList=container.deepEntityList();
  String sanitizedContainerName=CodeGeneratorAdapter.generateName(container);
  ProgramCodeGenerator codeGenerator=getCodeGenerator();
  code.append(_eol + _eol + codeGenerator.comment("String_Node_Str"));
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  if (_director.isEmbedded()) {
    if (container instanceof CompositeActor) {
      ptolemy.actor.Director executiveDirector=container.getExecutiveDirector();
      if (executiveDirector instanceof SuperdenseTimeDirector) {
        code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ ((SuperdenseTimeDirector)executiveDirector).getIndex()+ "String_Node_Str");
      }
    }
  }
  Iterator<?> actors=actorList.iterator();
  while (actors.hasNext()) {
    NamedObj actor=(NamedObj)actors.next();
    String sanitizedActorName=CodeGeneratorAdapter.generateName(actor);
    code.append(_eol + sanitizedActorName + "String_Node_Str");
  }
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ sanitizedContainerName+ "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str");
  Attribute stopWhenQueueIsEmpty=director.getAttribute("String_Node_Str");
  boolean stopWhenQueueIsEmptyBool=((BooleanToken)((Variable)stopWhenQueueIsEmpty).getToken()).booleanValue();
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ stopWhenQueueIsEmptyBool+ "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  if (!director.getModelStopTime().isPositiveInfinite()) {
    code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str"+ "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str");
  }
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + codeGenerator.comment("String_Node_Str"));
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate the initialize code for the associated DE director.
 * @return The generated initialize code.
 * @exception IllegalActionException If the adapter associated withan actor throws it while generating initialize code for the actor.
 */
public String generateInitializeFunctionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  ptolemy.actor.Director director=(ptolemy.actor.Director)getComponent();
  CompositeActor container=((CompositeActor)_director.getContainer());
  List actorList=container.deepEntityList();
  String sanitizedContainerName=CodeGeneratorAdapter.generateName(container);
  ProgramCodeGenerator codeGenerator=getCodeGenerator();
  code.append(_eol + _eol + codeGenerator.comment("String_Node_Str"));
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  if (_director.isEmbedded()) {
    ptolemy.actor.Director executiveDirector=container.getExecutiveDirector();
    if (executiveDirector instanceof SuperdenseTimeDirector) {
      code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ ((SuperdenseTimeDirector)executiveDirector).getIndex()+ "String_Node_Str");
    }
  }
  Iterator<?> actors=actorList.iterator();
  while (actors.hasNext()) {
    NamedObj actor=(NamedObj)actors.next();
    String sanitizedActorName=CodeGeneratorAdapter.generateName(actor);
    code.append(_eol + sanitizedActorName + "String_Node_Str");
  }
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ sanitizedContainerName+ "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str");
  Attribute stopWhenQueueIsEmpty=director.getAttribute("String_Node_Str");
  boolean stopWhenQueueIsEmptyBool=((BooleanToken)((Variable)stopWhenQueueIsEmpty).getToken()).booleanValue();
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ stopWhenQueueIsEmptyBool+ "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  if (!director.getModelStopTime().isPositiveInfinite()) {
    code.append(_eol + _sanitizedDirectorName + "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str"+ "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str");
  }
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + codeGenerator.comment("String_Node_Str"));
  return code.toString();
}