nus-yam/ex-repair huggingface dataset:
Program: 74787
Project: 74787
Buggy source:
/** 
 * Enter the named for-block subscope.
 * @param scope The named subscope.
 * @param forBlock The AST for the subscope.
 * @param populator The PtalonPopulator that called this statement. 
 * @exception PtalonRuntimeException If the subscope does not exist.
 */
public void enterForScope(String scope,PtalonAST forBlock,PtalonPopulator populator) throws PtalonRuntimeException {
  enterIfScope(scope);
  _currentTree.forBlock=forBlock;
  _currentTree.populator=populator;
}

Fixed version (ground truth):
/** 
 * Enter the named for-block subscope.
 * @param scope The named subscope.
 * @param forBlock The AST for the subscope.
 * @param populator The PtalonPopulator that called this statement. 
 * @exception PtalonRuntimeException If the subscope does not exist.
 */
public void enterForScope(String scope,PtalonAST forBlock,PtalonPopulator populator) throws PtalonRuntimeException {
  enterIfScope(scope);
  _currentIfTree.forBlock=forBlock;
  _currentIfTree.populator=populator;
}
Program: 74788
Project: 74788
Buggy source:
/** 
 * Return true if the given symbol exists in the current scope.
 * @param symbol The symbol to test.
 * @return true if the given symbol exists in the current scope.
 */
public boolean inScope(String symbol){
  List<IfTree> ancestors=_currentTree.getAncestors();
  for (  IfTree tree : ancestors) {
    if (tree.getSymbols().contains(symbol)) {
      return true;
    }
  }
  return _currentTree.inDeepScope(symbol);
}

Fixed version (ground truth):
/** 
 * Return true if the given symbol exists in the current scope.
 * @param symbol The symbol to test.
 * @return true if the given symbol exists in the current scope.
 */
public boolean inScope(String symbol){
  List<IfTree> ancestors=_currentIfTree.getAncestors();
  for (  IfTree tree : ancestors) {
    if (tree.getSymbols().contains(symbol)) {
      return true;
    }
  }
  return _currentIfTree.inDeepScope(symbol);
}
Program: 74789
Project: 74789
Buggy source:
/** 
 * Add a TypedIOPort to the PtalonActor with the specified name, and output flow type
 * @param name The name of the port.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a port associated with it, or if an IllegalActionException is thrown trying to create the port.
 */
public void addOutPort(String name) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    TypedIOPort port=new TypedIOPort(_actor,uniqueName);
    port.setInput(false);
    port.setOutput(true);
    if (_currentTree.getType(name).equals("String_Node_Str")) {
      port.setMultiport(true);
    }
    _currentTree.setStatus(name,true);
    _currentTree.mapName(name,uniqueName);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  PtalonScopeException e) {
    throw new PtalonRuntimeException("String_Node_Str" + name,e);
  }
}

Fixed version (ground truth):
/** 
 * Add a TypedIOPort to the PtalonActor with the specified name, and output flow type
 * @param name The name of the port.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a port associated with it, or if an IllegalActionException is thrown trying to create the port.
 */
public void addOutPort(String name) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    TypedIOPort port=new TypedIOPort(_actor,uniqueName);
    port.setInput(false);
    port.setOutput(true);
    if (_currentIfTree.getType(name).equals("String_Node_Str")) {
      port.setMultiport(true);
    }
    _currentIfTree.setStatus(name,true);
    _currentIfTree.setEnteredIteration(name,_currentIfTree.entered);
    _currentIfTree.mapName(name,uniqueName);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  PtalonScopeException e) {
    throw new PtalonRuntimeException("String_Node_Str" + name,e);
  }
}
Program: 74790
Project: 74790
Buggy source:
/** 
 * Add an invisible Parameter to the PtalonActor with the specified name and the given expression as its value.
 * @param name The name of the parameter.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a parameter associated with it, or if an IllegalActionException is thrown trying to create the parameter.
 */
public void addParameter(String name,String expression) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    PtalonExpressionParameter parameter=new PtalonExpressionParameter(_actor,uniqueName);
    parameter.setVisibility(Settable.NONE);
    _currentTree.setStatus(name,true);
    _currentTree.mapName(name,uniqueName);
    _unassignedParameters.add(parameter);
    _unassignedParameterValues.add(expression);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Add an invisible Parameter to the PtalonActor with the specified name and the given expression as its value.
 * @param name The name of the parameter.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a parameter associated with it, or if an IllegalActionException is thrown trying to create the parameter.
 */
public void addParameter(String name,String expression) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    PtalonExpressionParameter parameter=new PtalonExpressionParameter(_actor,uniqueName);
    parameter.setVisibility(Settable.NONE);
    _currentIfTree.setStatus(name,true);
    _currentIfTree.setEnteredIteration(name,_currentIfTree.entered);
    _currentIfTree.mapName(name,uniqueName);
    _unassignedParameters.add(parameter);
    _unassignedParameterValues.add(expression);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
}
Program: 74791
Project: 74791
Buggy source:
/** 
 * Exit the current for scope.
 * @exception PtalonRuntimeException If not in a for-block scope.
 */
public void exitForScope() throws PtalonRuntimeException {
  if (!_currentTree.isForStatement) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  exitIfScope();
}

Fixed version (ground truth):
/** 
 * Exit the current for scope.
 * @exception PtalonRuntimeException If not in a for-block scope.
 */
public void exitForScope() throws PtalonRuntimeException {
  if (!_currentIfTree.isForStatement) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  exitIfScope();
}
Program: 74792
Project: 74792
Buggy source:
/** 
 * Look up and return the value with the specified name in the scope. Return null if the name is not defined in this scope.
 * @return The token associated with the given name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public Token get(String name) throws IllegalActionException {
  try {
    if (_variables.containsKey(name)) {
      return _variables.get(name);
    }
    if (!getTypeForScope(name).equals("String_Node_Str")) {
      throw new IllegalActionException(name + "String_Node_Str");
    }
    return getValueOf(name);
  }
 catch (  PtalonScopeException e) {
    return null;
  }
catch (  PtalonRuntimeException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Look up and return the value with the specified name in the scope. Return null if the name is not defined in this scope.
 * @return The token associated with the given name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public Token get(String name) throws IllegalActionException {
  try {
    if (_variables.containsKey(name)) {
      return _variables.get(name);
    }
    if (!_getTypeForScope(name).equals("String_Node_Str")) {
      throw new IllegalActionException(name + "String_Node_Str");
    }
    return _getValueOf(name);
  }
 catch (  PtalonScopeException e) {
    return null;
  }
catch (  PtalonRuntimeException e) {
    return null;
  }
}
Program: 74793
Project: 74793
Buggy source:
/** 
 * Add a TypedIORelation to the PtalonActor with the specified name.
 * @param name The name of the relation.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a relation associated with it, or if an IllegalActionException is thrown trying to create the relation.
 */
public void addRelation(String name) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    TypedIORelation relation=new TypedIORelation(_actor,uniqueName);
    _currentTree.setStatus(name,true);
    _currentTree.mapName(name,uniqueName);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Add a TypedIORelation to the PtalonActor with the specified name.
 * @param name The name of the relation.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a relation associated with it, or if an IllegalActionException is thrown trying to create the relation.
 */
public void addRelation(String name) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    TypedIORelation relation=new TypedIORelation(_actor,uniqueName);
    _currentIfTree.setStatus(name,true);
    _currentIfTree.setEnteredIteration(name,_currentIfTree.entered);
    _currentIfTree.mapName(name,uniqueName);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
}
Program: 74794
Project: 74794
Buggy source:
/** 
 * Return true if the boolean for the current conditional is ready to be entered.  It is ready when all ports, parameters, and relations in the containing scope have been created, when all parameters in the containing scope have been assigned values, and when in a branch of an if-block that is active.  
 * @return true if the current if-block scope is ready to be entered.
 * @exception PtalonRuntimeException If it is thrown trying to access a parameter.
 */
public boolean isIfReady() throws PtalonRuntimeException {
  IfTree parent=_currentTree.getParent();
  if (parent == null) {
    return false;
  }
 else   if (parent.getActiveBranch() == null) {
    return false;
  }
 else   if (parent.getActiveBranch() != parent.getCurrentBranch()) {
    return false;
  }
  List<IfTree> ancestors=parent.getAncestors();
  for (  IfTree tree : ancestors) {
    if (!tree.isFullyAssigned()) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Return true if the boolean for the current conditional is ready to be entered.  It is ready when all ports, parameters, and relations in the containing scope have been created, when all parameters in the containing scope have been assigned values, and when in a branch of an if-block that is active.  
 * @return true if the current if-block scope is ready to be entered.
 * @exception PtalonRuntimeException If it is thrown trying to access a parameter.
 */
public boolean isIfReady() throws PtalonRuntimeException {
  IfTree parent=_currentIfTree.getParent();
  if (parent == null) {
    return false;
  }
 else   if (parent.getActiveBranch() == null) {
    return false;
  }
 else   if (parent.getActiveBranch() != parent.getCurrentBranch()) {
    return false;
  }
  List<IfTree> ancestors=parent.getAncestors();
  for (  IfTree tree : ancestors) {
    if (!tree.isFullyAssigned()) {
      return false;
    }
  }
  return true;
}
Program: 74795
Project: 74795
Buggy source:
/** 
 * Push into the scope of a new if statement contained as a sub-block of the current if statement.  This is called when loading an existsing Ptalon actor from a PtalonML description.
 * @param name The name of the if statement.
 */
public void pushIfStatement(String name){
  if (_firstPushWithString) {
    _root=new IfTree(null,name);
    _currentTree=_root;
    _firstPushWithString=false;
  }
 else {
    _currentTree=_currentTree.addChild(name);
  }
}

Fixed version (ground truth):
/** 
 * Push into the scope of a new if statement contained as a sublock of the current if statement.
 */
public void pushIfStatement(){
  String name=_getNextIfSymbol();
  _currentIfTree=_currentIfTree.addChild(name);
}
Program: 74796
Project: 74796
Buggy source:
/** 
 * Add a TypedIOPort to the PtalonActor with the specified name, and input flow type
 * @param name The name of the port.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a port associated with it, or if an IllegalActionException is thrown trying to create the port.
 */
public void addInPort(String name) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    TypedIOPort port=new TypedIOPort(_actor,uniqueName);
    port.setInput(true);
    port.setOutput(false);
    IfTree tree=_currentTree;
    if (tree.getType(name).equals("String_Node_Str")) {
      port.setMultiport(true);
    }
    tree.setStatus(name,true);
    tree.mapName(name,uniqueName);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  PtalonScopeException e) {
    throw new PtalonRuntimeException("String_Node_Str" + name,e);
  }
}

Fixed version (ground truth):
/** 
 * Add a TypedIOPort to the PtalonActor with the specified name, and input flow type
 * @param name The name of the port.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a port associated with it, or if an IllegalActionException is thrown trying to create the port.
 */
public void addInPort(String name) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    TypedIOPort port=new TypedIOPort(_actor,uniqueName);
    port.setInput(true);
    port.setOutput(false);
    if (_currentIfTree.getType(name).equals("String_Node_Str")) {
      port.setMultiport(true);
    }
    _currentIfTree.setStatus(name,true);
    _currentIfTree.setEnteredIteration(name,_currentIfTree.entered);
    _currentIfTree.mapName(name,uniqueName);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  PtalonScopeException e) {
    throw new PtalonRuntimeException("String_Node_Str" + name,e);
  }
}
Program: 74797
Project: 74797
Buggy source:
/** 
 * Enter the named subscope.
 * @param scope The named subscope.
 * @exception PtalonRuntimeException If the subscope does not exist.
 */
public void enterIfScope(String scope) throws PtalonRuntimeException {
  boolean exists=false;
  for (  IfTree tree : _currentTree.getChildren()) {
    if (tree.getName().equals(scope)) {
      exists=true;
      _currentTree=tree;
      break;
    }
  }
  if (!exists) {
    throw new PtalonRuntimeException("String_Node_Str" + scope + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Enter the named subscope.
 * @param scope The named subscope.
 * @exception PtalonRuntimeException If the subscope does not exist.
 */
public void enterIfScope(String scope) throws PtalonRuntimeException {
  boolean exists=false;
  for (  IfTree tree : _currentIfTree.getChildren()) {
    if (tree.getName().equals(scope)) {
      exists=true;
      _currentIfTree=tree;
      break;
    }
  }
  if (!exists) {
    throw new PtalonRuntimeException("String_Node_Str" + scope + "String_Node_Str");
  }
}
Program: 74798
Project: 74798
Buggy source:
/** 
 * Add an invisible PtalonParameter to the PtalonActor with the specified name.
 * @param name The name of the parameter.
 * @param expression The expression representing the parameter.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a parameter associated with it, or if an IllegalActionException is thrown trying to create the parameter.
 */
public void addActorParameter(String name,String expression) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    PtalonParameter parameter=new PtalonParameter(_actor,uniqueName);
    parameter.setVisibility(Settable.NONE);
    _currentTree.setStatus(name,true);
    _currentTree.mapName(name,uniqueName);
    _unassignedParameters.add(parameter);
    _unassignedParameterValues.add(expression);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Add an invisible PtalonParameter to the PtalonActor with the specified name.
 * @param name The name of the parameter.
 * @param expression The expression representing the parameter.
 * @exception PtalonRuntimeException If the symbol does not exist, or ifthe symbol already has a parameter associated with it, or if an IllegalActionException is thrown trying to create the parameter.
 */
public void addActorParameter(String name,String expression) throws PtalonRuntimeException {
  String uniqueName=_actor.uniqueName(name);
  try {
    PtalonParameter parameter=new PtalonParameter(_actor,uniqueName);
    parameter.setVisibility(Settable.NONE);
    _currentIfTree.setStatus(name,true);
    _currentIfTree.setEnteredIteration(name,_currentIfTree.entered);
    _currentIfTree.mapName(name,uniqueName);
    _unassignedParameters.add(parameter);
    _unassignedParameterValues.add(expression);
  }
 catch (  NameDuplicationException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
catch (  IllegalActionException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
}
Program: 74799
Project: 74799
Buggy source:
/** 
 * Push into the scope of a new for statement contained
 * @param variable The variable associated with the for statement.
 * @param initExpr The expression representing the initial value for the variable. 
 * @param satExpr The expression evaluated before executing the for statement body.
 */
public void pushForStatement(String variable,String initExpr,String satExpr){
  String name=getNextIfSymbol();
  _currentTree=_currentTree.addChild(name);
  _currentTree.isForStatement=true;
  _currentTree.variable=variable;
  _currentTree.initExpr=initExpr;
  _currentTree.satExpr=satExpr;
}

Fixed version (ground truth):
/** 
 * Push into the scope of a new for statement contained
 * @param variable The variable associated with the for statement.
 * @param initExpr The expression representing the initial value for the variable. 
 * @param satExpr The expression evaluated before executing the for statement body.
 */
public void pushForStatement(String variable,String initExpr,String satExpr){
  String name=_getNextIfSymbol();
  _currentIfTree=_currentIfTree.addChild(name);
  _currentIfTree.isForStatement=true;
  _currentIfTree.variable=variable;
  _currentIfTree.initExpr=initExpr;
  _currentIfTree.satExpr=satExpr;
}
Program: 74800
Project: 74800
Buggy source:
/** 
 * Pop out of the scope of the current if statement and into its container block's scope.
 * @return The unique name of the if-statement block being exited.
 * @exception PtalonScopeException If the current scope is alreadythe outermost scope.
 */
public String popIfStatement() throws PtalonScopeException {
  String name=_currentTree.getName();
  _currentTree=_currentTree.getParent();
  if (_currentTree == null) {
    throw new PtalonScopeException("String_Node_Str");
  }
  return name;
}

Fixed version (ground truth):
/** 
 * Pop out of the scope of the current if statement and into its container block's scope.
 * @return The unique name of the if-statement block being exited.
 * @exception PtalonScopeException If the current scope is alreadythe outermost scope.
 */
public String popIfStatement() throws PtalonScopeException {
  String name=_currentIfTree.getName();
  _currentIfTree=_currentIfTree.getParent();
  if (_currentIfTree == null) {
    throw new PtalonScopeException("String_Node_Str");
  }
  return name;
}
Program: 74801
Project: 74801
Buggy source:
/** 
 * Prepare the compiler to start at the outermost scope  of the Ptalon program during run time.
 */
public void startAtTop(){
  _currentTree=_root;
}

Fixed version (ground truth):
/** 
 * Prepare the compiler to start at the outermost scope  of the Ptalon program during run time.
 */
public void startAtTop(){
  _currentIfTree=_root;
}
Program: 74804
Project: 74804
Buggy source:
/** 
 * Push an actor name onto the current tree, or create a new tree if entering a new nested actor declaration.  This is called when loading an existsing Ptalon actor from a PtalonML description.  After this is called  setCurrentSymbol should also get called.
 * @param actorName The unique name of the actor.
 * @exception PtalonScopeException If actorName is not a validparameter or import in the current scope.
 */
public void pushUniqueActorDeclaration(String actorName) throws PtalonScopeException {
  if (_currentTree == null) {
    _currentTree=new ActorTree(null,actorName);
    _trees.add(_currentTree);
  }
 else {
    _currentTree=_currentTree.addChild(actorName);
  }
}

Fixed version (ground truth):
/** 
 * Push an actor name onto the current tree, or create a new tree if entering a new nested actor declaration.  This is called when loading an existsing Ptalon actor from a PtalonML description.  After this is called  setCurrentSymbol should also get called.
 * @param actorName The unique name of the actor.
 * @exception PtalonScopeException If actorName is not a validparameter or import in the current scope.
 */
public void pushUniqueActorDeclaration(String actorName) throws PtalonScopeException {
  if (_currentActorTree == null) {
    _currentActorTree=new ActorTree(null,actorName);
    _trees.add(_currentActorTree);
  }
 else {
    _currentActorTree=_currentActorTree.addChild(actorName);
  }
}
Program: 74805
Project: 74805
Buggy source:
/** 
 * @return True if this nested actor is ready to be created.
 * @exception PtalonRuntimeException If there isproblem accessing any parameters.
 */
public boolean isReady() throws PtalonRuntimeException {
  for (  String portName : _unknownLeftSides.keySet()) {
    if (evaluateString(_unknownLeftSides.get(portName)) == null) {
      return false;
    }
  }
  for (  String portName : _unknownExpressions.keySet()) {
    if (evaluateString(_unknownExpressions.get(portName)) == null) {
      return false;
    }
  }
  try {
    if (getType(_symbol).equals("String_Node_Str")) {
      PtalonParameter param=_actor.getPtalonParameter(_symbol);
      if (!param.hasValue()) {
        return false;
      }
    }
 else     if (!(getType(_symbol).equals("String_Node_Str") || getType(_symbol).equals("String_Node_Str"))) {
      throw new PtalonRuntimeException("String_Node_Str" + _symbol);
    }
    for (    String bool : _boolParams) {
      PtalonBoolParameter param=(PtalonBoolParameter)_actor.getAttribute(getMappedName(bool));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    String integer : _intParams) {
      PtalonIntParameter param=(PtalonIntParameter)_actor.getAttribute(getMappedName(integer));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    ActorTree child : _children) {
      if (!child.isReady()) {
        return false;
      }
    }
    return true;
  }
 catch (  Exception e) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @return True if this nested actor is ready to be created.
 * @exception PtalonRuntimeException If there isproblem accessing any parameters.
 */
public boolean isReady() throws PtalonRuntimeException {
  for (  String portName : _unknownLeftSides.keySet()) {
    if (evaluateString(_unknownLeftSides.get(portName)) == null) {
      return false;
    }
  }
  for (  String portName : _unknownExpressions.keySet()) {
    if (evaluateString(_unknownExpressions.get(portName)) == null) {
      return false;
    }
  }
  try {
    if (_getType(_symbol).equals("String_Node_Str")) {
      PtalonParameter param=_actor.getPtalonParameter(_symbol);
      if (!param.hasValue()) {
        return false;
      }
    }
 else     if (!(_getType(_symbol).equals("String_Node_Str") || _getType(_symbol).equals("String_Node_Str"))) {
      throw new PtalonRuntimeException("String_Node_Str" + _symbol);
    }
    for (    String bool : _boolParams) {
      PtalonBoolParameter param=(PtalonBoolParameter)_actor.getAttribute(getMappedName(bool));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    String integer : _intParams) {
      PtalonIntParameter param=(PtalonIntParameter)_actor.getAttribute(getMappedName(integer));
      if (!param.hasValue()) {
        return false;
      }
    }
    for (    ActorTree child : _children) {
      if (!child.isReady()) {
        return false;
      }
    }
    return true;
  }
 catch (  Exception e) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
}
Program: 74806
Project: 74806
Buggy source:
/** 
 * Add a symbol to the scope of this if statement.
 * @param symbol The sybmol to add.
 * @param type Its corresponding type.
 * @param status It's statust, that is whether it has been loaded or not.
 * @param uniqueName The unique name of this 
 */
public void addSymbol(String symbol,String type,boolean status,String uniqueName){
  super.addSymbol(symbol,type,status,uniqueName);
  if (type.equals("String_Node_Str")) {
    _instanceNumbers.put(symbol,-1);
  }
}

Fixed version (ground truth):
/** 
 * Add a symbol with the given name and type to the sybol table at the current level of the if-tree hierachy.
 * @param name The symbol name.
 * @param type The symbol type.
 * @exception PtalonScopeException If a symbol with this name has alreadybeen added somewhere in the current scope.
 */
public void addSymbol(String name,String type) throws PtalonScopeException {
  super.addSymbol(name,type);
  if (type.equals("String_Node_Str")) {
    _instanceNumbers.put(name,-1);
  }
}
Program: 74807
Project: 74807
Buggy source:
/** 
 * Return a unique symbol for the given symbol. The symbol will always end with a whole number.  For instance _uniqueSymbol("Foo") may return "Foo0", "Foo1", or "Foo2".  The input symbol is assumed to refer to a previously declared parameter or import statement.
 * @symbol The symbol from which to derive the unique symbol.
 * @return A unique name.
 * @exception PtalonScopeException If the symbol does not referto a parameter or import valid in the current scope.
 */
private String _uniqueSymbol(String symbol) throws PtalonScopeException {
  String type=getType(symbol);
  if (!(type.equals("String_Node_Str") || type.equals("String_Node_Str") || type.equals("String_Node_Str"))) {
    throw new PtalonScopeException("String_Node_Str" + symbol + "String_Node_Str");
  }
  try {
    Integer number=_instanceNumbers.get(symbol) + 1;
    _instanceNumbers.put(symbol,number);
    String output=symbol + number;
    return output;
  }
 catch (  Exception e) {
    throw new PtalonScopeException("String_Node_Str" + symbol,e);
  }
}

Fixed version (ground truth):
/** 
 * Return a unique symbol for the given symbol. The symbol will always end with a whole number.  For instance _uniqueSymbol("Foo") may return "Foo0", "Foo1", or "Foo2".  The input symbol is assumed to refer to a previously declared parameter or import statement.
 * @symbol The symbol from which to derive the unique symbol.
 * @return A unique name.
 * @exception PtalonScopeException If the symbol does not referto a parameter or import valid in the current scope.
 */
private String _uniqueSymbol(String symbol) throws PtalonScopeException {
  String type=_getType(symbol);
  if (!(type.equals("String_Node_Str") || type.equals("String_Node_Str") || type.equals("String_Node_Str"))) {
    throw new PtalonScopeException("String_Node_Str" + symbol + "String_Node_Str");
  }
  try {
    Integer number=_instanceNumbers.get(symbol) + 1;
    _instanceNumbers.put(symbol,number);
    String output="String_Node_Str" + symbol + "String_Node_Str"+ number;
    return output;
  }
 catch (  Exception e) {
    throw new PtalonScopeException("String_Node_Str" + symbol,e);
  }
}
Program: 74808
Project: 74808
Buggy source:
/** 
 * Create a new NestedActorManager.
 * @param actor The ptalon actor for this manager.
 */
public NestedActorManager(PtalonActor actor){
  super(actor);
  _trees=new LinkedList<ActorTree>();
  _instanceNumbers=new Hashtable<String,Integer>();
  _instanceNumbers.put("String_Node_Str",0);
  addSymbol("String_Node_Str","String_Node_Str",true,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Create a new NestedActorManager.
 * @param actor The ptalon actor for this manager.
 */
public NestedActorManager(PtalonActor actor){
  super(actor);
  _trees=new LinkedList<ActorTree>();
  _instanceNumbers=new Hashtable<String,Integer>();
  _instanceNumbers.put("String_Node_Str",0);
  try {
    addSymbol("String_Node_Str","String_Node_Str");
  }
 catch (  PtalonScopeException e) {
  }
  _currentIfTree.setStatus("String_Node_Str",true);
}
Program: 74809
Project: 74809
Buggy source:
/** 
 * Exit the current actor declaration.
 * @exception PtalonRuntimeException If already at the top-level if scope.
 */
public void exitActorDeclaration() throws PtalonRuntimeException {
  if (_currentTree == null) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  _currentTree=_currentTree.getParent();
}

Fixed version (ground truth):
/** 
 * Exit the current actor declaration.
 * @exception PtalonRuntimeException If already at the top-level if scope.
 */
public void exitActorDeclaration() throws PtalonRuntimeException {
  if (_currentActorTree == null) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  _currentActorTree=_currentActorTree.getParent();
}
Program: 74810
Project: 74810
Buggy source:
/** 
 * Pop into Push an actor name onto the current tree, or create a new tree if entering a new nested actor declaration.
 * @return The unique name of the actor declaration being popped from.
 * @exception PtalonScopeException If not inside an actor declaration.
 */
public String popActorDeclaration() throws PtalonScopeException {
  if (_currentTree == null) {
    throw new PtalonScopeException("String_Node_Str");
  }
  String output=_currentTree.getName();
  _currentTree=_currentTree.getParent();
  return output;
}

Fixed version (ground truth):
/** 
 * Pop into Push an actor name onto the current tree, or create a new tree if entering a new nested actor declaration.
 * @return The unique name of the actor declaration being popped from.
 * @exception PtalonScopeException If not inside an actor declaration.
 */
public String popActorDeclaration() throws PtalonScopeException {
  if (_currentActorTree == null) {
    throw new PtalonScopeException("String_Node_Str");
  }
  String output=_currentActorTree.getName();
  _currentActorTree=_currentActorTree.getParent();
  return output;
}
Program: 74811
Project: 74811
Buggy source:
/** 
 * Sets the current actor's symbol, which should be a symbol name in the Ptalon code for a parameter or import.
 * @param name The symbol.
 * @exception PtalonRuntimeException If not in the scope of an actor declaration.
 */
public void setCurrentSymbol(String name) throws PtalonRuntimeException {
  if (_currentTree != null) {
    _currentTree.setSymbol(name);
  }
 else {
    throw new PtalonRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Sets the current actor's symbol, which should be a symbol name in the Ptalon code for a parameter or import.
 * @param name The symbol.
 * @exception PtalonRuntimeException If not in the scope of an actor declaration.
 */
public void setCurrentSymbol(String name) throws PtalonRuntimeException {
  if (_currentActorTree != null) {
    _currentActorTree.setSymbol(name);
  }
 else {
    throw new PtalonRuntimeException("String_Node_Str");
  }
}
Program: 74812
Project: 74812
Buggy source:
/** 
 * Enter the named actor declaration.
 * @param name The name of the actor declaration.
 * @exception PtalonRuntimeException If such an actor declaration does not exist.
 */
public void enterActorDeclaration(String name) throws PtalonRuntimeException {
  if (name.equals("String_Node_Str")) {
    return;
  }
  boolean exists=false;
  if (_currentTree == null) {
    for (    ActorTree tree : _trees) {
      if (tree.getName().equals(name)) {
        exists=true;
        _currentTree=tree;
        break;
      }
    }
  }
 else {
    for (    ActorTree tree : _currentTree.getChildren()) {
      if (tree.getName().equals(name)) {
        exists=true;
        _currentTree=tree;
        break;
      }
    }
  }
  if (!exists) {
    throw new PtalonRuntimeException("String_Node_Str" + name + "String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Enter the named actor declaration.
 * @param name The name of the actor declaration.
 * @exception PtalonRuntimeException If such an actor declaration does not exist.
 */
public void enterActorDeclaration(String name) throws PtalonRuntimeException {
  if (name.equals("String_Node_Str")) {
    return;
  }
  boolean exists=false;
  if (_currentActorTree == null) {
    for (    ActorTree tree : _trees) {
      if (tree.getName().equals(name)) {
        exists=true;
        _currentActorTree=tree;
        break;
      }
    }
  }
 else {
    for (    ActorTree tree : _currentActorTree.getChildren()) {
      if (tree.getName().equals(name)) {
        exists=true;
        _currentActorTree=tree;
        break;
      }
    }
  }
  if (!exists) {
    throw new PtalonRuntimeException("String_Node_Str" + name + "String_Node_Str");
  }
}
Program: 74813
Project: 74813
Buggy source:
/** 
 * Get an expression representing this actor tree, like a := b(c := d())(n := <2/>)
 * @return
 * @throws PtalonRuntimeException
 */
public String getExpression() throws PtalonRuntimeException {
  if (_actorParameter == null) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  String type="String_Node_Str";
  try {
    type=getType(_symbol);
  }
 catch (  PtalonScopeException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
  String output="String_Node_Str";
  if (type.equals("String_Node_Str")) {
    output+="String_Node_Str" + _imports.get(_symbol);
  }
 else   if (type.equals("String_Node_Str")) {
    Parameter parameter=_actor.getPtalonParameter(_symbol);
    output+=parameter.getExpression();
  }
 else {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  for (  ActorTree child : _children) {
    output+="String_Node_Str" + child.getExpression() + "String_Node_Str";
  }
  for (  String param : _parameters.keySet()) {
    output+="String_Node_Str" + param + "String_Node_Str"+ _parameters.get(param)+ "String_Node_Str";
  }
  return output;
}

Fixed version (ground truth):
/** 
 * Get an expression representing this actor tree, like a := b(c := d())(n := <2/>)
 * @return
 * @throws PtalonRuntimeException
 */
public String getExpression() throws PtalonRuntimeException {
  if (_actorParameter == null) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  String type="String_Node_Str";
  try {
    type=_getType(_symbol);
  }
 catch (  PtalonScopeException e) {
    throw new PtalonRuntimeException("String_Node_Str",e);
  }
  String output="String_Node_Str";
  if (type.equals("String_Node_Str")) {
    output+="String_Node_Str" + _imports.get(_symbol);
  }
 else   if (type.equals("String_Node_Str")) {
    Parameter parameter=_actor.getPtalonParameter(_symbol);
    output+=parameter.getExpression();
  }
 else {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  for (  ActorTree child : _children) {
    output+="String_Node_Str" + child.getExpression() + "String_Node_Str";
  }
  for (  String param : _parameters.keySet()) {
    output+="String_Node_Str" + param + "String_Node_Str"+ _parameters.get(param)+ "String_Node_Str";
  }
  return output;
}
Program: 74815
Project: 74815
Buggy source:
/** 
 * Prepare the compiler to start at the outermost scope  of the Ptalon program during run time.
 */
public void startAtTop(){
  super.startAtTop();
  _currentTree=null;
}

Fixed version (ground truth):
/** 
 * Prepare the compiler to start at the outermost scope  of the Ptalon program during run time.
 */
public void startAtTop(){
  super.startAtTop();
  _currentActorTree=null;
}
Program: 74816
Project: 74816
Buggy source:
/** 
 * @return true if the current actor declaration is ready to be created.
 * @exception PtalonRuntimeException If it is thrown trying to access a parameter,or if there is no actor declaration to create..
 */
public boolean isActorReady() throws PtalonRuntimeException {
  if (_currentTree == null) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  if ((_currentTree.created) && (!inNewWhileIteration())) {
    return false;
  }
  if (isReady()) {
    return _currentTree.isReady();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @return true if the current actor declaration is ready to be created.
 * @exception PtalonRuntimeException If it is thrown trying to access a parameter,or if there is no actor declaration to create..
 */
public boolean isActorReady() throws PtalonRuntimeException {
  if (_currentActorTree == null) {
    throw new PtalonRuntimeException("String_Node_Str");
  }
  if ((_currentActorTree.created)) {
    if (_inNewWhileIteration()) {
      int iteration=_currentActorTree.createdIteration;
      if ((iteration == 0) || (iteration == _currentIfTree.entered)) {
      }
 else {
        return false;
      }
    }
 else {
      return false;
    }
  }
  if (isReady()) {
    return _currentActorTree.isReady();
  }
  return false;
}
Program: 74817
Project: 74817
Buggy source:
/** 
 * Push an actor name onto the current tree, or create a new tree if entering a new nested actor declaration.
 * @param actorName The name of the actor.
 * @exception PtalonScopeException If actorName is not a validparameter or import in the current scope.
 */
public void pushActorDeclaration(String actorName) throws PtalonScopeException {
  String uniqueName=_uniqueSymbol(actorName);
  if (_currentTree == null) {
    _currentTree=new ActorTree(null,uniqueName);
    _trees.add(_currentTree);
  }
 else {
    _currentTree=_currentTree.addChild(uniqueName);
  }
  _currentTree.setSymbol(actorName);
}

Fixed version (ground truth):
/** 
 * Push an actor name onto the current tree, or create a new tree if entering a new nested actor declaration.
 * @param actorName The name of the actor.
 * @exception PtalonScopeException If actorName is not a validparameter or import in the current scope.
 */
public void pushActorDeclaration(String actorName) throws PtalonScopeException {
  String uniqueName=_uniqueSymbol(actorName);
  if (_currentActorTree == null) {
    _currentActorTree=new ActorTree(null,uniqueName);
    _trees.add(_currentActorTree);
  }
 else {
    _currentActorTree=_currentActorTree.addChild(uniqueName);
  }
  _currentActorTree.setSymbol(actorName);
}
Program: 74823
Project: 74823
Buggy source:
/** 
 * Process the start of a PtalonML element.
 * @param elname The element type name.
 * @exception java.lang.Exception If there is any trouble creatingthe AST or code manager,
 */
public void startElement(String elname) throws Exception {
  if (elname.equals("String_Node_Str")) {
    if (_attributes.containsKey("String_Node_Str")) {
      String name=_attributes.get("String_Node_Str");
      name=name.replace("String_Node_Str","String_Node_Str");
      name=name + "String_Node_Str";
      File file=new File(StringUtilities.getProperty("String_Node_Str"));
      file=new File(file,name);
      _actor.ptalonCodeLocation.setToken(new StringToken(file.toString()));
    }
  }
 else   if (elname.equals("String_Node_Str")) {
    if (_attributes.containsKey("String_Node_Str") && _attributes.containsKey("String_Node_Str")) {
      PtalonParameter param=(PtalonParameter)_actor.getAttribute(_attributes.get("String_Node_Str"));
      if (param instanceof PtalonBoolParameter) {
        param.setToken(new BooleanToken(_attributes.get("String_Node_Str")));
      }
 else       if (param instanceof PtalonIntParameter) {
        param.setToken(new IntToken(_attributes.get("String_Node_Str")));
      }
 else {
        param.setToken(new StringToken(_attributes.get("String_Node_Str")));
      }
    }
  }
  _attributes.clear();
}

Fixed version (ground truth):
/** 
 * Process the start of a PtalonML element.
 * @param elname The element type name.
 * @exception java.lang.Exception If there is any trouble creatingthe AST or code manager,
 */
public void startElement(String elname) throws Exception {
  if (elname.equals("String_Node_Str")) {
    if (_attributes.containsKey("String_Node_Str")) {
      String name=_attributes.get("String_Node_Str");
      name=name.replace("String_Node_Str","String_Node_Str");
      name=name + "String_Node_Str";
      File file=new File(StringUtilities.getProperty("String_Node_Str"));
      file=new File(file,name);
      _actor.ptalonCodeLocation.setToken(new StringToken(file.toString()));
    }
  }
 else   if (elname.equals("String_Node_Str")) {
    if (_attributes.containsKey("String_Node_Str") && _attributes.containsKey("String_Node_Str")) {
      PtalonParameter param=(PtalonParameter)_actor.getAttribute(_attributes.get("String_Node_Str"));
      param.setToken(new StringToken(_attributes.get("String_Node_Str")));
    }
  }
 else   if (elname.equals("String_Node_Str")) {
    if (_attributes.containsKey("String_Node_Str") && _attributes.containsKey("String_Node_Str")) {
      PtalonExpressionParameter param=(PtalonExpressionParameter)_actor.getAttribute(_attributes.get("String_Node_Str"));
      param.setExpression(_attributes.get("String_Node_Str"));
      _actor.attributeChanged(param);
    }
  }
  _attributes.clear();
}
Program: 74824
Project: 74824
Buggy source:
/** 
 * Check the comments from the start position.
 * @param startPosition The start position.
 */
private void _checkComments(int startPosition){
  while ((_comment != null) && (_commentStartPosition <= startPosition)) {
    _comment.accept(this);
    startPosition=_comment.getStartPosition() + _comment.getLength();
    try {
      _nextComment();
    }
 catch (    IOException e) {
      throw new ASTIORuntimeException(e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Check the comments from the start position.
 * @param startPosition The start position.
 */
private void _checkComments(int startPosition){
  while ((_comment != null) && (_commentStartPosition <= startPosition)) {
    _comment.accept(this);
    startPosition+=_comment.getLength();
    try {
      _nextComment();
    }
 catch (    IOException e) {
      throw new ASTIORuntimeException(e);
    }
  }
}
Program: 74825
Project: 74825
Buggy source:
/** 
 * Appends the text representation of the given modifier flags, followed by a single space. Used for JLS2 modifiers.
 * @param modifiers the modifier flags
 */
private void _outputModifiers(int modifiers){
  if (Modifier.isPublic(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isProtected(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isPrivate(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isStatic(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isAbstract(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isFinal(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isSynchronized(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isVolatile(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isNative(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isStrictfp(modifiers)) {
    _output("String_Node_Str");
  }
  if (Modifier.isTransient(modifiers)) {
    _output("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Appends the text representation of the given modifier flags, followed by a single space. Used for 3.0 modifiers and annotations.
 * @param ext the list of modifier and annotation nodes(element type: <code>IExtendedModifiers</code>)
 */
private void _outputModifiers(List ext){
  for (Iterator it=ext.iterator(); it.hasNext(); ) {
    ASTNode p=(ASTNode)it.next();
    p.accept(this);
    _output("String_Node_Str");
  }
}
Program: 74826
Project: 74826
Buggy source:
/** 
 * Visit an ast node, and return whether its children should be further visited.
 * @param node The AST node.
 * @return Whether its children should be further visited.
 */
public boolean visit(WhileStatement node){
  _output(_indent);
  _output("String_Node_Str");
  node.getExpression().accept(this);
  _output("String_Node_Str");
  if (!(node.getBody() instanceof Block)) {
    _output("String_Node_Str");
    _increaseIndent();
  }
  node.getBody().accept(this);
  if (!(node.getBody() instanceof Block)) {
    _decreaseIndent();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Visit an ast node, and return whether its children should be further visited.
 * @param node The AST node.
 * @return Whether its children should be further visited.
 */
public boolean visit(WildcardType node){
  _output("String_Node_Str");
  Type bound=node.getBound();
  if (bound != null) {
    if (node.isUpperBound()) {
      _output("String_Node_Str");
    }
 else {
      _output("String_Node_Str");
    }
    bound.accept(this);
  }
  return false;
}
Program: 74827
Project: 74827
Buggy source:
/** 
 * Initialize the state of the filter.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  for (int i=0; i <= _order; i++) {
    _estimatedErrorPowerCache[i]=0;
  }
}

Fixed version (ground truth):
/** 
 * Initialize the state of the filter.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  for (int i=0; i <= _order; i++) {
    _estimatedErrorPower[i]=0.0;
    _estimatedErrorPowerCache[i]=0.0;
    if (i < _order) {
      _reflectionCoefficientsCache[i]=0.0;
    }
  }
  ArrayToken value=(ArrayToken)reflectionCoefficients.getToken();
  for (int i=0; i < _order; i++) {
    _reflectionCoefficients[i]=((DoubleToken)value.getElement(i)).doubleValue();
  }
}
Program: 74828
Project: 74828
Buggy source:
/** 
 * Initialize the state of the filter.
 */
public void initialize() throws IllegalActionException {
  for (int i=0; i < (_order + 1); i++) {
    _forward[i]=0;
    _backward[i]=0;
  }
}

Fixed version (ground truth):
/** 
 * Initialize the state of the filter.
 */
public void initialize() throws IllegalActionException {
  for (int i=0; i < (_order + 1); i++) {
    _forward[i]=0.0;
    _forwardCache[i]=0.0;
    _backward[i]=0.0;
    _backwardCache[i]=0.0;
  }
}
Program: 74829
Project: 74829
Buggy source:
/** 
 * Initialize the state of the filter.
 */
public void initialize() throws IllegalActionException {
  for (int i=0; i < _forward.length; i++) {
    _forward[i]=0;
    _backward[i]=0;
  }
}

Fixed version (ground truth):
/** 
 * Initialize the state of the filter.
 */
public void initialize() throws IllegalActionException {
  for (int i=0; i < _forward.length; i++) {
    _forward[i]=0.0;
    _forwardCache[i]=0.0;
    _backward[i]=0.0;
    _backwardCache[i]=0.0;
  }
}