nus-yam/ex-repair huggingface dataset:
Program: 75472
Project: 75472
Buggy source:
/** 
 * Invoke the initialize() method of each deeply contained actor. This method should be invoked once per execution, after the initialization phase, but before any iteration.  Since type resolution has been completed, the initialize() method of a contained actor may produce output or schedule events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException If the initialize() method ofone of the associated actors throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _firingsSoFar=0;
}

Fixed version (ground truth):
/** 
 * Invoke the initialize() method of each deeply contained actor. This method should be invoked once per execution, after the initialization phase, but before any iteration.  Since type resolution has been completed, the initialize() method of a contained actor may produce output or schedule events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException If the initialize() method ofone of the associated actors throws it.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _firingsSoFar=0;
  FSMActor controller=getController();
  State initialState=controller.getInitialState();
  TypedCompositeActor curRefinement=(TypedCompositeActor)(initialState.getRefinement())[0];
  if (curRefinement != null) {
    Director refinementDir=curRefinement.getDirector();
    if (_debug_info) {
      System.out.println(getName() + "String_Node_Str" + "String_Node_Str"+ curRefinement.getFullName());
      System.out.println(getName() + "String_Node_Str" + "String_Node_Str"+ refinementDir.getFullName());
    }
    if (refinementDir instanceof HDFFSMDirector) {
      refinementDir.initialize();
    }
 else     if (refinementDir instanceof HDFDirector) {
      Scheduler refinmentSched=((StaticSchedulingDirector)refinementDir).getScheduler();
      refinmentSched.setValid(false);
      ((HDFDirector)refinementDir).getSchedule();
      if (_debug_info)       System.out.println(getName() + "String_Node_Str" + refinementDir.getFullName());
      if (_debug_info) {
        CompositeActor container=(CompositeActor)getContainer();
        System.out.println(getName() + "String_Node_Str" + ((Nameable)container).getName());
      }
    }
 else     if (refinementDir instanceof SDFDirector) {
      Scheduler refinmentSched=((StaticSchedulingDirector)refinementDir).getScheduler();
      refinmentSched.setValid(false);
      refinmentSched.getSchedule();
    }
 else {
      throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str");
    }
    _updateInputTokenConsumptionRates(curRefinement);
    _updateOutputTokenProductionRates(curRefinement);
    if (_debug_info)     System.out.println(getName() + "String_Node_Str" + "String_Node_Str");
    CompositeActor hdfActor=_getHighestFSM();
    Director director=hdfActor.getExecutiveDirector();
    ((StaticSchedulingDirector)director).invalidateSchedule();
  }
 else {
    throw new IllegalActionException(this,"String_Node_Str");
  }
}
Program: 75476
Project: 75476
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new actor.
 * @param workspace The workspace for the new actor.
 * @return A new FSMActor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  FSMActor newObject=(FSMActor)super.clone(workspace);
  newObject._inputPortsVersion=-1;
  newObject._outputPortsVersion=-1;
  newObject._connectionMapsVersion=-1;
  newObject._connectionMaps=null;
  newObject._initialStateVersion=-1;
  newObject._inputVariableMap=new HashMap();
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then sets the attribute public members to refer to the attributes of the new actor.
 * @param workspace The workspace for the new actor.
 * @return A new FSMActor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  FSMActor newObject=(FSMActor)super.clone(workspace);
  newObject._inputPortsVersion=-1;
  newObject._outputPortsVersion=-1;
  newObject._connectionMapsVersion=-1;
  newObject._connectionMaps=null;
  newObject._initialStateVersion=-1;
  newObject._inputVariableMap=new HashMap();
  newObject._inputVariableVersion=-1;
  return newObject;
}
Program: 75479
Project: 75479
Buggy source:
/** 
 * Create a new TypedIOPort with the specified name. The container of the port is set to this actor. This method is write-synchronized on the workspace.
 * @param name The name for the new port.
 * @return The new port.
 * @exception NameDuplicationException If the actor already has a portwith the specified name.
 */
public Port newPort(String name) throws NameDuplicationException {
  try {
    _workspace.getWriteAccess();
    TypedIOPort p=new TypedIOPort(this,name);
    return p;
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + ex.getMessage());
  }
 finally {
    _workspace.doneWriting();
  }
}

Fixed version (ground truth):
/** 
 * Create a new TypedIOPort with the specified name. The container of the port is set to this actor. This method is write-synchronized on the workspace.
 * @param name The name for the new port.
 * @return The new port.
 * @exception NameDuplicationException If the actor already has a portwith the specified name.
 */
public Port newPort(String name) throws NameDuplicationException {
  try {
    _workspace.getWriteAccess();
    return new TypedIOPort(this,name);
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + ex.getMessage());
  }
 finally {
    _workspace.doneWriting();
  }
}
Program: 75480
Project: 75480
Buggy source:
/** 
 * Construct a new tableau for the model represented by the given effigy.
 * @param container The container.
 * @param name The name.
 * @param editor The text editor to use, or null to use the default.
 * @exception IllegalActionException If the container does not acceptthis entity (this should not occur).
 * @exception NameDuplicationException If the name coincides with anattribute already in the container.
 */
public TextEditorTableau(TextEffigy container,String name,TextEditor editor) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  String title="String_Node_Str";
  TextEditor frame=editor;
  if (frame == null) {
    frame=new TextEditor(title,container.getDocument());
  }
  frame.text.setColumns(80);
  frame.text.setRows(40);
  setFrame(frame);
  frame.setTableau(this);
}

Fixed version (ground truth):
/** 
 * Construct a new tableau for the model represented by the given effigy.
 * @param container The container.
 * @param name The name.
 * @param editor The text editor to use, or null to use the default.
 * @exception IllegalActionException If the container does not acceptthis entity (this should not occur).
 * @exception NameDuplicationException If the name coincides with anattribute already in the container.
 */
public TextEditorTableau(TextEffigy container,String name,TextEditor editor) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  String title="String_Node_Str";
  TextEditor frame=editor;
  if (frame == null) {
    frame=new TextEditor(title,container.getDocument());
  }
  frame.text.setColumns(80);
  frame.text.setRows(40);
  setFrame(frame);
  frame.setTableau(this);
  frame.setModified(false);
}
Program: 75481
Project: 75481
Buggy source:
/** 
 * Test if this graph is acyclic (is a DAG). The computation is done in <code>AcyclicAnalysis</code>. Please see  {@link ptolemy.graph.analysis.AcyclicAnalysis}
 * @return True if the the graph is acyclic, orempty; false otherwise.
 */
public boolean isAcyclic(){
  return !_acyclicAnalysis.hasCycle();
}

Fixed version (ground truth):
/** 
 * Test if this graph is acyclic (is a DAG).
 * @return True if the the graph is acyclic, orempty; false otherwise.
 */
public boolean isAcyclic(){
  return !_acyclicAnalysis.hasCycle();
}
Program: 75482
Project: 75482
Buggy source:
/** 
 * Override the base class to make the shell uneditable.
 * @exception IllegalActionException If the parent class throws it.
 */
public void wrapup() throws IllegalActionException {
  super.wrapup();
  if (_returnFalseInPostfire && _frame != null) {
    _frame.dispose();
  }
 else   if (shell != null) {
    shell.setEditable(false);
  }
}

Fixed version (ground truth):
/** 
 * Override the base class to make the shell uneditable.
 * @exception IllegalActionException If the parent class throws it.
 */
public void wrapup() throws IllegalActionException {
  super.wrapup();
  if (_returnFalseInPostfire && _frame != null) {
    _frame.dispose();
    _frame=null;
    shell=null;
  }
 else   if (shell != null) {
    shell.setEditable(false);
  }
}
Program: 75483
Project: 75483
Buggy source:
/** 
 * Clone the variable.  This creates a new variable containing the same token (if the value was set with setToken()) or the same (unevaluated) expression, if the expression was set with setExpression().  The list of variables added to the scope is not cloned; i.e., the clone has an empty scope. The clone has the same static type constraints (those given by setTypeEquals() and setTypeAtMost()), but none of the dynamic type constraints (those relative to other variables).
 * @param workspace The workspace in which to place the cloned variable.
 * @exception CloneNotSupportedException Not thrown in this base class.
 * @see java.lang.Object#clone()
 * @return The cloned variable.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Variable newObject=(Variable)super.clone(workspace);
  if (_currentExpression != null) {
    newObject._needsEvaluation=true;
  }
  newObject._dependencyLoop=false;
  newObject._parserScope=null;
  if (_declaredType instanceof StructuredType && !_declaredType.isConstant()) {
    newObject._declaredType=(Type)((StructuredType)_declaredType).clone();
    newObject._varType=newObject._declaredType;
  }
  newObject._parseTree=null;
  newObject._constraints=new LinkedList();
  newObject._typeTerm=null;
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the variable.  This creates a new variable containing the same token (if the value was set with setToken()) or the same (unevaluated) expression, if the expression was set with setExpression().  The list of variables added to the scope is not cloned; i.e., the clone has an empty scope. The clone has the same static type constraints (those given by setTypeEquals() and setTypeAtMost()), but none of the dynamic type constraints (those relative to other variables).
 * @param workspace The workspace in which to place the cloned variable.
 * @exception CloneNotSupportedException Not thrown in this base class.
 * @see java.lang.Object#clone()
 * @return The cloned variable.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Variable newObject=(Variable)super.clone(workspace);
  if (_currentExpression != null) {
    newObject._needsEvaluation=true;
  }
  newObject._dependencyLoop=false;
  newObject._parserScope=null;
  _variablesDependentOn=null;
  if (_declaredType instanceof StructuredType && !_declaredType.isConstant()) {
    newObject._declaredType=(Type)((StructuredType)_declaredType).clone();
    newObject._varType=newObject._declaredType;
  }
  newObject._parseTree=null;
  newObject._constraints=new LinkedList();
  newObject._typeTerm=null;
  return newObject;
}
Program: 75484
Project: 75484
Buggy source:
/** 
 * Return true if the transition is enabled, that is the guard is true, or some event has been detected due to crossing some level.
 * @return True if the transition is enabled and some event is detected.
 * @exception IllegalActionException If thrown when evaluating the guard.
 */
public boolean isEnabled() throws IllegalActionException {
  try {
    if (!_relationList.isEmpty()) {
      _parseTreeEvaluator.setEvaluationMode(false);
    }
    Token token=_guard.getToken();
    if (token == null) {
      return false;
    }
    boolean result=((BooleanToken)token).booleanValue();
    return result;
  }
 catch (  UnknownResultException ex) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Return true if the transition is enabled, that is the guard is true, or some event has been detected due to crossing some level.
 * @return True if the transition is enabled and some event is detected.
 * @exception IllegalActionException If thrown when evaluating the guard.
 */
public boolean isEnabled() throws IllegalActionException {
  try {
    if (_exeDirectorIsHSDirector && !_relationList.isEmpty()) {
      _parseTreeEvaluator.setEvaluationMode(false);
    }
    Token token=_guard.getToken();
    if (token == null) {
      return false;
    }
    boolean result=((BooleanToken)token).booleanValue();
    return result;
  }
 catch (  UnknownResultException ex) {
    return false;
  }
}
Program: 75486
Project: 75486
Buggy source:
/** 
 * React to a change in an attribute. If the changed attribute is the <i>preemptive</i> parameter, evaluate the parameter. If the parameter is given an expression that does not evaluate to a boolean value, throw an exception; otherwise increment the version number of the workspace.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If thrown by the superclassattributeChanged() method, or the changed attribute is the <i>preemptive</i> parameter and is given an expression that does not evaluate to a boolean value.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  super.attributeChanged(attribute);
  if (attribute == preemptive) {
    preemptive.getToken();
    workspace().incrVersion();
  }
  if (attribute == guardExpression) {
    String expr=guardExpression.getExpression();
    _guard.setExpression(expr);
    _relationList.destroy();
    _parseTreeEvaluator.setEvaluationMode(true);
  }
  if (attribute == triggerExpression) {
    String expr=triggerExpression.getExpression();
    _trigger.setExpression(expr);
  }
  if (attribute == refinementName) {
    _refinementVersion=-1;
  }
  if (attribute == outputActions && _debugging)   outputActions.addDebugListener(new StreamListener());
  if (attribute == setActions && _debugging)   setActions.addDebugListener(new StreamListener());
}

Fixed version (ground truth):
/** 
 * React to a change in an attribute. If the changed attribute is the <i>preemptive</i> parameter, evaluate the parameter. If the parameter is given an expression that does not evaluate to a boolean value, throw an exception; otherwise increment the version number of the workspace.
 * @param attribute The attribute that changed.
 * @exception IllegalActionException If thrown by the superclassattributeChanged() method, or the changed attribute is the <i>preemptive</i> parameter and is given an expression that does not evaluate to a boolean value.
 */
public void attributeChanged(Attribute attribute) throws IllegalActionException {
  super.attributeChanged(attribute);
  if (attribute == preemptive) {
    preemptive.getToken();
    workspace().incrVersion();
  }
  if (attribute == guardExpression) {
    String expr=guardExpression.getExpression();
    _guard.setExpression(expr);
    if (_exeDirectorIsHSDirector) {
      _relationList.destroy();
      _parseTreeEvaluator.setEvaluationMode(true);
    }
  }
  if (attribute == triggerExpression) {
    String expr=triggerExpression.getExpression();
    _trigger.setExpression(expr);
  }
  if (attribute == refinementName) {
    _refinementVersion=-1;
  }
  if (attribute == outputActions && _debugging)   outputActions.addDebugListener(new StreamListener());
  if (attribute == setActions && _debugging)   setActions.addDebugListener(new StreamListener());
}
Program: 75488
Project: 75488
Buggy source:
/** 
 * Request that execution of the current iteration stops. This is similar to stopFire(), except that the current iteration is not allowed to complete.  This is useful if there is actor in the model that has a bug where it fails to consume inputs. An iteration will never terminate if such an actor receives an event. If the director is paused waiting for events to appear in the event queue, then it stops waiting, and calls stopFire() for all actors that are deeply contained by the container of this director.
 */
public void stop(){
  if (_eventQueue != null) {
synchronized (_eventQueue) {
      _stopRequested=true;
      _eventQueue.notifyAll();
    }
  }
  super.stop();
}

Fixed version (ground truth):
/** 
 * Request that execution of the current iteration stop. This is similar to stopFire(), except that the current iteration is not allowed to complete.  This is useful if there is actor in the model that has a bug where it fails to consume inputs. An iteration will never terminate if such an actor receives an event. If the director is paused waiting for events to appear in the event queue, then it stops waiting, and calls stopFire() for all actors that are deeply contained by the container of this director.
 */
public void stop(){
  if (_eventQueue != null) {
synchronized (_eventQueue) {
      _stopRequested=true;
      _eventQueue.notifyAll();
    }
  }
  super.stop();
}
Program: 75489
Project: 75489
Buggy source:
/** 
 * Request that execution of the current iteration completes. If the director is paused waiting for events to appear in the event queue, then it stops waiting, and calls stopFire() for all actors that are deeply contained by the container of this director.
 */
public void stopFire(){
  if (_eventQueue != null) {
synchronized (_eventQueue) {
      _eventQueue.notifyAll();
    }
  }
  super.stopFire();
}

Fixed version (ground truth):
/** 
 * Request that execution of the current iteration complete. If the director is paused waiting for events to appear in the event queue, then it stops waiting, and calls stopFire() for all actors that are deeply contained by the container of this director.
 */
public void stopFire(){
  if (_eventQueue != null) {
synchronized (_eventQueue) {
      _eventQueue.notifyAll();
    }
  }
  super.stopFire();
}
Program: 75490
Project: 75490
Buggy source:
/** 
 * Return the type of the identifier with the given name.
 * @exception IllegalActionException If the identifier is undefined.
 */
protected Type _getTypeForName(String name) throws IllegalActionException {
  if (_scope != null) {
    Type type=_scope.getType(name);
    if (type != null) {
      return type;
    }
  }
  if (Constants.get(name) != null) {
    return Constants.get(name).getType();
  }
  return BaseType.GENERAL;
}

Fixed version (ground truth):
/** 
 * Return the type of the identifier with the given name.
 * @exception IllegalActionException If the identifier is undefined.
 */
protected Type _getTypeForName(String name) throws IllegalActionException {
  if (_scope != null) {
    Type type=_scope.getType(name);
    if (type != null) {
      return type;
    }
  }
  if (Constants.get(name) != null) {
    return Constants.get(name).getType();
  }
  throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
}
Program: 75491
Project: 75491
Buggy source:
/** 
 * Set the type of the given node to be the type of constant the variable refers to, if the node represents a constant, or the type of the identifier the node refers to in the current scope.
 * @param node The specified node.
 * @exception IllegalActionException If an inference erroroccurs, or an identifier is not bound in the current scope.
 */
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    _setType(node,node.getToken().getType());
    return;
  }
  _setType(node,_getTypeForName(node.getName()));
}

Fixed version (ground truth):
/** 
 * Set the type of the given node to be the type of constant the variable refers to, if the node represents a constant, or the type of the identifier the node refers to in the current scope.
 * @param node The specified node.
 * @exception IllegalActionException If an inference erroroccurs, or an identifier is not bound in the current scope.
 */
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException {
  if (node.isConstant() && node.isEvaluated()) {
    _setType(node,node.getToken().getType());
    return;
  }
  String name=node.getName();
  if (_scope != null) {
    Type type=_scope.getType(name);
    if (type != null) {
      _setType(node,type);
      return;
    }
  }
  if (Constants.get(name) != null) {
    _setType(node,Constants.get(name).getType());
    return;
  }
  throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
}
Program: 75495
Project: 75495
Buggy source:
/** 
 * The model has finished executing, so set a flag so that the next time an actor tries to get or put it gets a TerminateProcessException which will cause it to finish.
 */
public synchronized void requestFinish(){
  _modelFinished=true;
  _setConditionalReceive(false,null);
  _setConditionalSend(false,null);
  _setPutWaiting(false);
  _setGetWaiting(false);
  _setRendezvousComplete(false);
}

Fixed version (ground truth):
/** 
 * The model has finished executing, so set a flag so that the next time an actor tries to get or put it gets a TerminateProcessException which will cause it to finish.
 */
public synchronized void requestFinish(){
  _modelFinished=true;
  _setConditionalReceive(false,null,-1);
  _setConditionalSend(false,null,-1);
  _setPutWaiting(false);
  _setGetWaiting(false);
  _setRendezvousComplete(false);
}
Program: 75496
Project: 75496
Buggy source:
/** 
 * Set a flag so that a ConditionalSend branch knows whether or not a ConditionalReceive is ready to rendezvous with it.
 * @param v Boolean indicating whether or not a conditionalreceive is waiting to rendezvous.
 * @param p The CSPActor which contains the ConditionalReceivebranch that is trying to rendezvous. It is stored in the receiver so that if a ConditionalSend arrives, it can easily check whether the ConditionalReceive branch was the first branch of its conditional construct(CIF or CDO) to succeed.
 */
protected synchronized void _setConditionalReceive(boolean v,ConditionalBranchController p){
  _conditionalReceiveWaiting=v;
  _otherController=p;
}

Fixed version (ground truth):
/** 
 * Set a flag so that a ConditionalSend branch knows whether or not a ConditionalReceive is ready to rendezvous with it.
 * @param v Boolean indicating whether or not a conditionalreceive is waiting to rendezvous.
 * @param p The CSPActor which contains the ConditionalReceivebranch that is trying to rendezvous. It is stored in the receiver so that if a ConditionalSend arrives, it can easily check whether the ConditionalReceive branch was the first branch of its conditional construct(CIF or CDO) to succeed.
 * @param otherID The branch ID of the branch requesting theconditional receive.
 */
protected synchronized void _setConditionalReceive(boolean v,ConditionalBranchController p,int otherID){
  _conditionalReceiveWaiting=v;
  _otherController=p;
  _otherID=otherID;
}
Program: 75497
Project: 75497
Buggy source:
/** 
 * Set a flag so that a ConditionalReceive branch knows whether or not a ConditionalSend is ready to rendezvous with it.
 * @param v Boolean indicating whether or not a conditionalsend is waiting to rendezvous.
 * @param p The CSPActor which contains the ConditionalSendbranch that is trying to rendezvous. It is stored in the receiver so that if a ConditionalReceive arrives, it can easily check whether the ConditionalSend branch was the first branch of its conditional construct(CIF or CDO) to succeed.
 */
protected synchronized void _setConditionalSend(boolean v,ConditionalBranchController p){
  _conditionalSendWaiting=v;
  _otherController=p;
}

Fixed version (ground truth):
/** 
 * Set a flag so that a ConditionalReceive branch knows whether or not a ConditionalSend is ready to rendezvous with it.
 * @param v Boolean indicating whether or not a conditionalsend is waiting to rendezvous.
 * @param p The CSPActor which contains the ConditionalSendbranch that is trying to rendezvous. It is stored in the receiver so that if a ConditionalReceive arrives, it can easily check whether the ConditionalSend branch was the first branch of its conditional construct(CIF or CDO) to succeed.
 * @param otherID The branch ID of the branch requesting theconditional send.
 */
protected synchronized void _setConditionalSend(boolean v,ConditionalBranchController p,int otherID){
  _conditionalSendWaiting=v;
  _otherController=p;
  _otherID=otherID;
}
Program: 75498
Project: 75498
Buggy source:
public ConditionalBranch(boolean guard,IOPort port,int branchID,ConditionalBranchController cbc) throws IllegalActionException {
  _branchID=branchID;
  _guard=guard;
  _controller=cbc;
}

Fixed version (ground truth):
/** 
 * Create a guarded communication statement. This class contains all of the information necessary to carry out a guarded communication statement, with the exception of the type of communication. The receiver is set in the subclass as it is subject to communication specific tests. This constructor allows actors which do not implement the ConditionalBranchActor interface access to CSP functionality by passing their own ConditionalBranchController.
 * @param guard The guard for the guarded communication statementrepresented by this object.
 * @param port The IOPort that contains the channel totry an communicate through.
 * @param branchID The identification number assigned to this branchupon creation by the CSPActor.
 * @param cbc The ConditionalBranchController associated with this branch.
 * @exception IllegalActionException If the actor that containsthe port is not of type CSPActor.
 */
public ConditionalBranch(boolean guard,IOPort port,int branchID,ConditionalBranchController cbc) throws IllegalActionException {
  _branchID=branchID;
  _guard=guard;
  _controller=cbc;
}
Program: 75499
Project: 75499
Buggy source:
/** 
 * Set the CSPReceiver this branch is trying to rendezvous with. This method should only be called from derived classes.
 * @param receiver The CSPReceiver this branch is trying to rendezvouswith.
 */
void setReceiver(CSPReceiver rec){
  _receiver=rec;
}

Fixed version (ground truth):
/** 
 * Set the CSPReceiver this branch is trying to rendezvous with. This method should only be called from derived classes.
 * @param rec The CSPReceiver this branch is trying to rendezvouswith.
 */
void setReceiver(CSPReceiver rec){
  _receiver=rec;
}
Program: 75500
Project: 75500
Buggy source:
/** 
 * Create a guarded communication with a get() communication.
 * @param guard The guard for the guarded communication statementrepresented by this object.
 * @param port The IOPort containing the channel (and thus receiver)that this branch will try to rendezvous with.
 * @param channel The channel in the IOPort that this branch istrying to rendezvous with.
 * @param branch The identification number assigned to this branchupon creation by the CSPActor.
 * @exception IllegalActionException If the channel has morethan one receiver or if the receiver is not of type CSPReceiver.
 */
public ConditionalReceive(boolean guard,IOPort port,int channel,int branch,ConditionalBranchController cbc) throws IllegalActionException {
  super(guard,port,branch,cbc);
  _init(port,channel);
}

Fixed version (ground truth):
/** 
 * Create a guarded communication with a get() communication. This constructor allows actors which are not CSPActors access to CSP functionality by providing their own ConditionalBranchController.
 * @param guard The guard for the guarded communication statementrepresented by this object.
 * @param port The IOPort containing the channel (and thus receiver)that this branch will try to rendezvous with.
 * @param channel The channel in the IOPort that this branch istrying to rendezvous with.
 * @param branch The identification number assigned to this branchupon creation by the CSPActor.
 * @param cbc The ConditionalBranchController that this branch uses.
 * @exception IllegalActionException If the channel has morethan one receiver or if the receiver is not of type CSPReceiver.
 */
public ConditionalReceive(boolean guard,IOPort port,int channel,int branch,ConditionalBranchController cbc) throws IllegalActionException {
  super(guard,port,branch,cbc);
  _init(port,channel);
}
Program: 75501
Project: 75501
Buggy source:
/** 
 * The run method has roughly three parts: (1) where there is already a put waiting, (2) where there is a ConditionalSend waiting, and (3) where the ConditionalReceive is the first to arrive at the receiver. <P> The algorithm used in this method, together with some methods in ConditionalBranchController, control how conditional communication takes place in the CSP domain.
 */
public void run(){
  try {
    CSPReceiver receiver=getReceiver();
    ConditionalBranchController controller=getController();
synchronized (receiver) {
      if (receiver._isConditionalReceiveWaiting() || receiver._isGetWaiting()) {
        throw new InvalidStateException(((Nameable)controller.getParent()).getName() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
      }
      while (true) {
        if (!isAlive()) {
          controller._branchFailed(getID());
          return;
        }
 else         if (receiver._isPutWaiting()) {
          _arriveAfterPut(receiver,controller);
          return;
        }
 else         if (receiver._isConditionalSendWaiting()) {
          if (!_arriveAfterConditionalSend(receiver,controller)) {
            return;
          }
        }
 else {
          _arriveFirst(receiver,controller);
          return;
        }
      }
    }
  }
 catch (  InterruptedException ex) {
    getController()._branchFailed(getID());
  }
catch (  TerminateProcessException ex) {
    getController()._branchFailed(getID());
  }
 finally {
    getReceiver()._setConditionalReceive(false,null);
  }
}

Fixed version (ground truth):
/** 
 * The run method has roughly three parts: (1) where there is already a put waiting, (2) where there is a ConditionalSend waiting, and (3) where the ConditionalReceive is the first to arrive at the receiver. <P> The algorithm used in this method, together with some methods in ConditionalBranchController, control how conditional communication takes place in the CSP domain.
 */
public void run(){
  try {
    CSPReceiver receiver=getReceiver();
    ConditionalBranchController controller=getController();
synchronized (receiver) {
      if (receiver._isConditionalReceiveWaiting() || receiver._isGetWaiting()) {
        throw new InvalidStateException(((Nameable)controller.getParent()).getName() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
      }
      while (true) {
        if (!isAlive()) {
          controller._branchFailed(getID());
          return;
        }
 else         if (receiver._isPutWaiting()) {
          _arriveAfterPut(receiver,controller);
          return;
        }
 else         if (receiver._isConditionalSendWaiting()) {
          if (!_arriveAfterConditionalSend(receiver,controller)) {
            return;
          }
        }
 else {
          _arriveFirst(receiver,controller);
          return;
        }
      }
    }
  }
 catch (  InterruptedException ex) {
    getController()._branchFailed(getID());
  }
catch (  TerminateProcessException ex) {
    getController()._branchFailed(getID());
  }
 finally {
    getReceiver()._setConditionalReceive(false,null,-1);
  }
}
Program: 75503
Project: 75503
Buggy source:
/** 
 * Begin a rendezvous attempt prior to any other conditionalSends or (non-conditional) put attempts. Wait until a put or conditionalSend attempt is made by another branch.
 * @param controller The conditional branch controller that control thisconditional receive.
 * @param receiver The CSPReceiver through which a rendezvous attempt istaking place.
 */
protected void _arriveFirst(CSPReceiver receiver,ConditionalBranchController controller) throws InterruptedException {
  receiver._setConditionalReceive(true,controller);
  getController()._branchBlocked(this.getReceiver());
  getReceiver()._checkFlagsAndWait();
  getController()._branchUnblocked(this.getReceiver());
  while (true) {
    if (!isAlive()) {
      receiver._setConditionalReceive(false,null);
      controller._branchFailed(getID());
      receiver.notifyAll();
      return;
    }
 else     if (receiver._isPutWaiting()) {
      if (controller._isBranchFirst(getID())) {
        receiver._setConditionalReceive(false,null);
        setToken(receiver.get());
        controller._branchSucceeded(getID());
        return;
      }
    }
    getController()._branchBlocked(this.getReceiver());
    getReceiver()._checkFlagsAndWait();
    getController()._branchUnblocked(this.getReceiver());
  }
}

Fixed version (ground truth):
/** 
 * Begin a rendezvous attempt prior to any other conditionalSends or (non-conditional) put attempts. Wait until a put or conditionalSend attempt is made by another branch.
 * @param controller The conditional branch controller that control thisconditional receive.
 * @param receiver The CSPReceiver through which a rendezvous attempt istaking place.
 */
protected void _arriveFirst(CSPReceiver receiver,ConditionalBranchController controller) throws InterruptedException {
  receiver._setConditionalReceive(true,controller,getID());
  getController()._branchBlocked(this.getReceiver());
  getReceiver()._checkFlagsAndWait();
  getController()._branchUnblocked(this.getReceiver());
  while (true) {
    System.out.println(Thread.currentThread().getName() + "String_Node_Str" + "String_Node_Str"+ isAlive()+ "String_Node_Str"+ "String_Node_Str"+ controller._isBranchFirst(getID())+ "String_Node_Str"+ "String_Node_Str"+ receiver._isPutWaiting());
    if (!isAlive()) {
      receiver._setConditionalReceive(false,null,-1);
      controller._branchFailed(getID());
      receiver.notifyAll();
      return;
    }
 else     if (controller._isBranchFirst(getID())) {
      if (receiver._isPutWaiting()) {
        receiver._setConditionalReceive(false,null,-1);
        setToken(receiver.get());
        controller._branchSucceeded(getID());
        return;
      }
 else {
        controller._releaseFirst(getID());
        receiver.notifyAll();
      }
    }
    getController()._branchBlocked(this.getReceiver());
    getReceiver()._checkFlagsAndWait();
    getController()._branchUnblocked(this.getReceiver());
  }
}
Program: 75505
Project: 75505
Buggy source:
/** 
 * The run method has roughly three parts: (1) when there is already a get waiting, (2) when there is a ConditionalReceive waiting, and (3) where this ConditionalSend is the first to arrive at the receiver. <P> The algorithm used in this method, together with some methods in ConditionalBranchController, control how conditional communication takes place in the CSP domain.
 */
public void run(){
  try {
    CSPReceiver receiver=getReceiver();
    ConditionalBranchController controller=getController();
synchronized (receiver) {
      if (receiver._isConditionalSendWaiting() || receiver._isPutWaiting()) {
        throw new InvalidStateException(((Nameable)controller.getParent()).getName() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
      }
      while (true) {
        if (!isAlive()) {
          controller._branchFailed(getID());
          return;
        }
 else         if (receiver._isGetWaiting()) {
          _arriveAfterGet(receiver,controller);
          return;
        }
 else         if (receiver._isConditionalReceiveWaiting()) {
          if (!_arriveAfterCondRec(receiver,controller)) {
            return;
          }
        }
 else {
          _arriveFirst(receiver,controller);
          return;
        }
      }
    }
  }
 catch (  InterruptedException ex) {
    getController()._branchFailed(getID());
  }
catch (  TerminateProcessException ex) {
    getController()._branchFailed(getID());
  }
 finally {
    setToken(null);
    getReceiver()._setConditionalSend(false,null);
  }
}

Fixed version (ground truth):
/** 
 * The run method has roughly three parts: (1) when there is already a get waiting, (2) when there is a ConditionalReceive waiting, and (3) where this ConditionalSend is the first to arrive at the receiver. <P> The algorithm used in this method, together with some methods in ConditionalBranchController, control how conditional communication takes place in the CSP domain.
 */
public void run(){
  try {
    CSPReceiver receiver=getReceiver();
    ConditionalBranchController controller=getController();
synchronized (receiver) {
      if (receiver._isConditionalSendWaiting() || receiver._isPutWaiting()) {
        throw new InvalidStateException(((Nameable)controller.getParent()).getName() + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
      }
      while (true) {
        if (!isAlive()) {
          controller._branchFailed(getID());
          return;
        }
 else         if (receiver._isGetWaiting()) {
          _arriveAfterGet(receiver,controller);
          return;
        }
 else         if (receiver._isConditionalReceiveWaiting()) {
          if (!_arriveAfterCondRec(receiver,controller)) {
            return;
          }
        }
 else {
          _arriveFirst(receiver,controller);
          return;
        }
      }
    }
  }
 catch (  InterruptedException ex) {
    getController()._branchFailed(getID());
  }
catch (  TerminateProcessException ex) {
    getController()._branchFailed(getID());
  }
 finally {
    setToken(null);
    getReceiver()._setConditionalSend(false,null,-1);
  }
}
Program: 75506
Project: 75506
Buggy source:
/** 
 * @param controller The conditional branch controller that controlsthis conditional receive.
 * @param receiver The CSPReceiver through which a rendezvous attempt istaking place.
 */
protected void _arriveFirst(CSPReceiver receiver,ConditionalBranchController controller) throws InterruptedException {
  receiver._setConditionalSend(true,controller);
  getController()._branchBlocked(this.getReceiver());
  getReceiver()._checkFlagsAndWait();
  getController()._branchUnblocked(this.getReceiver());
  while (true) {
    if (!isAlive()) {
      receiver._setConditionalSend(false,null);
      controller._branchFailed(getID());
      receiver.notifyAll();
      return;
    }
 else     if (receiver._isGetWaiting()) {
      if (controller._isBranchFirst(getID())) {
        receiver._setConditionalSend(false,null);
        receiver.put(getToken());
        controller._branchSucceeded(getID());
        return;
      }
    }
    getController()._branchBlocked(this.getReceiver());
    getReceiver()._checkFlagsAndWait();
    getController()._branchUnblocked(this.getReceiver());
  }
}

Fixed version (ground truth):
/** 
 * @param controller The conditional branch controller that controlsthis conditional receive.
 * @param receiver The CSPReceiver through which a rendezvous attempt istaking place.
 */
protected void _arriveFirst(CSPReceiver receiver,ConditionalBranchController controller) throws InterruptedException {
  receiver._setConditionalSend(true,controller,getID());
  getController()._branchBlocked(this.getReceiver());
  getReceiver()._checkFlagsAndWait();
  getController()._branchUnblocked(this.getReceiver());
  while (true) {
    System.out.println(Thread.currentThread().getName() + "String_Node_Str" + "String_Node_Str"+ isAlive()+ "String_Node_Str"+ "String_Node_Str"+ controller._isBranchFirst(getID())+ "String_Node_Str"+ "String_Node_Str"+ receiver._isGetWaiting());
    if (!isAlive()) {
      receiver._setConditionalSend(false,null,-1);
      controller._branchFailed(getID());
      receiver.notifyAll();
      return;
    }
 else     if (controller._isBranchFirst(getID())) {
      if (receiver._isGetWaiting()) {
        receiver._setConditionalSend(false,null,-1);
        receiver.put(getToken());
        controller._branchSucceeded(getID());
        return;
      }
 else {
        controller._releaseFirst(getID());
        receiver.notifyAll();
      }
    }
    getController()._branchBlocked(this.getReceiver());
    getReceiver()._checkFlagsAndWait();
    getController()._branchUnblocked(this.getReceiver());
  }
}
Program: 75507
Project: 75507
Buggy source:
/** 
 * @param controller The conditional branch controller that controlsthis conditional receive.
 * @param receiver The CSPReceiver through which a rendezvous attempt istaking place.
 */
protected boolean _arriveAfterCondRec(CSPReceiver receiver,ConditionalBranchController controller) throws InterruptedException {
  if (controller._isBranchFirst(getID())) {
    ConditionalBranchController side2=receiver._getOtherController();
    if (side2._isBranchFirst(getID())) {
      receiver.put(getToken());
      receiver._setConditionalReceive(false,null);
      controller._branchSucceeded(getID());
      return false;
    }
 else {
      controller._releaseFirst(getID());
      receiver.notifyAll();
    }
  }
  getController()._branchBlocked(this.getReceiver());
  getReceiver()._checkFlagsAndWait();
  getController()._branchUnblocked(this.getReceiver());
  return true;
}

Fixed version (ground truth):
/** 
 * @param controller The conditional branch controller that controlsthis conditional receive.
 * @param receiver The CSPReceiver through which a rendezvous attempt istaking place.
 */
protected boolean _arriveAfterCondRec(CSPReceiver receiver,ConditionalBranchController controller) throws InterruptedException {
  System.out.println(Thread.currentThread().getName() + "String_Node_Str" + "String_Node_Str"+ controller._isBranchFirst(getID())+ "String_Node_Str"+ "String_Node_Str"+ receiver._isGetWaiting()+ "String_Node_Str"+ receiver._getOtherController()._isBranchFirst(receiver.getOtherID()));
  if (controller._isBranchFirst(getID())) {
    ConditionalBranchController side2=receiver._getOtherController();
    if (side2._isBranchFirst(receiver.getOtherID())) {
      receiver.put(getToken());
      receiver._setConditionalReceive(false,null,-1);
      controller._branchSucceeded(getID());
      return false;
    }
 else {
      controller._releaseFirst(getID());
      receiver.notifyAll();
    }
  }
  getController()._branchBlocked(this.getReceiver());
  getReceiver()._checkFlagsAndWait();
  getController()._branchUnblocked(this.getReceiver());
  return true;
}
Program: 75509
Project: 75509
Buggy source:
/** 
 * Evaluate the specified command. If this method returns null, then the associated ShellTextArea will not display a prompt until returnResult() is called.
 * @see ShellTextArea#returnResult(String)
 * @param command The command.
 * @return The return value of the command, or null if there is none.
 * @exception Exception If something goes wrong processing the command.
 */
public String evaluateCommand(String command) throws Exception ;

Fixed version (ground truth):
/** 
 * Evaluate the specified command. If this method returns null, then the associated ShellTextArea will not display a prompt until returnResult() is called. If this method returns an empty string, then the associated ShellTextArea will display the prompt.
 * @see ShellTextArea#returnResult(String)
 * @param command The command.
 * @return The return value of the command, or null if there is none.
 * @exception Exception If something goes wrong processing the command.
 */
public String evaluateCommand(String command) throws Exception ;
Program: 75510
Project: 75510
Buggy source:
private void _evalCommand(){
  String newtext=_jTextArea.getText().substring(_promptCursor);
  _promptCursor+=newtext.length();
  if (_commandBuffer.length() > 0) {
    _commandBuffer.append("String_Node_Str");
  }
  _commandBuffer.append(newtext);
  String command=_commandBuffer.toString();
  if (_interpreter == null) {
    appendJTextArea("String_Node_Str" + mainPrompt);
  }
 else {
    if (_interpreter.isCommandComplete(command)) {
      appendJTextArea("String_Node_Str");
      Cursor oldCursor=_jTextArea.getCursor();
      _jTextArea.setCursor(new Cursor(Cursor.WAIT_CURSOR));
      String result;
      try {
        result=_interpreter.evaluateCommand(command);
      }
 catch (      RuntimeException e) {
        MessageHandler.error("String_Node_Str",e);
        result="String_Node_Str";
        throw e;
      }
catch (      Exception e) {
        result=e.getMessage();
      }
      if (result != null) {
        appendJTextArea(result + "String_Node_Str" + mainPrompt);
      }
 else {
        setEditable(false);
      }
      _commandBuffer.setLength(0);
      _jTextArea.setCursor(oldCursor);
      _updateHistory(command);
    }
 else {
      appendJTextArea("String_Node_Str" + contPrompt);
    }
  }
}

Fixed version (ground truth):
private void _evalCommand(){
  String newtext=_jTextArea.getText().substring(_promptCursor);
  _promptCursor+=newtext.length();
  if (_commandBuffer.length() > 0) {
    _commandBuffer.append("String_Node_Str");
  }
  _commandBuffer.append(newtext);
  String command=_commandBuffer.toString();
  if (_interpreter == null) {
    appendJTextArea("String_Node_Str" + mainPrompt);
  }
 else {
    if (_interpreter.isCommandComplete(command)) {
      appendJTextArea("String_Node_Str");
      Cursor oldCursor=_jTextArea.getCursor();
      _jTextArea.setCursor(new Cursor(Cursor.WAIT_CURSOR));
      String result;
      try {
        result=_interpreter.evaluateCommand(command);
      }
 catch (      RuntimeException e) {
        MessageHandler.error("String_Node_Str",e);
        result="String_Node_Str";
        throw e;
      }
catch (      Exception e) {
        result=e.getMessage();
      }
      if (result != null) {
        if (result.trim().equals("String_Node_Str")) {
          appendJTextArea(mainPrompt);
        }
 else {
          appendJTextArea(result + "String_Node_Str" + mainPrompt);
        }
      }
 else {
        setEditable(false);
      }
      _commandBuffer.setLength(0);
      _jTextArea.setCursor(oldCursor);
      _updateHistory(command);
    }
 else {
      appendJTextArea("String_Node_Str" + contPrompt);
    }
  }
}
Program: 75512
Project: 75512
Buggy source:
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  if (name.equals("String_Node_Str")) {
    return BaseType.DOUBLE;
  }
 else   if (name.equals("String_Node_Str")) {
    return BaseType.INT;
  }
  if (_nameToType.containsKey(name)) {
    return (ptolemy.data.type.Type)_nameToType.get(name);
  }
  Variable result=getScopedVariable(null,_entity,name);
  if (result != null) {
    return result.getType();
  }
 else {
    throw new IllegalActionException("String_Node_Str" + name + "String_Node_Str");
  }
}

Fixed version (ground truth):
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  if (name.equals("String_Node_Str")) {
    return BaseType.DOUBLE;
  }
 else   if (name.equals("String_Node_Str")) {
    return BaseType.INT;
  }
  if (_nameToType.containsKey(name)) {
    return (ptolemy.data.type.Type)_nameToType.get(name);
  }
  Variable result=getScopedVariable(null,_entity,name);
  if (result != null) {
    return result.getType();
  }
 else {
    return null;
  }
}
Program: 75515
Project: 75515
Buggy source:
/** 
 * Override the base class to invalidate the schedule and resolved types of the director of the container, if there is one, in addition to what the base class does.
 * @param relation The relation to link to.
 * @exception IllegalActionException If the link crosses levels ofthe hierarchy, or the port has no container, or the relation is not a ComponentRelation.
 */
public void link(ComponentRelation relation) throws IllegalActionException {
  super.link(relation);
  _invalidate();
}

Fixed version (ground truth):
/** 
 * Override the base class to invalidate the schedule and resolved types of the director of the container, if there is one, in addition to what the base class does.
 * @param relation The relation to link to.
 * @exception IllegalActionException If the link crosses levels ofthe hierarchy, or the port has no container, or the relation is not an instance of IORelation.
 */
public void link(Relation relation) throws IllegalActionException {
  super.link(relation);
  _invalidate();
}