nus-yam/ex-repair huggingface dataset:
Program: 72877
Project: 72877
Buggy source:
/** 
 * Execute the OntologySolver's algorithm to resolve which Concepts in the Ontology are assigned to each object in the model.
 * @exception KernelException If the ontology resolution fails.
 */
public abstract void resolveConcepts() throws KernelException ;

Fixed version (ground truth):
/** 
 * Execute the OntologySolver's algorithm to resolve which Concepts in the Ontology are assigned to each object in the model.
 * @exception IllegalActionException If the ontology resolution fails.
 */
public abstract void resolveConcepts() throws IllegalActionException ;
Program: 72878
Project: 72878
Buggy source:
/** 
 * Return the package name that contains the class of this solver.
 * @param solver The ontology solver for which we get the adapter package name.
 * @return The package name.
 * @exception IllegalActionException Thrown if there is a problemgetting the ontology package name.
 */
protected static String _getPackageName(OntologySolverBase solver) throws IllegalActionException {
  return solver.getClass().getPackage().getName() + "String_Node_Str" + solver.getOntology().getName();
}

Fixed version (ground truth):
/** 
 * Return the package name that contains the class of this solver.
 * @param solver The ontology solver for which we get the adapter package name.
 * @return The package name.
 * @exception IllegalActionException Thrown if there is a problemgetting the ontology package name.
 */
protected static String _getPackageName(OntologySolverBase solver) throws IllegalActionException {
  Ontology ontology=solver.getOntology();
  if (ontology == null) {
    throw new IllegalActionException(solver,"String_Node_Str");
  }
  return solver.getClass().getPackage().getName() + "String_Node_Str" + ontology.getName();
}
Program: 72879
Project: 72879
Buggy source:
/** 
 * Called when the gui "Resolve Concepts" menu action is clicked. This method calls the OntologySolver's MoML handler to invoke the solver and perform the ontology solver concept resolution.
 * @param e The action event that is passed in when the actionis triggered.
 */
public void actionPerformed(ActionEvent e){
  super.actionPerformed(e);
  NamedObj container=getContainer();
  if (container instanceof OntologySolver) {
    ((OntologySolver)container).invokeSolver();
  }
}

Fixed version (ground truth):
/** 
 * Called when the gui "Resolve Concepts" menu action is clicked. This method calls the OntologySolver's MoML handler to invoke the solver and perform the ontology solver concept resolution.
 * @param e The action event that is passed in when the actionis triggered.
 */
public void actionPerformed(ActionEvent e){
  super.actionPerformed(e);
  NamedObj container=getContainer();
  if (container instanceof OntologySolver) {
    try {
      ((OntologySolver)container).invokeSolver();
    }
 catch (    IllegalActionException e1) {
      MessageHandler.error("String_Node_Str",e1);
    }
  }
}
Program: 72880
Project: 72880
Buggy source:
/** 
 * Create an editor for configuring the specified object with the specified parent window.
 * @param object The object to configure.
 * @param parent The parent window, or null if there is none.
 */
public void createEditor(NamedObj object,Frame parent){
  OntologySolver solver=(OntologySolver)getContainer();
  try {
    workspace().getWriteAccess();
    solver.invokeSolver();
  }
  finally {
    workspace().doneWriting();
  }
}

Fixed version (ground truth):
/** 
 * Create an editor for configuring the specified object with the specified parent window.
 * @param object The object to configure.
 * @param parent The parent window, or null if there is none.
 */
public void createEditor(NamedObj object,Frame parent){
  OntologySolver solver=(OntologySolver)getContainer();
  try {
    workspace().getWriteAccess();
    try {
      solver.invokeSolver();
    }
 catch (    IllegalActionException e1) {
      MessageHandler.error("String_Node_Str",e1);
    }
  }
  finally {
    workspace().doneWriting();
  }
}
Program: 72881
Project: 72881
Buggy source:
/** 
 * Resolve the concept values for the toplevel entity that contains this solver, given the model analyzer that invokes this.
 * @exception KernelException If there is an exception thrown during the OntologySolverresolution.
 */
public void resolveConcepts() throws KernelException {
  NamedObj toplevel=_toplevel();
  _resolveConcepts(toplevel,_initialConstraintList);
}

Fixed version (ground truth):
/** 
 * Resolve the concept values for the toplevel entity that contains this solver, given the model analyzer that invokes this.
 * @exception IllegalActionException If there is an exception thrown during the OntologySolverresolution.
 */
public void resolveConcepts() throws IllegalActionException {
  NamedObj toplevel=_toplevel();
  _resolveConcepts(toplevel,_initialConstraintList);
}
Program: 72885
Project: 72885
Buggy source:
/** 
 * Construct an actor in the specified container with the specified name.
 * @param container The container.
 * @param name The name of this adder within the container.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the name coincides withan actor already in the container.
 */
public AddSubtract(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  plus=new TypedIOPort(this,"String_Node_Str",true,false);
  plus.setMultiport(true);
  minus=new TypedIOPort(this,"String_Node_Str",true,false);
  minus.setMultiport(true);
  output=new TypedIOPort(this,"String_Node_Str",false,true);
  output.setTypeAtLeast(plus);
  output.setTypeAtLeast(minus);
  plus.setTypeSameAs(minus);
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an actor in the specified container with the specified name.
 * @param container The container.
 * @param name The name of this adder within the container.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the name coincides withan actor already in the container.
 */
public AddSubtract(CompositeEntity container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  plus=new TypedIOPort(this,"String_Node_Str",true,false);
  plus.setMultiport(true);
  plus.setDynamic(true);
  minus=new TypedIOPort(this,"String_Node_Str",true,false);
  minus.setMultiport(true);
  minus.setDynamic(true);
  output=new TypedIOPort(this,"String_Node_Str",false,true);
  output.setTypeAtLeast(plus);
  output.setTypeAtLeast(minus);
  plus.setTypeSameAs(minus);
  _attachText("String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 72887
Project: 72887
Buggy source:
/** 
 * Return the list of quantity managers in this port. A quantity manager is a   {@link Parameter} whose value is an{@link ObjectToken} that references an object that implementsthe  {@link QuantityManager} interface.
 * @return The list of quantity managers.
 * @exception IllegalActionException Thrown if the token of the parametercontaining the quantity manager object cannot be retrieved.
 */
public List<QuantityManager> getQuantityManagers() throws IllegalActionException {
  _qmList=new ArrayList<QuantityManager>();
  List<ResourceAttributes> list=this.attributeList(ResourceAttributes.class);
  for (  ResourceAttributes attribute : list) {
    if (attribute.enabled()) {
      if ((QuantityManager)attribute.getDecorator() != null) {
        _qmList.add((QuantityManager)attribute.getDecorator());
        attribute.validateSettables();
      }
    }
  }
  _qmListValid=true;
  return _qmList;
}

Fixed version (ground truth):
/** 
 * Return the list of quantity managers in this port. A quantity manager is a   {@link Parameter} whose value is an{@link ObjectToken} that references an object that implementsthe  {@link QuantityManager} interface.
 * @return The list of quantity managers.
 * @exception IllegalActionException Thrown if the token of the parametercontaining the quantity manager object cannot be retrieved.
 */
public List<QuantityManager> getQuantityManagers() throws IllegalActionException {
  if (_qmList == null) {
    _qmList=new ArrayList<QuantityManager>();
  }
  List<ResourceAttributes> list=this.attributeList(ResourceAttributes.class);
  for (  ResourceAttributes attribute : list) {
    QuantityManager qm=(QuantityManager)attribute.getDecorator();
    if (qm != null) {
      if (attribute.enabled()) {
        if (!_qmList.contains(qm)) {
          _qmList.add(qm);
          attribute.validateSettables();
        }
      }
 else {
        _qmList.remove(qm);
      }
    }
  }
  _qmListValid=true;
  return _qmList;
}
Program: 72888
Project: 72888
Buggy source:
/** 
 * If a quantity manager is added, removed or modified, invalidate the list of quantity managers which is read again in the preinitialize phase.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException Thrown if the new color attribute cannotbe created.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute instanceof Parameter) {
    Token parameterToken=((Parameter)attribute).getToken();
    if (parameterToken != null) {
      if (parameterToken instanceof ObjectToken && ((ObjectToken)parameterToken).getValue() instanceof QuantityManager) {
        _qmListValid=false;
      }
    }
  }
  super.attributeChanged(attribute);
}

Fixed version (ground truth):
/** 
 * If a quantity manager is added, removed or modified, invalidate the list of quantity managers which is read again in the preinitialize phase.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException Thrown if the new color attribute cannotbe created.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute instanceof ResourceAttributes) {
    Decorator decorator=((ResourceAttributes)attribute).getDecorator();
    if (decorator != null && decorator instanceof QuantityManager) {
      _qmListValid=false;
      createReceivers();
    }
  }
  super.attributeChanged(attribute);
}
Program: 72889
Project: 72889
Buggy source:
/** 
 * Constructor to use when parsing a MoML file.
 * @param target The object being decorated.
 * @param name The name of this attribute.
 * @throws IllegalActionException If the superclass throws it.
 * @throws NameDuplicationException If the superclass throws it.
 */
public QMAttributes(NamedObj target,String name) throws IllegalActionException, NameDuplicationException {
  super(target,name);
  _init();
}

Fixed version (ground truth):
/** 
 * Constructor to use when parsing a MoML file.
 * @param target The object being decorated.
 * @param name The name of this attribute.
 * @throws IllegalActionException If the superclass throws it.
 * @throws NameDuplicationException If the superclass throws it.
 */
public QMAttributes(NamedObj target,String name) throws IllegalActionException, NameDuplicationException {
  super(target,name);
}
Program: 72890
Project: 72890
Buggy source:
/** 
 * If attribute is <i>messageLength</i> report the new value  to the quantity manager. 
 * @param attribute The changed parameter.
 * @exception IllegalActionException If the parameter set is not valid.Not thrown in this class.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == messageLength) {
    IOPort port=(IOPort)getContainer();
    Bus bus=(Bus)getDecorator();
    if (bus != null) {
      Token token=messageLength.getToken();
      if (token != null) {
        bus.setMessageLength(port,((ScalarToken)token).doubleValue());
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * If attribute is <i>messageLength</i> report the new value  to the quantity manager. 
 * @param attribute The changed parameter.
 * @exception IllegalActionException If the parameter set is not valid.Not thrown in this class.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == messageLength) {
    if (enabled()) {
      IOPort port=(IOPort)getContainer();
      Bus bus=(Bus)getDecorator();
      if (bus != null) {
        Token token=messageLength.getToken();
        if (token != null) {
          bus.setMessageLength(port,((ScalarToken)token).doubleValue());
        }
      }
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 72891
Project: 72891
Buggy source:
/** 
 * React to a change in the input port attribute.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the change is not acceptableto this container (not thrown in this base class).
 */
@Override public void attributeChanged(Attribute attribute) throws IllegalActionException {
  if (attribute == inputPort) {
    _inputPort=((StringToken)((Parameter)attribute).getToken()).stringValue();
    IOPort port=(IOPort)getContainer();
    CompositeQuantityManager compositeQM=(CompositeQuantityManager)getDecorator();
    if (compositeQM != null) {
      compositeQM.setInputPortName(port,_inputPort);
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}

Fixed version (ground truth):
/** 
 * React to a change in the input port attribute.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If the change is not acceptableto this container (not thrown in this base class).
 */
@Override public void attributeChanged(Attribute attribute) throws IllegalActionException {
  IOPort port=(IOPort)getContainer();
  if (attribute == enable) {
    port.createReceivers();
  }
  if (attribute == inputPort) {
    _inputPort=((StringToken)((Parameter)attribute).getToken()).stringValue();
    CompositeQuantityManager compositeQM=(CompositeQuantityManager)getDecorator();
    if (compositeQM != null) {
      compositeQM.setInputPortName(port,_inputPort);
    }
  }
 else {
    super.attributeChanged(attribute);
  }
}
Program: 72892
Project: 72892
Buggy source:
public int getMicrostepForToken(Token t){
  Integer microstep=_transmittedTokenMicrosteps.get(t);
  if (_transmittedTokenCnt.get(t) != null) {
    _transmittedTokenCnt.put(t,_transmittedTokenCnt.get(t).intValue() - 1);
    if (_transmittedTokenCnt.get(t).intValue() == 0) {
      _transmittedTokenMicrosteps.remove(t);
      _transmittedTokenCnt.remove(t);
    }
    return microstep;
  }
 else {
    return 1;
  }
}

Fixed version (ground truth):
/** 
 * Get the microstep of the event that contained the token.
 * @param t The token.
 * @return The microstep.
 */
public int getMicrostepForToken(Token t){
  Integer microstep=_transmittedTokenMicrosteps.get(t);
  _transmittedTokenMicrosteps.remove(t);
  return microstep;
}
Program: 72893
Project: 72893
Buggy source:
/** 
 * Rename the variables, if any, in the dependentVariable that refer to the specified variableToRename.
 * @param node The root node of the parse tree.
 * @param dependentVariable The dependent variable.
 * @param variableToRename The variable to rename.
 * @param name The new name.
 */
public void renameVariables(ASTPtRootNode node,Variable dependentVariable,Variable variableToRename,String name) throws IllegalActionException {
  _scope=dependentVariable.getParserScope();
  _dependentVariable=dependentVariable;
  _variableToRename=variableToRename;
  _name=name;
  node.visit(this);
  _scope=null;
  _variableToRename=null;
  _name=null;
}

Fixed version (ground truth):
/** 
 * Rename the variables, if any, in the dependentVariable that refer to the specified variableToRename.
 * @param node The root node of the parse tree.
 * @param dependentVariable The dependent variable.
 * @param variableToRename The variable to rename.
 * @param name The new name.
 */
public void renameVariables(ASTPtRootNode node,Variable dependentVariable,Variable variableToRename,String name) throws IllegalActionException {
  _scope=dependentVariable.getParserScope();
  _dependentVariable=dependentVariable;
  _variableToRename=variableToRename;
  if (_dependentVariable.isStringMode()) {
    _name="String_Node_Str" + name;
  }
 else {
    _name=name;
  }
  node.visit(this);
  _scope=null;
  _variableToRename=null;
  _name=null;
}
Program: 72894
Project: 72894
Buggy source:
public void visitSumNode(ASTPtSumNode node) throws IllegalActionException {
  _writer.print("String_Node_Str");
  _printChildrenSeparated(node,node.getLexicalTokenList());
  _writer.print("String_Node_Str");
}

Fixed version (ground truth):
public void visitSumNode(ASTPtSumNode node) throws IllegalActionException {
  if (!_isStringMode) {
    _writer.print("String_Node_Str");
  }
  _printChildrenSeparated(node,node.getLexicalTokenList());
  if (!_isStringMode) {
    _writer.print("String_Node_Str");
  }
}
Program: 72895
Project: 72895
Buggy source:
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    _writer.print(node.getToken().toString());
  }
 else {
    _writer.print(node.getName());
  }
}

Fixed version (ground truth):
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    ptolemy.data.Token token=node.getToken();
    if (_isStringMode && (token instanceof StringToken)) {
      _writer.print(((StringToken)token).stringValue());
    }
 else {
      _writer.print(token.toString());
    }
  }
 else {
    _writer.print(node.getName());
  }
}
Program: 72897
Project: 72897
Buggy source:
/** 
 * Check whether the widths constraints are met.
 * @exception IllegalActionException If the width constraints or not met.
 */
public void checkWidthConstraints() throws IllegalActionException {
  int width=_getOutsideWidth(null);
  for (  Parameter parameter : _widthEqualToParameter) {
    IntToken t=(IntToken)parameter.getToken();
    if (t != null) {
      if (width != t.intValue()) {
        throw new IllegalActionException(this,"String_Node_Str" + width + "String_Node_Str"+ getFullName()+ "String_Node_Str"+ parameter+ "String_Node_Str"+ parameter.getContainer()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
  for (  IOPort port : _widthEqualToPort) {
    int otherWidth=port._getOutsideWidth(null);
    if (width != otherWidth) {
      throw new IllegalActionException(this,"String_Node_Str" + width + "String_Node_Str"+ getFullName()+ "String_Node_Str"+ otherWidth+ "String_Node_Str"+ port.getFullName()+ "String_Node_Str"+ "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
/** 
 * Check whether the widths constraints are met.
 * @exception IllegalActionException If the width constraints or not met.
 */
public void checkWidthConstraints() throws IllegalActionException {
  int width=_getOutsideWidth(null);
  for (  Parameter parameter : _widthEqualToParameter) {
    IntToken t=(IntToken)parameter.getToken();
    if (t != null) {
      if (width != t.intValue()) {
        throw new IllegalActionException(this,"String_Node_Str" + width + "String_Node_Str"+ getFullName()+ "String_Node_Str"+ parameter+ "String_Node_Str"+ parameter.getContainer()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
  for (  IOPort port : _widthEqualToPort) {
    int otherWidth=port._getOutsideWidth(null);
    if (width != otherWidth) {
      throw new IllegalActionException(this,"String_Node_Str" + width + "String_Node_Str"+ getFullName()+ "String_Node_Str"+ otherWidth+ "String_Node_Str"+ port.getFullName()+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    }
  }
}
Program: 72899
Project: 72899
Buggy source:
/** 
 * Generate the preinitialize code. We do not call the super method, because we have arguments to add here This code contains the different constructions and initializations.
 * @return The generated preinitialize Method code.
 * @exception IllegalActionException If thrown while appending to thethe block or processing the macros.
 */
@Override public String generatePreinitializeMethodBodyCode() throws IllegalActionException {
  CodeStream codeStream=_templateParser.getCodeStream();
  codeStream.clear();
  LinkedList args=new LinkedList();
  ptolemy.actor.CompositeActor TopActor=(ptolemy.actor.CompositeActor)getComponent();
  String sanitizedContainerName=CodeGeneratorAdapter.generateName(TopActor);
  if ((ptolemy.actor.CompositeActor)getComponent().getContainer() == null) {
    codeStream.append(_eol + sanitizedContainerName + "String_Node_Str");
    codeStream.append(_eol + sanitizedContainerName + "String_Node_Str");
    codeStream.append(_eol + sanitizedContainerName + "String_Node_Str"+ _eol);
  }
  args.clear();
  args.add(sanitizedContainerName + "String_Node_Str");
  codeStream.appendCodeBlock("String_Node_Str",args);
  return processCode(codeStream.toString());
}

Fixed version (ground truth):
/** 
 * Generate the preinitialize code. We do not call the super method, because we have arguments to add here This code contains the different constructions and initializations.
 * @return The generated preinitialize Method code.
 * @exception IllegalActionException If thrown while appending to thethe block or processing the macros.
 */
@Override public String generatePreinitializeMethodBodyCode() throws IllegalActionException {
  CodeStream codeStream=_templateParser.getCodeStream();
  codeStream.clear();
  LinkedList args=new LinkedList();
  ptolemy.actor.CompositeActor TopActor=(ptolemy.actor.CompositeActor)getComponent();
  String sanitizedContainerName=CodeGeneratorAdapter.generateName(TopActor);
  if (TopActor.getContainer() == null || TopActor instanceof ptolemy.cg.lib.CompiledCompositeActor) {
    codeStream.append(_eol + sanitizedContainerName + "String_Node_Str");
    codeStream.append(_eol + sanitizedContainerName + "String_Node_Str");
    codeStream.append(_eol + sanitizedContainerName + "String_Node_Str"+ _eol);
  }
  args.clear();
  args.add(sanitizedContainerName + "String_Node_Str");
  codeStream.appendCodeBlock("String_Node_Str",args);
  return processCode(codeStream.toString());
}
Program: 72903
Project: 72903
Buggy source:
/** 
 * Generate the initialization procedure entry point.
 * @return a string for the initialization procedure entry point.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateInitializeEntryCode() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ _sanitizedModelName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}

Fixed version (ground truth):
/** 
 * Generate the initialization procedure entry point.
 * @return a string for the initialization procedure entry point.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateInitializeEntryCode() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    String escapeName=_sanitizedModelName.replaceAll("String_Node_Str","String_Node_Str");
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ escapeName+ "String_Node_Str"+ "String_Node_Str"+ _eol+ "String_Node_Str"+ _eol+ "String_Node_Str";
  }
}
Program: 72905
Project: 72905
Buggy source:
/** 
 * Generate the postfire procedure entry point.
 * @return a string for the postfire procedure entry point.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generatePostfireEntryCode() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ _sanitizedModelName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}

Fixed version (ground truth):
/** 
 * Generate the postfire procedure entry point.
 * @return a string for the postfire procedure entry point.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generatePostfireEntryCode() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    String escapeName=_sanitizedModelName.replaceAll("String_Node_Str","String_Node_Str");
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ escapeName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}
Program: 72906
Project: 72906
Buggy source:
/** 
 * Generate the wrapup procedure entry point.
 * @return a string for the wrapup procedure entry point.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateWrapupEntryCode() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ _sanitizedModelName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}

Fixed version (ground truth):
/** 
 * Generate the wrapup procedure entry point.
 * @return a string for the wrapup procedure entry point.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateWrapupEntryCode() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    String escapeName=_sanitizedModelName.replaceAll("String_Node_Str","String_Node_Str");
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ escapeName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}
Program: 72907
Project: 72907
Buggy source:
/** 
 * Generate the initialization procedure name.
 * @return a string for the initialization procedure name.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateInitializeProcedureName() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ _sanitizedModelName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}

Fixed version (ground truth):
/** 
 * Generate the initialization procedure name.
 * @return a string for the initialization procedure name.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateInitializeProcedureName() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + _eol + "String_Node_Str"+ _eol;
  }
 else {
    String escapeName=_sanitizedModelName.replaceAll("String_Node_Str","String_Node_Str");
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ escapeName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}
Program: 72908
Project: 72908
Buggy source:
/** 
 * Generate the wrapup procedure name.
 * @return a string for the wrapup procedure name.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateWrapupProcedureName() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + "String_Node_Str" + _eol;
  }
 else {
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ _sanitizedModelName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}

Fixed version (ground truth):
/** 
 * Generate the wrapup procedure name.
 * @return a string for the wrapup procedure name.
 * @exception IllegalActionException Not thrown in this base class.
 */
public String generateWrapupProcedureName() throws IllegalActionException {
  if (_isTopLevel()) {
    return _eol + "String_Node_Str" + _eol;
  }
 else {
    String escapeName=_sanitizedModelName.replaceAll("String_Node_Str","String_Node_Str");
    return _eol + _eol + "String_Node_Str"+ _eol+ "String_Node_Str"+ escapeName+ "String_Node_Str"+ "String_Node_Str"+ _eol;
  }
}
Program: 72909
Project: 72909
Buggy source:
/** 
 * Compile the Java code. The <code>javac</code> and <code>javah</code> commands are executed on the the java file.
 * @exception IllegalActionException If there is a problem readingthe <i>codeDirectory</i> parameter.
 */
protected void _compileJNICode() throws IllegalActionException {
  StringBufferExec executeCommands=new StringBufferExec(true);
  List<String> commands=new LinkedList<String>();
  commands.add("String_Node_Str" + _sanitizedActorName + "String_Node_Str");
  commands.add("String_Node_Str" + _sanitizedActorName);
  if (_debugging) {
    _debugAndSystemOut("String_Node_Str" + commands.get(0));
    _debugAndSystemOut("String_Node_Str" + commands.get(1));
  }
  executeCommands.setWorkingDirectory(codeDirectory.asFile());
  executeCommands.setCommands(commands);
  executeCommands.start();
  int lastSubprocessReturnCode=executeCommands.getLastSubprocessReturnCode();
  if (lastSubprocessReturnCode != 0) {
    throw new IllegalActionException(this,"String_Node_Str" + lastSubprocessReturnCode + "String_Node_Str"+ executeCommands.buffer.toString());
  }
}

Fixed version (ground truth):
/** 
 * Compile the Java code. The <code>javac</code> and <code>javah</code> commands are executed on the the java file.
 * @exception IllegalActionException If there is a problem readingthe <i>codeDirectory</i> parameter.
 */
protected void _compileJNICode() throws IllegalActionException {
  StringBufferExec executeCommands=new StringBufferExec(true);
  List<String> commands=new LinkedList<String>();
  commands.add("String_Node_Str" + _sanitizedActorName + "String_Node_Str");
  if (_debugging) {
    _debugAndSystemOut("String_Node_Str" + commands.get(0));
  }
  executeCommands.setWorkingDirectory(codeDirectory.asFile());
  executeCommands.setCommands(commands);
  executeCommands.start();
  int lastSubprocessReturnCode=executeCommands.getLastSubprocessReturnCode();
  if (lastSubprocessReturnCode != 0) {
    throw new IllegalActionException(this,"String_Node_Str" + lastSubprocessReturnCode + "String_Node_Str"+ executeCommands.buffer.toString());
  }
}
Program: 72922
Project: 72922
Buggy source:
/** 
 * Generate the postfire code of the associated controller. We generate a switch because we only need to call the postfire method of the current state.
 * @return The postfire code of the associated controller.
 * @exception IllegalActionException If the adapter associated withan actor throws it while generating postfire code for the actor
 */
@Override public String generatePostfireCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  String name=_myController.getFullName().substring(1);
  String modalName=name.replace("String_Node_Str","String_Node_Str");
  name=name.replace('.','_');
  modalName=modalName.replace('.','_');
  code.append(_eol + "String_Node_Str" + name+ "String_Node_Str");
  Iterator states=_myController.entityList().iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    String stateName=CodeGeneratorAdapter.generateName(state);
    code.append(_eol + "String_Node_Str" + stateName+ "String_Node_Str");
    Actor[] actors=state.getRefinement();
    if (actors != null) {
      for (      Actor actor : actors) {
        NamedProgramCodeGeneratorAdapter actorHelper=(NamedProgramCodeGeneratorAdapter)getCodeGenerator().getAdapter(actor);
        code.append(_eol + actorHelper.generatePostfireCode());
      }
    }
    code.append(_eol + "String_Node_Str" + _eol+ "String_Node_Str");
  }
  code.append(_eol + "String_Node_Str" + _eol+ "String_Node_Str");
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate the postfire code of the associated controller. We generate a switch because we only need to call the postfire method of the current state.
 * @return The postfire code of the associated controller.
 * @exception IllegalActionException If the adapter associated withan actor throws it while generating postfire code for the actor
 */
@Override public String generatePostfireCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  String name=_myController.getFullName().substring(1);
  name=name.replace('.','_');
  code.append(_eol + "String_Node_Str" + name+ "String_Node_Str");
  Iterator states=_myController.entityList().iterator();
  while (states.hasNext()) {
    State state=(State)states.next();
    String stateName=CodeGeneratorAdapter.generateName(state);
    code.append(_eol + "String_Node_Str" + stateName+ "String_Node_Str");
    Actor[] actors=state.getRefinement();
    if (actors != null) {
      for (      Actor actor : actors) {
        NamedProgramCodeGeneratorAdapter actorHelper=(NamedProgramCodeGeneratorAdapter)getCodeGenerator().getAdapter(actor);
        code.append(_eol + actorHelper.generatePostfireCode());
      }
    }
    code.append(_eol + "String_Node_Str" + _eol+ "String_Node_Str");
  }
  code.append(_eol + "String_Node_Str" + _eol+ "String_Node_Str");
  return code.toString();
}
Program: 72923
Project: 72923
Buggy source:
/** 
 * Generate code for the firing of refinements.
 * @param code The string buffer that the generated code is appended to.
 * @exception IllegalActionException If the helper associated withan actor throws it while generating fire code for the actor.
 */
protected void _generateRefinementCode(StringBuffer code) throws IllegalActionException {
  String name=_myController.getFullName().substring(1);
  String modalName=name.replace("String_Node_Str","String_Node_Str");
  name=name.replace('.','_');
  modalName=modalName.replace('.','_');
  int depth=1;
  code.append(_getIndentPrefix(depth));
  code.append("String_Node_Str" + name + "String_Node_Str"+ _eol);
  Iterator states=_myController.entityList().iterator();
  depth++;
  while (states.hasNext()) {
    code.append(_getIndentPrefix(depth));
    depth++;
    State state=(State)states.next();
    code.append("String_Node_Str" + CodeGeneratorAdapter.generateName(state) + "String_Node_Str"+ _eol);
    Actor[] actors=state.getRefinement();
    if (actors != null) {
      for (      Actor actor : actors) {
        NamedProgramCodeGeneratorAdapter actorHelper=(NamedProgramCodeGeneratorAdapter)getCodeGenerator().getAdapter(actor);
        code.append(actorHelper.generateFireCode());
      }
    }
    code.append(_getIndentPrefix(depth));
    code.append("String_Node_Str" + _eol);
    depth--;
  }
  depth--;
  code.append(_getIndentPrefix(depth));
  code.append("String_Node_Str" + _eol);
}

Fixed version (ground truth):
/** 
 * Generate code for the firing of refinements.
 * @param code The string buffer that the generated code is appended to.
 * @exception IllegalActionException If the helper associated withan actor throws it while generating fire code for the actor.
 */
protected void _generateRefinementCode(StringBuffer code) throws IllegalActionException {
  String name=_myController.getFullName().substring(1);
  name=name.replace('.','_');
  int depth=1;
  code.append(_getIndentPrefix(depth));
  code.append("String_Node_Str" + name + "String_Node_Str"+ _eol);
  Iterator states=_myController.entityList().iterator();
  depth++;
  while (states.hasNext()) {
    code.append(_getIndentPrefix(depth));
    depth++;
    State state=(State)states.next();
    code.append("String_Node_Str" + CodeGeneratorAdapter.generateName(state) + "String_Node_Str"+ _eol);
    Actor[] actors=state.getRefinement();
    if (actors != null) {
      for (      Actor actor : actors) {
        NamedProgramCodeGeneratorAdapter actorHelper=(NamedProgramCodeGeneratorAdapter)getCodeGenerator().getAdapter(actor);
        code.append(actorHelper.generateFireCode());
      }
    }
    code.append(_getIndentPrefix(depth));
    code.append("String_Node_Str" + _eol);
    depth--;
  }
  depth--;
  code.append(_getIndentPrefix(depth));
  code.append("String_Node_Str" + _eol);
}
Program: 72924
Project: 72924
Buggy source:
/** 
 * Generate the fire code of the associated controller. All the steps are described below It is slightly different from the super class in order to take into account the receivers (if embedded in a DE model)
 * @return The fire code of the associated controller.
 * @exception IllegalActionException If the adapter associated withan actor throws it while generating fire code for the actor
 */
public String generateFireCode() throws IllegalActionException {
  FSMActor controllerHelper;
  try {
    controllerHelper=new FSMActor(_myController);
    controllerHelper.setCodeGenerator(getCodeGenerator());
    controllerHelper.setTemplateParser(getTemplateParser());
  }
 catch (  NameDuplicationException ndx) {
    throw new IllegalActionException(ndx.toString());
  }
  StringBuffer code=new StringBuffer();
  String name=_myController.getFullName().substring(1);
  String modalName=name.replace("String_Node_Str","String_Node_Str");
  name=name.replace('.','_');
  modalName=modalName.replace('.','_');
  code.append(_eol + getCodeGenerator().comment("String_Node_Str"));
  controllerHelper.generateTransitionCode(code,new PreemptiveTransitions());
  code.append(_eol);
  code.append("String_Node_Str" + modalName + "String_Node_Str"+ _eol);
  _generateRefinementCode(code);
  code.append(getCodeGenerator().comment("String_Node_Str"));
  controllerHelper.generateTransitionCode(code,new NonPreemptiveTransitions());
  code.append("String_Node_Str" + _eol);
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate the fire code of the associated controller. All the steps are described below It is slightly different from the super class in order to take into account the receivers (if embedded in a DE model)
 * @return The fire code of the associated controller.
 * @exception IllegalActionException If the adapter associated withan actor throws it while generating fire code for the actor
 */
public String generateFireCode() throws IllegalActionException {
  FSMActor controllerHelper;
  try {
    controllerHelper=new FSMActor(_myController);
    controllerHelper.setCodeGenerator(getCodeGenerator());
    controllerHelper.setTemplateParser(getTemplateParser());
  }
 catch (  NameDuplicationException ndx) {
    throw new IllegalActionException(ndx.toString());
  }
  StringBuffer code=new StringBuffer();
  String name=_myController.getFullName().substring(1);
  String modalName=name.replace("String_Node_Str","String_Node_Str");
  modalName=modalName.replace('.','_');
  code.append(_eol + getCodeGenerator().comment("String_Node_Str"));
  controllerHelper.generateTransitionCode(code,new PreemptiveTransitions());
  code.append(_eol);
  code.append("String_Node_Str" + modalName + "String_Node_Str"+ _eol);
  _generateRefinementCode(code);
  code.append(getCodeGenerator().comment("String_Node_Str"));
  controllerHelper.generateTransitionCode(code,new NonPreemptiveTransitions());
  code.append("String_Node_Str" + _eol);
  return code.toString();
}
Program: 72927
Project: 72927
Buggy source:
/** 
 * Return true to indicate that this decorator should decorate objects across opaque hierarchy boundaries.
 */
public boolean isGlobalDecorator(){
  return false;
}

Fixed version (ground truth):
/** 
 * Return true to indicate that this decorator should decorate objects across opaque hierarchy boundaries.
 */
public boolean isGlobalDecorator(){
  return true;
}
Program: 72930
Project: 72930
Buggy source:
/** 
 * Initiate a send of the specified token to the specified receiver. This method will schedule a refiring of this actor if there is not one already scheduled.
 * @param source Sender of the token.
 * @param receiver The receiver to send to.
 * @param token The token to send.
 * @exception IllegalActionException If the refiring request fails.
 */
public void sendToken(Receiver source,Receiver receiver,Token token) throws IllegalActionException {
  String name=_cqmInputPortName.get(receiver.getContainer());
  CQMInputPort port=(CQMInputPort)getEntity(name);
  if (port == null) {
    throw new IllegalActionException(this,"String_Node_Str" + name + "String_Node_Str"+ receiver.getContainer()+ "String_Node_Str");
  }
  if (_tokens == null) {
    _tokens=new HashMap<CQMInputPort,Token>();
  }
  RecordToken recordToken=new RecordToken(new String[]{"String_Node_Str","String_Node_Str"},new Token[]{new ObjectToken(receiver),token});
  _tokens.put(port,recordToken);
  if (_justMonitor) {
    receiver.put(token);
  }
  ((CompositeActor)getContainer()).getDirector().fireAtCurrentTime(this);
  if (_debugging) {
    _debug("String_Node_Str" + getDirector().getModelTime() + "String_Node_Str"+ receiver.getContainer().getFullName()+ "String_Node_Str"+ token);
  }
}

Fixed version (ground truth):
/** 
 * Initiate a send of the specified token to the specified receiver. This method will schedule a refiring of this actor if there is not one already scheduled.
 * @param source Sender of the token.
 * @param receiver The receiver to send to.
 * @param token The token to send.
 * @exception IllegalActionException If the refiring request fails.
 */
public void sendToken(Receiver source,Receiver receiver,Token token) throws IllegalActionException {
  String name=_cqmInputPortName.get(receiver.getContainer());
  CQMInputPort port=(CQMInputPort)getEntity(name);
  if (port == null) {
    throw new IllegalActionException(this,"String_Node_Str" + name + "String_Node_Str"+ receiver.getContainer()+ "String_Node_Str");
  }
  if (_tokens == null) {
    _tokens=new HashMap<CQMInputPort,Token>();
  }
  if (token != null) {
    RecordToken recordToken=new RecordToken(new String[]{"String_Node_Str","String_Node_Str"},new Token[]{new ObjectToken(receiver),token});
    _tokens.put(port,recordToken);
    if (_justMonitor) {
      receiver.put(token);
    }
    ((CompositeActor)getContainer()).getDirector().fireAtCurrentTime(this);
    if (_debugging) {
      _debug("String_Node_Str" + getDirector().getModelTime() + "String_Node_Str"+ receiver.getContainer().getFullName()+ "String_Node_Str"+ token);
    }
  }
}
Program: 72931
Project: 72931
Buggy source:
/** 
 * Generate The postfire function code for a SDF director. 
 * @return The postfire function code.
 * @exception IllegalActionException If thrown while generating fire code.
 */
public String generatePostFireFunctionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + "String_Node_Str" + _sanitizedDirectorName+ "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + "String_Node_Str");
  code.append(_eol + "String_Node_Str");
  Attribute period=_director.getAttribute("String_Node_Str");
  if (period != null) {
    Double periodValue=((DoubleToken)((Variable)period).getToken()).doubleValue();
    if (periodValue != 0.0) {
      code.append(_sanitizedDirectorName + "String_Node_Str" + periodValue+ "String_Node_Str"+ _eol);
    }
  }
  code.append(_eol + "String_Node_Str");
  return code.toString();
}

Fixed version (ground truth):
/** 
 * Generate The postfire function code for a SDF director. 
 * @return The postfire function code.
 * @exception IllegalActionException If thrown while generating fire code.
 */
public String generatePostFireFunctionCode() throws IllegalActionException {
  StringBuffer code=new StringBuffer();
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + "String_Node_Str" + _sanitizedDirectorName+ "String_Node_Str"+ _sanitizedDirectorName+ "String_Node_Str");
  code.append(_eol + _sanitizedDirectorName + "String_Node_Str");
  code.append(_eol + "String_Node_Str");
  code.append(_eol + "String_Node_Str");
  Attribute period=_director.getAttribute("String_Node_Str");
  if (period != null) {
    Double periodValue=((DoubleToken)((Variable)period).getToken()).doubleValue();
    if (periodValue != 0.0) {
      code.append(_sanitizedDirectorName + "String_Node_Str" + periodValue+ "String_Node_Str"+ _eol);
    }
  }
  code.append(_eol + "String_Node_Str");
  return code.toString();
}
Program: 72932
Project: 72932
Buggy source:
private void populateArrays() throws IllegalActionException {
  Token transToken=new Token();
  if (_modelType == _HMM) {
    transToken=transitionMatrix.get(0);
  }
  Token meanToken=mean.get(0);
  Token stdToken=standardDeviation.get(0);
  Token priorToken=prior.get(0);
  Token observationArray=input.get(0);
  _nStates=((ArrayToken)meanToken).length();
  _meanEstimate=new double[_nStates];
  _stDeviationEstimate=new double[_nStates];
  _transitionMatrixEstimate=new double[_nStates][_nStates];
  _priors=new double[_nStates];
  _classificationLength=((ArrayToken)observationArray).length();
  _observations=new double[_classificationLength];
  for (int i=0; i < _classificationLength; i++) {
    _observations[i]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
  }
  for (int i=0; i < _nStates; i++) {
    _stDeviationEstimate[i]=((DoubleToken)((ArrayToken)stdToken).getElement(i)).doubleValue();
    _meanEstimate[i]=((DoubleToken)((ArrayToken)meanToken).getElement(i)).doubleValue();
    _priors[i]=((DoubleToken)((ArrayToken)priorToken).getElement(i)).doubleValue();
    if (_modelType == _HMM) {
      for (int j=0; j < _nStates; j++) {
        _transitionMatrixEstimate[i][j]=((DoubleToken)((MatrixToken)transToken).getElementAsToken(i,j)).doubleValue();
      }
    }
  }
}

Fixed version (ground truth):
private void populateArrays() throws IllegalActionException {
  Token observationArray=input.get(0);
  _classificationLength=((ArrayToken)observationArray).length();
  _observations=new double[_classificationLength];
  for (int i=0; i < _classificationLength; i++) {
    _observations[i]=((DoubleToken)((ArrayToken)observationArray).getElement(i)).doubleValue();
  }
}
Program: 72937
Project: 72937
Buggy source:
/** 
 * Return true to indicate that this decorator should decorate objects across opaque hierarchy boundaries.
 */
public boolean isGlobalDecorator(){
  return true;
}

Fixed version (ground truth):
/** 
 * Return true to indicate that this decorator should decorate objects across opaque hierarchy boundaries.
 */
public boolean isGlobalDecorator(){
  return false;
}
Program: 72938
Project: 72938
Buggy source:
/** 
 * Return a list of the entities deeply contained by the container of this resource scheduler.
 * @return A list of the objects decorated by this decorator.
 */
public List<NamedObj> decoratedObjects(){
  CompositeEntity container=(CompositeEntity)getContainer();
  return container.deepEntityList();
}

Fixed version (ground truth):
/** 
 * Return a list of the entities deeply contained by the container of this resource scheduler.
 * @return A list of the objects decorated by this decorator.
 */
public List<NamedObj> decoratedObjects(){
  CompositeEntity container=(CompositeEntity)getContainer();
  return _getEntitiesToDecorate(container);
}
Program: 72939
Project: 72939
Buggy source:
/** 
 * Return the decorated attributes for the target NamedObj. If the specified target is not an Actor, return null.
 * @param target The NamedObj that will be decorated.
 * @return The decorated attributes for the target NamedObj, ornull if the specified target is not an Actor.
 */
public DecoratorAttributes createDecoratorAttributes(NamedObj target){
  if (target instanceof Actor) {
    try {
      return new ResourceAttributes(target,this);
    }
 catch (    KernelException ex) {
      throw new InternalErrorException(ex);
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Return the decorated attributes for the target NamedObj. If the specified target is not an Actor, return null.
 * @param target The NamedObj that will be decorated.
 * @return The decorated attributes for the target NamedObj, ornull if the specified target is not an Actor.
 */
public DecoratorAttributes createDecoratorAttributes(NamedObj target){
  if (target instanceof Actor && !(target instanceof ResourceScheduler)) {
    try {
      return new ResourceAttributes(target,this);
    }
 catch (    KernelException ex) {
      throw new InternalErrorException(ex);
    }
  }
 else {
    return null;
  }
}