Program: 72951
Project: 72951
Buggy source:
/** 
 * Generate the code for the firing of actors according to the SDF schedule.
 * @return The generated fire code.
 * @exception IllegalActionException If the SDF director does not have anattribute called "iterations" or a valid schedule, or the actor to be fired cannot find its associated adapter.
 */
public String generateFireCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(CodeStream.indent(getCodeGenerator().comment("String_Node_Str")));
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  ProgramCodeGenerator codeGenerator=getCodeGenerator();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    NamedProgramCodeGeneratorAdapter adapter=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    boolean inline=((BooleanToken)getCodeGenerator().inline.getToken()).booleanValue();
    if (inline) {
      for (int i=0; i < firing.getIterationCount(); i++) {
        code.append(adapter.generateFireCode());
        _generateUpdatePortOffsetCode(code,actor);
      }
    }
 else {
      int count=firing.getIterationCount();
      if (count > 1) {
        code.append("String_Node_Str" + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ count+ "String_Node_Str"+ _eol);
      }
      code.append(codeGenerator.generateFireFunctionMethodInvocation((NamedObj)actor) + "String_Node_Str" + _eol);
      _generateUpdatePortOffsetCode(code,actor);
      if (count > 1) {
        code.append("String_Node_Str" + _eol + "String_Node_Str"+ _eol);
      }
    }
  }
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate the code for the firing of actors according to the SDF schedule.
 * @return The generated fire code.
 * @exception IllegalActionException If the SDF director does not have anattribute called "iterations" or a valid schedule, or the actor to be fired cannot find its associated adapter.
 */
public String generateFireCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(CodeStream.indent(getCodeGenerator().comment("String_Node_Str")));
  ptolemy.actor.sched.StaticSchedulingDirector director=(ptolemy.actor.sched.StaticSchedulingDirector)getComponent();
  Schedule schedule=director.getScheduler().getSchedule();
  ProgramCodeGenerator codeGenerator=getCodeGenerator();
  Iterator<?> actorsToFire=schedule.firingIterator();
  while (actorsToFire.hasNext()) {
    Firing firing=(Firing)actorsToFire.next();
    Actor actor=firing.getActor();
    NamedProgramCodeGeneratorAdapter adapter=(NamedProgramCodeGeneratorAdapter)codeGenerator.getAdapter(actor);
    boolean inline=((BooleanToken)getCodeGenerator().inline.getToken()).booleanValue();
    if (inline) {
      for (int i=0; i < firing.getIterationCount(); i++) {
        code.append(adapter.generateFireCode());
        if (!(codeGenerator instanceof CCodeGenerator))         _generateUpdatePortOffsetCode(code,actor);
      }
    }
 else {
      int count=firing.getIterationCount();
      if (count > 1) {
        code.append("String_Node_Str" + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ count+ "String_Node_Str"+ _eol);
      }
      code.append(codeGenerator.generateFireFunctionMethodInvocation((NamedObj)actor) + "String_Node_Str" + _eol);
      if (!(codeGenerator instanceof CCodeGenerator))       _generateUpdatePortOffsetCode(code,actor);
      if (count > 1) {
        code.append("String_Node_Str" + _eol + "String_Node_Str"+ _eol);
      }
    }
  }
  return code.toString();
}