nus-yam/ex-repair huggingface dataset:
Program: 75102
Project: 75102
Buggy source:
/** 
 * Construct an empty window. After constructing this, it is necessary to call setVisible(true) to make the frame appear and setTableau() to associate it with a tableau.
 */
public ViewWindow(){
  super(null,null);
  this.getContentPane().setLayout(new BorderLayout(15,15));
}

Fixed version (ground truth):
/** 
 * Construct an empty window. After constructing this, it is necessary to call setVisible(true) to make the frame appear and setTableau() to associate it with a tableau.
 */
public ViewWindow(){
  super(null,null);
  hideMenuBar();
  this.getContentPane().setLayout(new BorderLayout(15,15));
}
Program: 75106
Project: 75106
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args){
  ArrayTest1 test=new ArrayTest1();
  test.$GET$CHECKPOINT().createCheckpoint();
  test.modify();
  test.$GET$CHECKPOINT().rollback(1,true);
  test.dump();
}

Fixed version (ground truth):
/** 
 * @param args
 */
public static void main(String[] args){
  ArrayTest1 test=new ArrayTest1();
  long handle=test.$GET$CHECKPOINT().createCheckpoint();
  test.modify();
  test.$GET$CHECKPOINT().rollback(handle,true);
  test.dump();
}
Program: 75107
Project: 75107
Buggy source:
private boolean _addLegendIfNecessary(boolean connected){
  if ((!_sawFirstDataSet || (_currentdataset < 0)) && !_reuseDatasets) {
    _sawFirstDataSet=true;
    _currentdataset++;
  }
  if (!_sawFirstDataSet && (getLegend(_currentdataset) == null)) {
    _firstInSet=true;
    _sawFirstDataSet=true;
    addLegend(_currentdataset,new String("String_Node_Str" + _currentdataset));
  }
  if (_firstInSet && !_reuseDatasets) {
    connected=false;
    _firstInSet=false;
  }
  return connected;
}

Fixed version (ground truth):
private boolean _addLegendIfNecessary(boolean connected){
  if ((!_sawFirstDataSet || (_currentdataset < 0)) && !_reuseDatasets) {
    _sawFirstDataSet=true;
    _currentdataset++;
  }
  if (!_sawFirstDataSet && (getLegend(_currentdataset) == null)) {
    _firstInSet=true;
    _sawFirstDataSet=true;
    addLegend(_currentdataset,"String_Node_Str" + _currentdataset);
  }
  if (_firstInSet && !_reuseDatasets) {
    connected=false;
    _firstInSet=false;
  }
  return connected;
}
Program: 75108
Project: 75108
Buggy source:
/** 
 * Initialize the PN actor.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _returnValue=true;
  N=((IntToken)parameter_N.getToken()).intValue();
  K=((IntToken)parameter_K.getToken()).intValue();
}

Fixed version (ground truth):
/** 
 * Initialize the PN actor.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  N=((IntToken)parameter_N.getToken()).intValue();
  K=((IntToken)parameter_K.getToken()).intValue();
}
Program: 75109
Project: 75109
Buggy source:
/** 
 * Construct an actor that is an SBF object with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ND_1(CompositeEntity aContainer,String aName) throws IllegalActionException, NameDuplicationException {
  super(aContainer,aName);
  WP_2=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_6=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_2.setTypeEquals(BaseType.DOUBLE);
  WP_6.setTypeEquals(BaseType.DOUBLE);
  parameter_N=new Parameter(this,"String_Node_Str",new IntToken(6));
  parameter_K=new Parameter(this,"String_Node_Str",new IntToken(6));
  x_1.ReadMatrix("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an actor that is an SBF object with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ND_1(CompositeEntity aContainer,String aName) throws IllegalActionException, NameDuplicationException {
  super(aContainer,aName);
  WP_2=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_6=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_2.setTypeEquals(BaseType.DOUBLE);
  WP_6.setTypeEquals(BaseType.DOUBLE);
  parameter_N=new Parameter(this,"String_Node_Str",new IntToken(6));
  parameter_K=new Parameter(this,"String_Node_Str",new IntToken(6));
  x_1.readMatrix("String_Node_Str");
}
Program: 75110
Project: 75110
Buggy source:
/** 
 * Initialize the PN actor.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _returnValue=true;
  N=((IntToken)parameter_N.getToken()).intValue();
  K=((IntToken)parameter_K.getToken()).intValue();
}

Fixed version (ground truth):
/** 
 * Initialize the PN actor.
 * @exception IllegalActionException If the parent class throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  N=((IntToken)parameter_N.getToken()).intValue();
  K=((IntToken)parameter_K.getToken()).intValue();
}
Program: 75111
Project: 75111
Buggy source:
/** 
 * Construct an actor that is an SBF object with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ND_2(CompositeEntity aContainer,String aName) throws IllegalActionException, NameDuplicationException {
  super(aContainer,aName);
  WP_4=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_8=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_4.setTypeEquals(BaseType.DOUBLE);
  WP_8.setTypeEquals(BaseType.DOUBLE);
  parameter_N=new Parameter(this,"String_Node_Str",new IntToken(6));
  parameter_K=new Parameter(this,"String_Node_Str",new IntToken(6));
  x_1.ReadMatrix("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Construct an actor that is an SBF object with the given container and name.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public ND_2(CompositeEntity aContainer,String aName) throws IllegalActionException, NameDuplicationException {
  super(aContainer,aName);
  WP_4=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_8=new TypedIOPort(this,"String_Node_Str",false,true);
  WP_4.setTypeEquals(BaseType.DOUBLE);
  WP_8.setTypeEquals(BaseType.DOUBLE);
  parameter_N=new Parameter(this,"String_Node_Str",new IntToken(6));
  parameter_K=new Parameter(this,"String_Node_Str",new IntToken(6));
  x_1.readMatrix("String_Node_Str");
}
Program: 75113
Project: 75113
Buggy source:
/** 
 * Restore the old value at the timestamp to the field. <p> The given timestamp refers to the time when the field still possesses its old value. If the timestamp is increased at an assignment, the old value at that timestamp refers to the value of the field before assignment.
 * @param current The current value of the field.
 * @param timestamp The timestamp.
 * @param trim If <tt>true</tt>, any values newer than the restored valueare deleted from the record.
 * @return The old value to be assigned back to the field.
 */
public double restore(short current,long timestamp,boolean trim){
  Iterator recordIter=iterator(0);
  Record record=_findRecord(recordIter,timestamp,trim);
  if (record == null)   return current;
 else   return ((Short)record.getValue()).shortValue();
}

Fixed version (ground truth):
/** 
 * Restore the old value at the timestamp to the field. <p> The given timestamp refers to the time when the field still possesses its old value. If the timestamp is increased at an assignment, the old value at that timestamp refers to the value of the field before assignment.
 * @param current The current value of the field.
 * @param timestamp The timestamp.
 * @param trim If <tt>true</tt>, any values newer than the restored valueare deleted from the record.
 * @return The old value to be assigned back to the field.
 */
public short restore(short current,long timestamp,boolean trim){
  Iterator recordIter=iterator(0);
  Record record=_findRecord(recordIter,timestamp,trim);
  if (record == null)   return current;
 else   return ((Short)record.getValue()).shortValue();
}
Program: 75115
Project: 75115
Buggy source:
public Test2 getT(Integer index){
  return _t[index];
}

Fixed version (ground truth):
public Test2 getT(int index){
  return _t[index];
}
Program: 75117
Project: 75117
Buggy source:
/** 
 * Parse the command-line arguments starting from the given position. If one or more argument corresponds to an option, proper actions are performed to record that option. The position is adjusted to the next file name or option and returned.
 * @param args The command-line arguments.
 * @param position The starting position.
 * @return The new position.
 */
protected static int _parseArguments(String[] args,int position){
  if (args[position].equals("String_Node_Str")) {
    position++;
    _prefix=args[position];
    for (int i=0; i < RULES.length; i++)     if (RULES[i] instanceof PackageRule) {
      ((PackageRule)RULES[i]).setPrefix(_prefix);
      break;
    }
    position++;
  }
 else   if (args[position].equals("String_Node_Str")) {
    position++;
    _rootPath=args[position];
    if (_rootPath.length() == 0)     _rootPath="String_Node_Str";
    position++;
  }
  return position;
}

Fixed version (ground truth):
/** 
 * Parse the command-line arguments starting from the given position. If one or more argument corresponds to an option, proper actions are performed to record that option. The position is adjusted to the next file name or option and returned.
 * @param args The command-line arguments.
 * @param position The starting position.
 * @return The new position.
 */
protected static int _parseArguments(String[] args,int position){
  String arg=args[position];
  if (arg.equals("String_Node_Str") || arg.equals("String_Node_Str")) {
    position++;
    _prefix=args[position];
    for (int i=0; i < RULES.length; i++)     if (RULES[i] instanceof PackageRule) {
      ((PackageRule)RULES[i]).setPrefix(_prefix);
      break;
    }
    position++;
  }
 else   if (arg.equals("String_Node_Str") || arg.equals("String_Node_Str")) {
    position++;
    _rootPath=args[position];
    if (_rootPath.length() == 0)     _rootPath="String_Node_Str";
    position++;
  }
 else   if (arg.equals("String_Node_Str") || arg.equals("String_Node_Str")) {
    position++;
    _overwrite=true;
  }
 else   if (arg.equals("String_Node_Str") || arg.equals("String_Node_Str")) {
    position++;
    _overwrite=false;
  }
 else   if (arg.equals("String_Node_Str") || arg.equals("String_Node_Str")) {
    position++;
    _configName=args[position];
    position++;
  }
  return position;
}
Program: 75120
Project: 75120
Buggy source:
private void _refactor(ClassInstanceCreation node,TypeAnalyzerState state){
  AST ast=node.getAST();
  CompilationUnit root=(CompilationUnit)node.getRoot();
  Type type=Type.getType(node);
  MethodInvocation staticSetCheckpoint=ast.newMethodInvocation();
  staticSetCheckpoint.setExpression(createName(ast,getClassName(type.getName(),state,root)));
  staticSetCheckpoint.setName(ast.newSimpleName(SET_CHECKPOINT_NAME));
  staticSetCheckpoint.arguments().add(ASTNode.copySubtree(ast,node));
  staticSetCheckpoint.arguments().add(ast.newSimpleName(CHECKPOINT_NAME));
  replaceNode(node,staticSetCheckpoint);
}

Fixed version (ground truth):
private void _refactor(ClassInstanceCreation node,TypeAnalyzerState state){
  AST ast=node.getAST();
  CompilationUnit root=(CompilationUnit)node.getRoot();
  Type type=Type.getType(node);
  String setCheckpointName=SET_CHECKPOINT_NAME + "String_Node_Str" + Integer.toHexString(state.getCurrentClass().getName().hashCode());
  MethodInvocation extraSetCheckpoint=ast.newMethodInvocation();
  extraSetCheckpoint.setExpression((ClassInstanceCreation)ASTNode.copySubtree(ast,node));
  extraSetCheckpoint.setName(ast.newSimpleName(setCheckpointName));
  extraSetCheckpoint.arguments().add(ast.newSimpleName(CHECKPOINT_NAME));
  replaceNode(node,extraSetCheckpoint);
}
Program: 75121
Project: 75121
Buggy source:
private void _handleName(Name node){
  if (node.getParent() != null && !(node.getParent() instanceof Name)) {
    String id=node.toString();
    boolean convert=false;
    Type type=Type.getType(node);
    if (type != null && _crossAnalysisTypes.contains(type.getName()) && _crossAnalysisNames.contains(id))     convert=true;
 else     if (node.getParent() instanceof ImportDeclaration && _crossAnalysisNames.contains(id))     convert=true;
 else     if (node.getParent() instanceof PackageDeclaration)     convert=true;
    if (convert) {
      Name newName=_addPrefix(node.getAST(),node,_prefix);
      if (newName != null)       AbstractTransformer.replaceNode(node,newName);
    }
  }
}

Fixed version (ground truth):
private void _handleName(Name node){
  if (node.getParent() != null) {
    String id=node.toString();
    boolean convert=false;
    Type type=Type.getType(node);
    Type owner=Type.getOwner(node);
    if (type != null && owner == null && _crossAnalysisTypes.contains(type.getName()) && _crossAnalysisNames.contains(id) && type.getName().length() == id.length())     convert=true;
 else     if (node.getParent() instanceof ImportDeclaration && _crossAnalysisNames.contains(id))     convert=true;
 else     if (node.getParent() instanceof PackageDeclaration)     convert=true;
    if (convert) {
      Name newName=_addPrefix(node.getAST(),node,_prefix);
      if (newName != null)       AbstractTransformer.replaceNode(node,newName);
    }
  }
}
Program: 75122
Project: 75122
Buggy source:
public String generateInitializeCode() throws IllegalActionException {
  CodeStream tmpStream=new CodeStream(this);
  tmpStream.appendCodeBlock("String_Node_Str");
  return processCode(tmpStream.toString());
}

Fixed version (ground truth):
public String generateInitializeCode() throws IllegalActionException {
  super.generateInitializeCode();
  CodeStream tmpStream=new CodeStream(this);
  tmpStream.appendCodeBlock("String_Node_Str");
  return processCode(tmpStream.toString());
}
Program: 75123
Project: 75123
Buggy source:
/** 
 * Setup the integrator to operate with the current ODE solver. This method checks whether there are enough auxiliary variables in the integrator for the current ODE solver. If not, create more auxiliary variables. <p> This method also adjusts the history information w.r.t. the current ODE solver and the current step size.
 * @return True always.
 * @exception IllegalActionException If there's no director orthe director has no ODE solver.
 */
public boolean prefire() throws IllegalActionException {
  CTDirector dir=(CTDirector)getDirector();
  if (dir == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  ODESolver solver=(ODESolver)dir.getCurrentODESolver();
  if (solver == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  int n=solver.getIntegratorAuxVariableCount();
  if ((_auxVariables == null) || (_auxVariables.length < n)) {
    _auxVariables=new double[n];
  }
  if (getHistoryCapacity() != solver.getAmountOfHistoryInformation()) {
    setHistoryCapacity(solver.getAmountOfHistoryInformation());
  }
  if (getValidHistoryCount() >= 2) {
    _history.rebalance(dir.getCurrentStepSize());
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Setup the integrator to operate with the current ODE solver. This method checks whether there are enough auxiliary variables in the integrator for the current ODE solver. If not, create more auxiliary variables. <p> This method also adjusts the history information w.r.t. the current ODE solver and the current step size.
 * @return True always.
 * @exception IllegalActionException If there's no director orthe director has no ODE solver.
 */
public boolean prefire() throws IllegalActionException {
  CTDirector dir=(CTDirector)getDirector();
  if (dir == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  ODESolver solver=(ODESolver)dir.getCurrentODESolver();
  if (solver == null) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  int n=solver.getIntegratorAuxVariableCount();
  if ((_auxVariables == null) || (_auxVariables.length != n)) {
    _auxVariables=new double[n];
  }
  if (getHistoryCapacity() != solver.getAmountOfHistoryInformation()) {
    setHistoryCapacity(solver.getAmountOfHistoryInformation());
  }
  if (getValidHistoryCount() >= 2) {
    _history.rebalance(dir.getCurrentStepSize());
  }
  return true;
}
Program: 75125
Project: 75125
Buggy source:
/** 
 * Choose one of the tokens in <i>values</i> randomly, using the <i>pmf</i> parameter to select one.  The chosen token will be sent to the output in the fire() method.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double randomValue=_random.nextDouble();
  ArrayToken valuesToken=(ArrayToken)values.getToken();
  if (_pmf.length != valuesToken.length()) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  double cdf=0.0;
  for (int i=0; i < _pmf.length; i++) {
    cdf+=_pmf[i];
    if (randomValue <= cdf) {
      _current=valuesToken.getElement(i);
    }
  }
  _current=valuesToken.getElement(_pmf.length - 1);
}

Fixed version (ground truth):
/** 
 * Choose one of the tokens in <i>values</i> randomly, using the <i>pmf</i> parameter to select one.  The chosen token will be sent to the output in the fire() method.
 * @exception If parameter values are incorrect.
 */
protected void _generateRandomNumber() throws IllegalActionException {
  double randomValue=_random.nextDouble();
  ArrayToken valuesToken=(ArrayToken)values.getToken();
  if (_pmf.length != valuesToken.length()) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
  }
  double cdf=0.0;
  for (int i=0; i < _pmf.length; i++) {
    cdf+=_pmf[i];
    if (randomValue <= cdf) {
      _current=valuesToken.getElement(i);
      return;
    }
  }
  _current=valuesToken.getElement(_pmf.length - 1);
}
Program: 75126
Project: 75126
Buggy source:
public void generateFireCode(StringBuffer stream) throws IllegalActionException {
  ptolemy.actor.lib.AddSubtract actor=(ptolemy.actor.lib.AddSubtract)getComponent();
  StringBuffer tmpStream=new StringBuffer();
  tmpStream.append("String_Node_Str");
  for (int i=0; i < actor.plus.getWidth(); i++) {
    tmpStream.append("String_Node_Str" + i + "String_Node_Str");
    if (i < actor.plus.getWidth() - 1)     tmpStream.append("String_Node_Str");
 else     if (actor.minus.getWidth() > 0)     tmpStream.append("String_Node_Str");
  }
  for (int i=0; i < actor.minus.getWidth(); i++) {
    tmpStream.append("String_Node_Str" + i + "String_Node_Str");
    if (i < actor.minus.getWidth() - 1)     tmpStream.append("String_Node_Str");
 else     tmpStream.append("String_Node_Str");
  }
  stream.append(processCode(tmpStream.toString()));
}

Fixed version (ground truth):
public void generateFireCode(StringBuffer stream) throws IllegalActionException {
  ptolemy.actor.lib.AddSubtract actor=(ptolemy.actor.lib.AddSubtract)getComponent();
  StringBuffer tmpStream=new StringBuffer();
  tmpStream.append("String_Node_Str");
  for (int i=0; i < actor.plus.getWidth(); i++) {
    tmpStream.append("String_Node_Str" + i + "String_Node_Str");
    if (i < actor.plus.getWidth() - 1) {
      tmpStream.append("String_Node_Str");
    }
 else     if (actor.minus.getWidth() > 0) {
      tmpStream.append("String_Node_Str");
    }
 else {
      tmpStream.append("String_Node_Str");
    }
  }
  for (int i=0; i < actor.minus.getWidth(); i++) {
    tmpStream.append("String_Node_Str" + i + "String_Node_Str");
    if (i < actor.minus.getWidth() - 1) {
      tmpStream.append("String_Node_Str");
    }
 else {
      tmpStream.append("String_Node_Str");
    }
  }
  stream.append(processCode(tmpStream.toString()));
}
Program: 75127
Project: 75127
Buggy source:
/** 
 * @param args
 */
public static void main(String[] args) throws Exception {
  if (args.length == 0)   System.err.println("String_Node_Str");
 else {
    String[] paths=PathFinder.getPtClassPaths();
    Writer writer=new OutputStreamWriter(System.out);
    for (int i=0; i < args.length; i++) {
      String fileName=args[i];
      transform(fileName,writer,paths);
    }
    writer.close();
  }
}

Fixed version (ground truth):
/** 
 * Transform a set of files into backtracking-enabled. The set of files is given by a set of strings as their names or the names of the directories that contain them. If 
 * @param args
 */
public static void main(String[] args) throws Exception {
  boolean outputResult=false;
  if (args.length == 0)   System.err.println("String_Node_Str" + "String_Node_Str");
 else {
    String[] paths=PathFinder.getPtClassPaths();
    Writer writer=outputResult ? new OutputStreamWriter(System.out) : null;
    for (int i=0; i < args.length; i++) {
      String pathOrFile=args[i];
      File[] files=PathFinder.getJavaFiles(pathOrFile,true);
      for (int j=0; j < files.length; j++) {
        String fileName=files[j].getPath();
        System.err.print("String_Node_Str" + fileName + "String_Node_Str");
        if (fileName.endsWith("String_Node_Str")) {
          String classFileName=fileName.substring(0,fileName.length() - 5) + "String_Node_Str";
          if (new File(classFileName).exists())           System.err.println();
 else {
            System.err.println("String_Node_Str");
            continue;
          }
        }
 else         continue;
        System.err.flush();
        transform(files[j].getPath(),writer,paths);
        if (outputResult)         writer.flush();
      }
    }
    if (outputResult)     writer.close();
  }
}
Program: 75130
Project: 75130
Buggy source:
/** 
 * Determine actor enabling status. It must be one of the three: _NOT_ENABLED, _ENABLED_DEFERRABLE, _ENABLED_NOT_DEFERRABLE.
 * @param actor The actor to be checked.
 * @return An int indicating actor enabling status.
 * @exception IllegalActionException If any called method throwsIllegalActionException.
 */
protected int _getActorStatus(Actor actor) throws IllegalActionException {
  if (!_isEnabled(actor)) {
    return _NOT_ENABLED;
  }
  if (_isDeferrable(actor)) {
    return _ENABLED_DEFERRABLE;
  }
  return _ENABLED_NOT_DEFERRABLE;
}

Fixed version (ground truth):
/** 
 * Determine actor enabling status. It must be one of the three: _NOT_ENABLED, _ENABLED_DEFERRABLE, _ENABLED_NOT_DEFERRABLE.
 * @param actor The actor to be checked.
 * @return An int indicating actor enabling status.
 * @exception IllegalActionException If any called method throwsIllegalActionException.
 */
protected int _getActorStatus(Actor actor) throws IllegalActionException {
  if (!_isEnabled(actor)) {
    if (_debugging)     _debug(((NamedObj)actor).getName() + "String_Node_Str");
    return _NOT_ENABLED;
  }
  if (_isDeferrable(actor)) {
    if (_debugging)     _debug(((NamedObj)actor).getName() + "String_Node_Str");
    return _ENABLED_DEFERRABLE;
  }
  if (_debugging)   _debug(((NamedObj)actor).getName() + "String_Node_Str");
  return _ENABLED_NOT_DEFERRABLE;
}
Program: 75131
Project: 75131
Buggy source:
/** 
 * Consume at most one token from the <i>input</i> and compute the average of the input tokens so far. Send the result to the output.  If there is no input token available, no output will be produced.  If there is a true-valued token on the <i>reset</i> input, then the average is reset, and the output will be equal to the <i>input</i> token (if there is one). If the fire method is invoked multiple times in one iteration, then only the input read on the last invocation in the iteration will affect future averages.  Inputs that are read earlier in the iteration are forgotten.
 * @exception IllegalActionException If addition or division by aninteger are not supported by the supplied tokens.
 */
public void fire() throws IllegalActionException {
  _latestSum=_sum;
  _latestCount=_count + 1;
  for (int i=0; i < reset.getWidth(); i++) {
    if (reset.hasToken(i)) {
      BooleanToken r=(BooleanToken)reset.get(i);
      if (r.booleanValue()) {
        _latestSum=null;
        _latestCount=1;
      }
    }
  }
  if (input.hasToken(0)) {
    Token in=input.get(0);
    if (_latestSum == null) {
      _latestSum=in;
    }
 else {
      _latestSum=_latestSum.add(in);
    }
    Token out=_latestSum.divide(new IntToken(_latestCount));
    output.broadcast(out);
  }
}

Fixed version (ground truth):
/** 
 * Consume at most one token from the <i>input</i> and compute the average of the input tokens so far. Send the result to the output.  If there is no input token available, no output will be produced.  If there is a true-valued token on the <i>reset</i> input, then the average is reset, and the output will be equal to the <i>input</i> token (if there is one). If the fire method is invoked multiple times in one iteration, then only the input read on the last invocation in the iteration will affect future averages.  Inputs that are read earlier in the iteration are forgotten.
 * @exception IllegalActionException If addition or division by aninteger are not supported by the supplied tokens.
 */
public void fire() throws IllegalActionException {
  _latestSum=_sum;
  _latestCount=_count;
  for (int i=0; i < reset.getWidth(); i++) {
    if (reset.hasToken(i)) {
      BooleanToken r=(BooleanToken)reset.get(i);
      if (r.booleanValue()) {
        _latestSum=null;
        _latestCount=0;
      }
    }
  }
  if (input.hasToken(0)) {
    Token in=input.get(0);
    _latestCount++;
    if (_latestSum == null) {
      _latestSum=in;
    }
 else {
      _latestSum=_latestSum.add(in);
    }
    Token out=_latestSum.divide(new IntToken(_latestCount));
    output.broadcast(out);
  }
}
Program: 75132
Project: 75132
Buggy source:
/** 
 * Get the type of a field in a class by its name. If not found in the class definition, this function also searches the superclasses of that class, as well as the interfaces that the class and its superclasses implement.
 * @param c The class from which the field name is resolved.
 * @param name The name of the field.
 * @return The type of the field if found; otherwise, <tt>null</tt>.
 * @see #_getMethodType(Class,String,Type[])
 */
protected TypeAndOwner _getFieldTypeAndOwner(Class c,String name){
  if (c.isArray() && name.equals("String_Node_Str"))   return new TypeAndOwner(Type.createType(c.getName()),Type.INT);
  Field field;
  List workList=new LinkedList();
  Set handledSet=new HashSet();
  workList.add(c);
  while (!workList.isEmpty()) {
    Class topClass=(Class)workList.remove(0);
    try {
      field=topClass.getDeclaredField(name);
      return new TypeAndOwner(Type.createType(topClass.getName()),Type.createType(field.getType().getName()));
    }
 catch (    NoSuchFieldException e1) {
    }
    handledSet.add(topClass);
    Class superClass=topClass.getSuperclass();
    if (superClass == null && !topClass.getName().equals("String_Node_Str"))     superClass=Object.class;
    if (superClass != null)     workList.add(superClass);
    Class[] interfaces=topClass.getInterfaces();
    for (int i=0; i < interfaces.length; i++)     if (!handledSet.contains(interfaces[i]))     workList.add(interfaces[i]);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the type of a field in a class by its name. If not found in the class definition, this function also searches the superclasses of that class, as well as the interfaces that the class and its superclasses implement.
 * @param c The class from which the field name is resolved.
 * @param name The name of the field.
 * @return The type of the field if found; otherwise, <tt>null</tt>.
 * @see #_getMethodType(Class,String,Type[])
 */
protected TypeAndOwner _getFieldTypeAndOwner(Class c,String name){
  if (c.isArray() && name.equals("String_Node_Str"))   return new TypeAndOwner(Type.INT,Type.createType(c.getName()));
  Field field;
  List workList=new LinkedList();
  Set handledSet=new HashSet();
  workList.add(c);
  while (!workList.isEmpty()) {
    Class topClass=(Class)workList.remove(0);
    try {
      field=topClass.getDeclaredField(name);
      return new TypeAndOwner(Type.createType(field.getType().getName()),Type.createType(topClass.getName()));
    }
 catch (    NoSuchFieldException e1) {
    }
    handledSet.add(topClass);
    Class superClass=topClass.getSuperclass();
    if (superClass == null && !topClass.getName().equals("String_Node_Str"))     superClass=Object.class;
    if (superClass != null)     workList.add(superClass);
    Class[] interfaces=topClass.getInterfaces();
    for (int i=0; i < interfaces.length; i++)     if (!handledSet.contains(interfaces[i]))     workList.add(interfaces[i]);
  }
  return null;
}
Program: 75134
Project: 75134
Buggy source:
private String _getAssignMethodName(String fieldName,int indices){
  return ASSIGN_PREFIX + fieldName + (indices == 0 ? "String_Node_Str" : "String_Node_Str" + indices);
}

Fixed version (ground truth):
private String _getAssignMethodName(String fieldName){
  return ASSIGN_PREFIX + fieldName;
}
Program: 75136
Project: 75136
Buggy source:
/** 
 * Summarize an AST from by traversing it from the root with a user specified visitor as the summary builder. If the file name given is not <tt>null</tt>, it is set to be the source file name of the resulting summary. <p>
 * @param root Root of an AST.
 * @param fileName The name of the source file from which theAST is built.
 * @param visitor The customized visitor, usually of a subclassof  {@link TraversalVisitor}.
 * @return The summary.
 */
public static FileSummary summarize(ASTCompilationUnit root,String fileName,JavaParserVisitor visitor){
  SummaryLoaderState state=new SummaryLoaderState();
  if (fileName != null)   state.setFile(new File(fileName));
  root.jjtAccept(visitor,state);
  return (FileSummary)state.getCurrentSummary();
}

Fixed version (ground truth):
/** 
 * Summarize an AST from by traversing it from the root with a user specified visitor as the summary builder. If the file name given is not <tt>null</tt>, it is set to be the source file name of the resulting summary. <p>
 * @param root Root of an AST.
 * @param fileName The name of the source file from which theAST is built.
 * @param visitor The customized visitor, usually of a subclassof  {@link org.acm.seguin.summary.TraversalVisitor}.
 * @return The summary.
 */
public static FileSummary summarize(ASTCompilationUnit root,String fileName,JavaParserVisitor visitor){
  SummaryLoaderState state=new SummaryLoaderState();
  if (fileName != null)   state.setFile(new File(fileName));
  root.jjtAccept(visitor,state);
  return (FileSummary)state.getCurrentSummary();
}
Program: 75137
Project: 75137
Buggy source:
/** 
 * Check if a class is explicitly imported, or is any nested class in the explicitly imported class. The class looked for can be nested, when "$" appears in its name.
 * @param dollarName The name of the class to be loaded. "$" is usedas the separator between a nested class name and the name of its enclosing class.
 * @param resolve Whether to resolve the class.
 * @param importedClass The data structure that specifies an importedclass.
 * @return The class loaded if found. If no such class is found,<tt>null</tt> is returned.
 */
private Class _checkClassNameWithImportClass(StringBuffer dollarName,boolean resolve,ClassImport importedClass){
  int dotPos=dollarName.indexOf("String_Node_Str");
  if (dotPos == -1)   dotPos=dollarName.length();
  if (importedClass.className.equals(dollarName.substring(0,dotPos))) {
    dollarName.insert(0,'.');
    dollarName.insert(0,importedClass.packageName);
    try {
      String className=dollarName.toString();
      Class c=super.loadClass(className,resolve);
      _loadedClasses.put(className,c);
      return c;
    }
 catch (    ClassNotFoundException e) {
      return null;
    }
 finally {
      dollarName.delete(0,importedClass.packageName.length() + 1);
    }
  }
 else   return null;
}

Fixed version (ground truth):
/** 
 * Check if a class is explicitly imported, or is any nested class in the explicitly imported class. The class looked for can be nested, when "$" appears in its name.
 * @param dollarName The name of the class to be loaded. "$" is usedas the separator between a nested class name and the name of its enclosing class.
 * @param resolve Whether to resolve the class.
 * @param importedClass The data structure that specifies an importedclass.
 * @return The class loaded if found. If no such class is found,<tt>null</tt> is returned.
 */
private Class _checkClassNameWithImportClass(StringBuffer dollarName,boolean resolve,ClassImport importedClass){
  int dotPos=dollarName.indexOf("String_Node_Str");
  if (dotPos == -1)   dotPos=dollarName.length();
  if (importedClass.className.equals(dollarName.substring(0,dotPos))) {
    dollarName.insert(0,'.');
    dollarName.insert(0,importedClass.packageName);
    try {
      String className=dollarName.toString();
      Class c=super.loadClass(className,resolve);
      _loadedClasses.put(className,c);
      return c;
    }
 catch (    ClassNotFoundException e) {
      return null;
    }
catch (    NoClassDefFoundError e) {
      return null;
    }
 finally {
      dollarName.delete(0,importedClass.packageName.length() + 1);
    }
  }
 else   return null;
}
Program: 75138
Project: 75138
Buggy source:
/** 
 * Check if a class with the given name can be found relative to the given package. The class can be nested, when "$" appears in its name.
 * @param dollarName The name of the class to be loaded. "$" is usedas the separator between a nested class name and the name of its enclosing class.
 * @param resolve Whether to resolve the class.
 * @param packageName The name of the package (may contain ".") inwhich the class is searched for.
 * @return The class loaded if found. If no such class is found,<tt>null</tt> is returned.
 */
private Class _checkClassNameWithImportPackage(StringBuffer dollarName,boolean resolve,String packageName){
  dollarName.insert(0,'.');
  dollarName.insert(0,packageName);
  try {
    String className=dollarName.toString();
    Class c=super.loadClass(className,resolve);
    _loadedClasses.put(className,c);
    return c;
  }
 catch (  ClassNotFoundException e) {
    return null;
  }
 finally {
    dollarName.delete(0,packageName.length() + 1);
  }
}

Fixed version (ground truth):
/** 
 * Check if a class with the given name can be found relative to the given package. The class can be nested, when "$" appears in its name.
 * @param dollarName The name of the class to be loaded. "$" is usedas the separator between a nested class name and the name of its enclosing class.
 * @param resolve Whether to resolve the class.
 * @param packageName The name of the package (may contain ".") inwhich the class is searched for.
 * @return The class loaded if found. If no such class is found,<tt>null</tt> is returned.
 */
private Class _checkClassNameWithImportPackage(StringBuffer dollarName,boolean resolve,String packageName){
  dollarName.insert(0,'.');
  dollarName.insert(0,packageName);
  try {
    String className=dollarName.toString();
    Class c=super.loadClass(className,resolve);
    _loadedClasses.put(className,c);
    return c;
  }
 catch (  ClassNotFoundException e) {
    return null;
  }
catch (  NoClassDefFoundError e) {
    return null;
  }
 finally {
    dollarName.delete(0,packageName.length() + 1);
  }
}
Program: 75142
Project: 75142
Buggy source:
/** 
 * Check if the name is a full name corresponds to a class. A full name contains the package name as its prefix and the simple class name as its postfix, separated with a ".".
 * @param name The name of the class to be loaded.
 * @param resolve Whether to resolve the class.
 * @return The class loaded if found. If no such class is found,<tt>null</tt> is returned.
 */
private Class _checkFullClassName(StringBuffer name,boolean resolve){
  String nameString=name.toString();
  try {
    Class c=super.loadClass(nameString,resolve);
    _loadedClasses.put(nameString,c);
    return c;
  }
 catch (  ClassNotFoundException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Check if the name is a full name corresponds to a class. A full name contains the package name as its prefix and the simple class name as its postfix, separated with a ".".
 * @param name The name of the class to be loaded.
 * @param resolve Whether to resolve the class.
 * @return The class loaded if found. If no such class is found,<tt>null</tt> is returned.
 */
private Class _checkFullClassName(StringBuffer name,boolean resolve){
  String nameString=name.toString();
  try {
    Class c=super.loadClass(nameString,resolve);
    _loadedClasses.put(nameString,c);
    return c;
  }
 catch (  ClassNotFoundException e) {
    return null;
  }
catch (  NoClassDefFoundError e) {
    return null;
  }
}
Program: 75143
Project: 75143
Buggy source:
/** 
 * Construct a class loader with a set of class paths specified as a string array. The class loader looks for classes in those paths in order.
 * @param classPaths The array of class paths to be searched inorder.
 */
public LocalClassLoader(String[] classPaths){
  super(_stringsToUrls(classPaths),null,null);
}

Fixed version (ground truth):
/** 
 * Construct a class loader with a set of class paths specified as a string array. The class loader looks for classes in those paths in order.
 * @param classPaths The array of class paths to be searched inorder.
 */
public LocalClassLoader(String[] classPaths){
  super(_stringsToUrls(classPaths),null,null);
  _urlClassLoader=new URLClassLoader(getURLs(),null,null);
}
Program: 75144
Project: 75144
Buggy source:
/** 
 * Get the type of a field in a class by its name. If not found in the class definition, this function also searches the superclasses of that class, as well as the interfaces that the class and its superclasses implement.
 * @param c The class from which the field name is resolved.
 * @param name The name of the field.
 * @return The type of the field if found; otherwise, <tt>null</tt>.
 * @see #getMethodType(Class,String,Type[])
 */
protected Type getFieldType(Class c,String name){
  Field field;
  List workList=new LinkedList();
  Set handledSet=new HashSet();
  workList.add(c);
  while (!workList.isEmpty()) {
    Class topClass=(Class)workList.remove(0);
    try {
      field=topClass.getDeclaredField(name);
      return Type.createType(field.getType().getName());
    }
 catch (    NoSuchFieldException e1) {
    }
    handledSet.add(topClass);
    Class[] interfaces=topClass.getInterfaces();
    for (int i=0; i < interfaces.length; i++)     if (!handledSet.contains(interfaces[i]))     workList.add(interfaces[i]);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the type of a field in a class by its name. If not found in the class definition, this function also searches the superclasses of that class, as well as the interfaces that the class and its superclasses implement.
 * @param c The class from which the field name is resolved.
 * @param name The name of the field.
 * @return The type of the field if found; otherwise, <tt>null</tt>.
 * @see #getMethodType(Class,String,Type[])
 */
protected Type getFieldType(Class c,String name){
  Field field;
  List workList=new LinkedList();
  Set handledSet=new HashSet();
  workList.add(c);
  while (!workList.isEmpty()) {
    Class topClass=(Class)workList.remove(0);
    try {
      field=topClass.getDeclaredField(name);
      return Type.createType(field.getType().getName());
    }
 catch (    NoSuchFieldException e1) {
    }
    handledSet.add(topClass);
    Class superClass=topClass.getSuperclass();
    if (superClass == null && !topClass.getName().equals("String_Node_Str"))     superClass=Object.class;
    if (superClass != null)     workList.add(superClass);
    Class[] interfaces=topClass.getInterfaces();
    for (int i=0; i < interfaces.length; i++)     if (!handledSet.contains(interfaces[i]))     workList.add(interfaces[i]);
  }
  return null;
}
Program: 75148
Project: 75148
Buggy source:
/** 
 * Get the common type of two types when they appear in an expression. The following rules are followed: <ol> <li>Two object types cannot be computed in an expression, unless one of them is   {@link String}, in which case the result type is   {@link String}. </li> <li>Primitive types can be computed (+) with only one object type, which is   {@link String}. The result is also  {@link String}. </li> <li>When two different primitive types are computed, one of them must be coerced to the other one, which can store more information. </li> </ol>
 * @param type1 One of the types to be evaluated.
 * @param type2 The other of the types to be evaluated.
 * @return The common type of the two if any, or <tt>null</tt>(not the <tt>null</tt> primitive type) if none.
 */
public static Type getCommonType(Type type1,Type type2){
  try {
    if (type1.getName().equals("String_Node_Str"))     return type1;
 else     if (type2.getName().equals("String_Node_Str"))     return type2;
 else     if (type1.isPrimitive() && type2.isPrimitive())     if (type1.compatibility(type2,ClassLoader.getSystemClassLoader()) >= 0)     return type2;
 else     if (type2.compatibility(type1,ClassLoader.getSystemClassLoader()) >= 0)     return type1;
  }
 catch (  ClassNotFoundException e) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get the common type of two types when they appear in an expression. The following rules are followed: <ol> <li> <li>Two object types cannot be computed in an expression, unless one of them is   {@link String}, in which case the result type is   {@link String}, or they are the same type. </li> <li>Primitive types can be computed (+) with only one object type, which is   {@link String}. The result is also  {@link String}. </li> <li>When two different primitive types are computed, one of them must be coerced to the other one, which can store more information. </li> </ol>
 * @param type1 One of the types to be evaluated.
 * @param type2 The other of the types to be evaluated.
 * @return The common type of the two if any, or <tt>null</tt>(not the <tt>null</tt> primitive type) if none.
 */
public static Type getCommonType(Type type1,Type type2){
  try {
    if (type1.equals(type2))     return type1;
 else     if (type1.getName().equals("String_Node_Str"))     return type1;
 else     if (type2.getName().equals("String_Node_Str"))     return type2;
 else     if (type1.isPrimitive() && type2.isPrimitive())     if (type1.compatibility(type2,ClassLoader.getSystemClassLoader()) >= 0)     return type2;
 else     if (type2.compatibility(type1,ClassLoader.getSystemClassLoader()) >= 0)     return type1;
  }
 catch (  ClassNotFoundException e) {
  }
  return null;
}
Program: 75153
Project: 75153
Buggy source:
/** 
 * Return the buffer capacity of the given port. This method always return the receiver length, or 1 if the port does not have a receiver.
 * @param port The given port.
 * @return The buffer capacity of the given port.
 * @exception IllegalActionException Subclasses may throw it.
 */
public int getBufferCapacity(TypedIOPort port) throws IllegalActionException {
  int bufferCapacity=port.getReceivers()[0].length;
  if (bufferCapacity == 0) {
    bufferCapacity=1;
  }
  return bufferCapacity;
}

Fixed version (ground truth):
/** 
 * Return the buffer capacity of the given port. This method always return 1. Subclasses may override this method.
 * @param port The given port.
 * @return The buffer capacity of the given port.
 * @exception IllegalActionException Subclasses may throw it.
 */
public int getBufferCapacity(TypedIOPort port) throws IllegalActionException {
  return DFUtilities.getRate(port);
}
Program: 75154
Project: 75154
Buggy source:
/** 
 * Get the size of a parameter or port. The size of a parameter is the length of its array if the parameter's type is array, and 1 otherwise. The size of a port is its receiver length.
 * @param name The name of the port or parameter.
 * @return The size of a parameter or port.
 * @throws IllegalActionException If no port or parameter ofthe given name is found.
 */
public int getSize(String name) throws IllegalActionException {
  int size=1;
  Attribute attribute=_component.getAttribute(name);
  if (attribute != null) {
    if (attribute instanceof Variable) {
      Token token=((Variable)attribute).getToken();
      if (token instanceof ArrayToken) {
        return ((ArrayToken)token).length();
      }
      return 1;
    }
  }
  Actor actor=(Actor)_component;
  Iterator inputPorts=actor.inputPortList().iterator();
  while (inputPorts.hasNext()) {
    IOPort port=(IOPort)inputPorts.next();
    if (port.getName().equals(name)) {
      return port.getReceivers()[0].length;
    }
  }
  Iterator outputPorts=actor.outputPortList().iterator();
  while (outputPorts.hasNext()) {
    IOPort port=(IOPort)inputPorts.next();
    if (port.getName().equals(name)) {
      return port.getRemoteReceivers()[0].length;
    }
  }
  throw new IllegalActionException(_component,"String_Node_Str" + name);
}

Fixed version (ground truth):
/** 
 * Get the size of a parameter. The size of a parameter is the length of its array if the parameter's type is array, and 1 otherwise.
 * @param name The name of the parameter.
 * @return The size of a parameter.
 * @throws IllegalActionException If no port or parameter ofthe given name is found.
 */
public int getSize(String name) throws IllegalActionException {
  int size=1;
  Attribute attribute=_component.getAttribute(name);
  if (attribute != null) {
    if (attribute instanceof Variable) {
      Token token=((Variable)attribute).getToken();
      if (token instanceof ArrayToken) {
        return ((ArrayToken)token).length();
      }
      return 1;
    }
  }
  throw new IllegalActionException(_component,"String_Node_Str" + name);
}
Program: 75156
Project: 75156
Buggy source:
/** 
 * Return the buffer capacity associated with the given port, This method overides the base class by computing the total number of tokens transferred in one iteration.
 * @param port The given port.
 * @return the buffer capacity associated with the given port.
 */
public int getBufferCapacity(TypedIOPort port) throws IllegalActionException {
  int bufferCapacity=1;
  Variable firings=(Variable)port.getContainer().getAttribute("String_Node_Str");
  int firingsPerIteration=((IntToken)firings.getToken()).intValue();
  if (port.isInput()) {
    bufferCapacity=firingsPerIteration * DFUtilities.getTokenConsumptionRate(port);
  }
  return bufferCapacity;
}

Fixed version (ground truth):
/** 
 * Return the buffer capacity associated with the given port, This method overides the base class by computing the total number of tokens transferred in one iteration.
 * @param port The given port.
 * @return the buffer capacity associated with the given port.
 */
public int getBufferCapacity(TypedIOPort port) throws IllegalActionException {
  int bufferCapacity=1;
  Variable firings=(Variable)port.getContainer().getAttribute("String_Node_Str");
  int firingsPerIteration=1;
  if (firings != null) {
    firingsPerIteration=((IntToken)firings.getToken()).intValue();
  }
  if (port.isInput()) {
    bufferCapacity=firingsPerIteration * DFUtilities.getTokenConsumptionRate(port);
  }
  return bufferCapacity;
}