nus-yam/ex-repair huggingface dataset:
Program: 76159
Project: 76159
Buggy source:
/** 
 * Register the branch passed as an argument as having  successfully completed an engagement. If the number of engagements permitted during an iteration of this branch controller is bounded, then increment the number of completed engagements for the branch. If the number of engagements per iteration is unbounded then or this controller is not active, then simply  return.
 * @param branch The Branch with a successful engagement.
 */
public void engagementSucceeded(Branch branch){
synchronized (this) {
    if (!isActive()) {
      return;
    }
    if (_maxEngagements < 0 && _maxEngagers < 0) {
      return;
    }
    if (!_engagements.contains(branch)) {
    }
 else     if (_iterationIsOverCache) {
    }
    if (branch.numberOfCompletedEngagements() < _maxEngagements) {
      branch.completeEngagement();
    }
 else {
    }
    notifyAll();
  }
}

Fixed version (ground truth):
/** 
 * Register the branch passed as an argument as having  successfully completed an engagement. If the number of engagements permitted during an iteration of this branch controller is bounded, then increment the number of completed engagements for the branch. If the number of engagements per iteration is unbounded then or this controller is not active, then simply  return.
 * @param branch The Branch with a successful engagement.
 * @exception TerminateBranchException If this controlleris inactive, its iteration is over or the branch is not currently engaged.
 */
public void engagementSucceeded(Branch branch) throws TerminateBranchException {
synchronized (this) {
    if (!isActive() || _iterationIsOverCache) {
      throw new TerminateBranchException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
    if (_maxEngagements < 0 && _maxEngagers < 0) {
      return;
    }
    if (!_engagements.contains(branch)) {
      throw new TerminateBranchException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
    }
    if (branch.numberOfCompletedEngagements() < _maxEngagements) {
      branch.completeEngagement();
    }
 else {
      throw new TerminateBranchException("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
    }
    notifyAll();
  }
}
Program: 76160
Project: 76160
Buggy source:
/** 
 * Called by ConditionalSend and ConditionalReceive to check if the calling branch is the first branch to be ready to rendezvous. If it is, it sets a private variable to its branch ID so that subsequent calls to this method by other branches know that they are not first.
 * @param branchNumber The ID assigned to the calling branchupon creation.
 * @return True if the calling branch is the first branch to tryto rendezvous, otherwise false.
 */
public boolean isEngagementEnabled(Branch branch){
synchronized (this) {
    if (!_iterationIsOverCache || !isActive()) {
      return false;
    }
    if (_maxEngagements < 0 && _maxEngagers < 0) {
      return true;
    }
    if (_engagements.contains(branch)) {
      if (branch.numberOfCompletedEngagements() < _maxEngagements) {
        return true;
      }
      return false;
    }
 else     if (_engagements.size() < _maxEngagers) {
      _engagements.add(branch);
      return true;
    }
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Called by ConditionalSend and ConditionalReceive to check if the calling branch is the first branch to be ready to rendezvous. If it is, it sets a private variable to its branch ID so that subsequent calls to this method by other branches know that they are not first.
 * @param branchNumber The ID assigned to the calling branchupon creation.
 * @return True if the calling branch is the first branch to tryto rendezvous, otherwise false.
 */
public boolean isEngagementEnabled(Branch branch){
synchronized (this) {
    if (_iterationIsOverCache || !isActive()) {
      return false;
    }
    if (_maxEngagements < 0 && _maxEngagers < 0) {
      branch.beginEngagement();
      return true;
    }
    if (_engagements.contains(branch)) {
      if (branch.numberOfCompletedEngagements() < _maxEngagements) {
        branch.beginEngagement();
        return true;
      }
      return false;
    }
 else     if (_engagements.size() < _maxEngagers) {
      if (branch.numberOfCompletedEngagements() < _maxEngagements) {
        _engagements.add(branch);
        branch.beginEngagement();
        return true;
      }
      return false;
    }
    return false;
  }
}
Program: 76161
Project: 76161
Buggy source:
/** 
 * Return true if this controller is active; return false  otherwise.
 * @return True if this controller is active; false otherwise.
 */
public boolean isActive(){
  return _active;
}

Fixed version (ground truth):
/** 
 * Return true if this controller is active; return false  otherwise.
 * @return True if this controller is active; false otherwise.
 */
public boolean isActive(){
  return _isActive;
}
Program: 76162
Project: 76162
Buggy source:
/** 
 * Release the status of the calling branch as the first branch to be ready to rendezvous. This method is only called when both sides of a communication at a receiver are conditional. In this case, both of the branches have to be the first branches, for their respective actors, for the rendezvous to go ahead. If one branch registers as being first, for its actor, but the other branch cannot, then the status of the first branch needs to be released to allow other branches the possibility of succeeding.
 * @param branchNumber The ID assigned to the branch upon creation.
 */
public void disengageBranch(Branch branch){
synchronized (this) {
    if (_maxEngagements < 0 && _maxEngagers < 0) {
      return;
    }
    if (_engagements.contains(branch)) {
      if (branch.numberOfCompletedEngagements() == 0) {
        _engagements.remove(branch);
      }
    }
 else {
    }
  }
}

Fixed version (ground truth):
/** 
 * Release the status of the calling branch as the first branch to be ready to rendezvous. This method is only called when both sides of a communication at a receiver are conditional. In this case, both of the branches have to be the first branches, for their respective actors, for the rendezvous to go ahead. If one branch registers as being first, for its actor, but the other branch cannot, then the status of the first branch needs to be released to allow other branches the possibility of succeeding.
 * @param branchNumber The ID assigned to the branch upon creation.
 */
public void disengageBranch(Branch branch){
synchronized (this) {
    if (_maxEngagements < 0 && _maxEngagers < 0) {
      return;
    }
    if (_engagements.contains(branch)) {
      if (branch.numberOfCompletedEngagements() == 0) {
        _engagements.remove(branch);
      }
    }
  }
}
Program: 76163
Project: 76163
Buggy source:
/** 
 */
public void setActive(boolean active){
  _active=active;
}

Fixed version (ground truth):
/** 
 */
public void setActive(boolean active){
  _isActive=active;
}
Program: 76164
Project: 76164
Buggy source:
/** 
 * Construct a DoubleMatrixToken with the specified 2-D array. If copy is DO_COPY, make a copy of the array and store the copy, so that changes on the specified array after this token is constructed will not affect the content of this token. If copy is DO_NOT_COPY, just reference the array (do not copy its contents). This saves some time and memory. The argument array should NOT be modified after this constructor  is called to preserve immutability.          
 * @exception NullPointerException If the specified arrayis null.
 */
protected ComplexMatrixToken(final Complex[][] value,int copy){
  _rowCount=value.length;
  _columnCount=value[0].length;
  if (copy == DO_NOT_COPY) {
    _value=value;
  }
 else {
    _value=new Complex[_rowCount][_columnCount];
    for (int i=0; i < _rowCount; i++) {
      System.arraycopy(value[i],0,_value,0,_columnCount);
    }
  }
}

Fixed version (ground truth):
/** 
 * Construct a DoubleMatrixToken with the specified 2-D array. If copy is DO_COPY, make a copy of the array and store the copy, so that changes on the specified array after this token is constructed will not affect the content of this token. If copy is DO_NOT_COPY, just reference the array (do not copy its contents). This saves some time and memory. The argument array should NOT be modified after this constructor  is called to preserve immutability.          
 * @exception NullPointerException If the specified arrayis null.
 */
protected ComplexMatrixToken(final Complex[][] value,int copy){
  _rowCount=value.length;
  _columnCount=value[0].length;
  if (copy == DO_NOT_COPY) {
    _value=value;
  }
 else {
    _value=ComplexMatrixMath.allocCopy(value);
  }
}
Program: 76165
Project: 76165
Buggy source:
/** 
 * Increase the count of branches that are blocked trying to rendezvous. If all the enabled branches (for the CIF or CDO currently being executed) are blocked, register this actor as being blocked.
 */
protected void _branchBlocked(ProcessReceiver rcvr){
synchronized (_internalLock) {
    if (rcvr.isReadBlocked()) {
      if (rcvr.isConnectedToBoundary()) {
        _extReadBranchesBlocked++;
      }
      _intReadBranchesBlocked++;
    }
    if (rcvr.isWriteBlocked()) {
      _writeBranchesBlocked++;
    }
    registerBlock();
  }
}

Fixed version (ground truth):
/** 
 * Increase the count of branches that are blocked trying to rendezvous. If all the enabled branches (for the CIF or CDO currently being executed) are blocked, register this actor as being blocked.
 */
protected void _branchBlocked(CSPReceiver rcvr){
synchronized (_internalLock) {
    _branchesBlocked++;
    if (_branchesBlocked == _branchesStarted) {
      _getDirector()._actorBlocked(rcvr);
      _blocked=true;
    }
  }
}
Program: 76167
Project: 76167
Buggy source:
/** 
 * Decrease the count of branches that are read blocked. If the actor was previously registered as being blocked,  register this actor with the director as no longer being  blocked.
 */
protected void _branchUnblocked(ProcessReceiver rcvr){
synchronized (_internalLock) {
    if (_blocked) {
      if (_intReadBranchesBlocked + _extReadBranchesBlocked + _writeBranchesBlocked != _branchesStarted) {
        throw new InternalErrorException(((Nameable)getParent()).getName() + "String_Node_Str" + "String_Node_Str");
      }
      _getDirector()._actorUnBlocked(new CSPReceiver());
      _blocked=false;
    }
    if (rcvr.isReadBlocked()) {
      if (rcvr.isConnectedToBoundary()) {
        _extReadBranchesBlocked--;
      }
      _intReadBranchesBlocked--;
    }
    if (rcvr.isWriteBlocked()) {
      _writeBranchesBlocked--;
    }
  }
}

Fixed version (ground truth):
/** 
 * Decrease the count of branches that are read blocked. If the actor was previously registered as being blocked,  register this actor with the director as no longer being  blocked.
 */
protected void _branchUnblocked(CSPReceiver rcvr){
synchronized (_internalLock) {
    if (_blocked) {
      if (_branchesBlocked != _branchesStarted) {
        throw new InternalErrorException(((Nameable)getParent()).getName() + "String_Node_Str" + "String_Node_Str");
      }
      _getDirector()._actorUnBlocked(rcvr);
      _blocked=false;
    }
  }
}
Program: 76168
Project: 76168
Buggy source:
private void _resetConditionalState(){
synchronized (_internalLock) {
    _blocked=false;
    _branchesActive=0;
    _intReadBranchesBlocked=0;
    _extReadBranchesBlocked=0;
    _writeBranchesBlocked=0;
    _branchesStarted=0;
    _branchTrying=-1;
    _successfulBranch=-1;
    _threadList=null;
  }
}

Fixed version (ground truth):
private void _resetConditionalState(){
synchronized (_internalLock) {
    _blocked=false;
    _branchesActive=0;
    _branchesBlocked=0;
    _branchesStarted=0;
    _branchTrying=-1;
    _successfulBranch=-1;
    _threadList=null;
  }
}
Program: 76170
Project: 76170
Buggy source:
/** 
 */
public void run(){
synchronized (this) {
    try {
      activateBranches();
      while (isActive()) {
        while (!isIterationOver()) {
          wait();
          if (isDeadlocked() && !isIterationOver()) {
            while (isDeadlocked() && !isIterationOver()) {
              _getDirector()._branchBlocked(this);
              wait();
            }
            _getDirector()._branchUnBlocked(this);
          }
        }
        if (isIterationOver() && isActive()) {
          while (isIterationOver() && isActive()) {
            _getDirector()._branchBlocked(this);
            wait();
          }
          _getDirector()._branchUnBlocked(this);
        }
      }
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
/** 
 */
public void run(){
synchronized (this) {
    try {
      activateBranches();
      while (isActive()) {
        while (!isIterationOver()) {
          wait();
          if (isDeadlocked() && !isIterationOver()) {
            while (isDeadlocked() && !isIterationOver()) {
              _getDirector()._branchCntlrBlocked();
              wait();
            }
            _getDirector()._branchCntlrUnBlocked();
          }
        }
        if (isIterationOver() && isActive()) {
          while (isIterationOver() && isActive()) {
            _getDirector()._branchCntlrBlocked();
            wait();
          }
          _getDirector()._branchCntlrUnBlocked();
        }
      }
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 76171
Project: 76171
Buggy source:
/** 
 * Return a new String representing the array, formatted as specified by the ArrayStringFormat argument. To get a String in the Ptolemy expression language format, call this method with ArrayStringFormat.exprASFormat as the format argument.
 */
public static final String toString(final Complex[] array,ArrayStringFormat format){
}

Fixed version (ground truth):
/** 
 * Return a new String representing the array, formatted as specified by the ArrayStringFormat argument. To get a String in the Ptolemy expression language format, call this method with ArrayStringFormat.exprASFormat as the format argument.
 */
public static final String toString(final Complex[] array,ArrayStringFormat format){
  int length=array.length;
  StringBuffer sb=new StringBuffer();
  sb.append(format.vectorBeginString());
  for (int i=0; i < length; i++) {
    sb.append(format.complexString(array[i]));
    if (i < (length - 1)) {
      sb.append(format.elementDelimiterString());
    }
  }
  sb.append(format.vectorEndString());
  return sb.toString();
}
Program: 76172
Project: 76172
Buggy source:
/** 
 * Return a new String representing the matrix, formatted as specified by the ArrayStringFormat argument. To get a String in the Ptolemy expression language format, call this method with ArrayStringFormat.exprASFormat as the format argument.
 */
public static final String toString(final Complex[][] matrix,final ArrayStringFormat asf){
  StringBuffer sb=new StringBuffer();
  sb.append(asf.matrixBeginString());
  for (int i=0; i < _rows(matrix); i++) {
    sb.append(asf.vectorBeginString());
    for (int j=0; j < _columns(matrix); j++) {
      sb.append(asf.complexString(matrix[i][j]));
      if (j < (_columns(matrix) - 1)) {
        sb.append(asf.elementDelimiterString());
      }
    }
    sb.append(asf.vectorEndString());
    if (i < (_rows(matrix) - 1)) {
      sb.append(asf.vectorDelimiterString());
    }
  }
  sb.append(asf.matrixEndString());
  return new String(sb);
}

Fixed version (ground truth):
/** 
 * Return a new String representing the matrix, formatted as specified by the ArrayStringFormat argument. To get a String in the Ptolemy expression language format, call this method with ArrayStringFormat.exprASFormat as the format argument.
 */
public static final String toString(final Complex[][] matrix,final ArrayStringFormat asf){
  StringBuffer sb=new StringBuffer();
  sb.append(asf.matrixBeginString());
  for (int i=0; i < _rows(matrix); i++) {
    sb.append(asf.vectorBeginString());
    for (int j=0; j < _columns(matrix); j++) {
      sb.append(asf.complexString(matrix[i][j]));
      if (j < (_columns(matrix) - 1)) {
        sb.append(asf.elementDelimiterString());
      }
    }
    sb.append(asf.vectorEndString());
    if (i < (_rows(matrix) - 1)) {
      sb.append(asf.vectorDelimiterString());
    }
  }
  sb.append(asf.matrixEndString());
  return sb.toString();
}
Program: 76173
Project: 76173
Buggy source:
/** 
 * Read the value of the <i>value</i> parameter and output <i>rate</i> many tokens with that value.
 * @exception IllegalActionException If it is thrown by thesend() method sending out the token.
 */
public void fire() throws IllegalActionException {
  super.fire();
  DoubleToken[] resultTokenArray=new DoubleToken[_rate];
  double valueDouble=((DoubleToken)value.getToken()).doubleValue();
  for (int i=0; i < _rate; i++) {
    resultTokenArray[i]=new DoubleToken(valueDouble);
  }
  output.sendArray(0,resultTokenArray);
}

Fixed version (ground truth):
/** 
 * Read the value of the <i>value</i> parameter and output <i>rate</i> many tokens with that value.
 * @exception IllegalActionException If it is thrown by thesend() method sending out the token.
 */
public void fire() throws IllegalActionException {
  super.fire();
  Token[] resultTokenArray=new Token[_rate];
  for (int i=0; i < _rate; i++) {
    resultTokenArray[i]=value.getToken();
  }
  output.sendArray(0,resultTokenArray);
}
Program: 76174
Project: 76174
Buggy source:
/** 
 * Construct a constant source with the given container and name. Create the <i>value</i> parameter, initialize its value to the default value of an DoubleToken with value 1.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public SDFConst(TypedCompositeActor container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  value=new Parameter(this,"String_Node_Str",new DoubleToken(1));
  output.setTypeEquals(BaseType.DOUBLE);
  ;
}

Fixed version (ground truth):
/** 
 * Construct a constant source with the given container and name. Create the <i>value</i> parameter, initialize its value to the default value of an IntToken with value 1.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the entity cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public SDFConst(TypedCompositeActor container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  value=new Parameter(this,"String_Node_Str",new IntToken(1));
  output.setTypeAtLeast(value);
}
Program: 76176
Project: 76176
Buggy source:
public MethodSignature(String name,int dummy){
  Character firstLetter=new Character(Character.toUpperCase(name.charAt(0)));
  String partName=firstLetter.toString() + name.substring(1);
  _name="String_Node_Str" + partName;
  _returnType="String_Node_Str";
  _methodBody="String_Node_Str";
}

Fixed version (ground truth):
/** 
 * A hasX() method that returns true. 
 */
public MethodSignature(String name,int dummy){
  _modifiers="String_Node_Str";
  Character firstLetter=new Character(Character.toUpperCase(name.charAt(0)));
  String partName=firstLetter.toString() + name.substring(1);
  _name="String_Node_Str" + partName;
  _returnType="String_Node_Str";
  _methodBody="String_Node_Str";
}
Program: 76178
Project: 76178
Buggy source:
public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append(ident);
  sb.append(_modifiers);
  sb.append(' ');
  sb.append(_type);
  sb.append(' ');
  if (!_modifiers.startsWith("String_Node_Str")) {
    sb.append("String_Node_Str");
  }
  sb.append(_name);
  if (_init != null) {
    sb.append("String_Node_Str");
    sb.append(_init);
  }
  sb.append(';');
  return sb.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append(ident);
  sb.append(_modifiers);
  sb.append(' ');
  sb.append(_type);
  sb.append(' ');
  if (!_modifiers.startsWith("String_Node_Str")) {
    sb.append("String_Node_Str");
  }
  sb.append(_name);
  if (_init != null) {
    sb.append("String_Node_Str" + _init);
  }
  sb.append(';');
  return sb.toString();
}
Program: 76179
Project: 76179
Buggy source:
protected String _readBlock(String marker) throws IOException {
  while ((_lastLine != null) && _lastLine.equals("String_Node_Str")) {
    _lastLine=_ifs.readLine();
  }
  String beginTag="String_Node_Str" + marker + "String_Node_Str";
  String endTag="String_Node_Str" + marker + "String_Node_Str";
  if ((_lastLine == null) || !_lastLine.equals(beginTag)) {
    return "String_Node_Str";
  }
  StringBuffer sb=new StringBuffer();
  boolean endHeader=false;
  do {
    _lastLine=_ifs.readLine();
    endHeader=((_lastLine == null) || _lastLine.equals(endTag));
    if (!endHeader) {
      sb.append(_lastLine);
      sb.append('\n');
    }
  }
 while (!endHeader);
  _lastLine=_ifs.readLine();
  sb.append('\n');
  return sb.toString();
}

Fixed version (ground truth):
protected String _readBlock(String marker) throws IOException {
  while ((_lastLine != null) && _lastLine.equals("String_Node_Str")) {
    _lastLine=_ifs.readLine();
  }
  String beginTag="String_Node_Str" + marker + "String_Node_Str";
  String endTag="String_Node_Str" + marker + "String_Node_Str";
  if ((_lastLine == null) || !_lastLine.equals(beginTag)) {
    return "String_Node_Str";
  }
  StringBuffer sb=new StringBuffer();
  boolean endHeader=false;
  do {
    _lastLine=_ifs.readLine();
    endHeader=((_lastLine == null) || _lastLine.equals(endTag));
    if (!endHeader) {
      sb.append(_lastLine + "String_Node_Str");
    }
  }
 while (!endHeader);
  _lastLine=_ifs.readLine();
  sb.append('\n');
  return sb.toString();
}
Program: 76181
Project: 76181
Buggy source:
/** 
 * Define a property. Return false if the property is already defined. 
 */
public boolean defineProperty(Object property){
  Object obj=setProperty(property,NullValue.instance);
  return (obj == null);
}

Fixed version (ground truth):
/** 
 * Define a property. Return false if the property is already defined. 
 */
public boolean defineProperty(Integer property){
  Object obj=setProperty(property,NullValue.instance);
  return (obj == null);
}
Program: 76182
Project: 76182
Buggy source:
/** 
 * Get a property. Throw a RuntimeException if the property in not defined. 
 */
public Object getDefinedProperty(Object property){
  Object retval=_propertyMap.get(property);
  if (retval == null) {
    throw new RuntimeException("String_Node_Str" + property + "String_Node_Str");
  }
  return retval;
}

Fixed version (ground truth):
/** 
 * Get a property. Throw a RuntimeException if the property in not defined. 
 */
public Object getDefinedProperty(Integer property){
  Object retval=_propertyMap.get(property);
  if (retval == null) {
    throw new RuntimeException("String_Node_Str" + property + "String_Node_Str");
  }
  return retval;
}
Program: 76183
Project: 76183
Buggy source:
/** 
 * Get a property. If the property is not defined, returned null. 
 */
public Object getProperty(Object property){
  return _propertyMap.get(property);
}

Fixed version (ground truth):
/** 
 * Get a property. If the property is not defined, returned null. 
 */
public Object getProperty(Integer property){
  return _propertyMap.get(property);
}
Program: 76184
Project: 76184
Buggy source:
/** 
 * Set a property. The property may or may not have been defined already. 
 */
public Object setProperty(Object property,Object obj){
  if (obj == null) {
    obj=NullValue.instance;
  }
  return _propertyMap.put(property,obj);
}

Fixed version (ground truth):
/** 
 * Set a property. The property may or may not have been defined already. 
 */
public Object setProperty(Integer property,Object obj){
  if (obj == null) {
    obj=NullValue.instance;
  }
  return _propertyMap.put(property,obj);
}
Program: 76185
Project: 76185
Buggy source:
/** 
 * Set a property. Throw a RuntimeException if the property in not defined. 
 */
public Object setDefinedProperty(Object property,Object obj){
  if (obj == null) {
    obj=NullValue.instance;
  }
  Object retval=_propertyMap.put(property,obj);
  if (retval == null) {
    throw new RuntimeException("String_Node_Str" + property + "String_Node_Str");
  }
  return retval;
}

Fixed version (ground truth):
/** 
 * Set a property. Throw a RuntimeException if the property in not defined. 
 */
public Object setDefinedProperty(Integer property,Object obj){
  if (obj == null) {
    obj=NullValue.instance;
  }
  Object retval=_propertyMap.put(property,obj);
  if (retval == null) {
    throw new RuntimeException("String_Node_Str" + property + "String_Node_Str");
  }
  return retval;
}
Program: 76186
Project: 76186
Buggy source:
/** 
 * Remove a property, returning the value of the property if the property is defined. If the property is not defined, return null.
 */
public Object removeProperty(Object property){
  return _propertyMap.remove(property);
}

Fixed version (ground truth):
/** 
 * Remove a property, returning the value of the property if the property is defined. If the property is not defined, return null.
 */
public Object removeProperty(Integer property){
  return _propertyMap.remove(property);
}
Program: 76187
Project: 76187
Buggy source:
/** 
 * Return true iff this instance has the specified property. 
 */
public boolean hasProperty(Object property){
  return _propertyMap.containsKey(property);
}

Fixed version (ground truth):
/** 
 * Return true iff this instance has the specified property. 
 */
public boolean hasProperty(Integer property){
  return _propertyMap.containsKey(property);
}
Program: 76188
Project: 76188
Buggy source:
public static final LinkedList traverseList(IVisitor v,TreeNode parent,LinkedList args,List childList){
  boolean anyNonNullRetval=false;
  Object retval;
  LinkedList retList=new LinkedList();
  Iterator itr=childList.listIterator();
  while (itr.hasNext()) {
    Object obj=itr.next();
    if (obj instanceof TreeNode) {
      TreeNode node=(TreeNode)obj;
      retval=node.accept(v,args);
      if (retval == null) {
        retList.addLast(NullValue.instance);
      }
 else {
        retList.addLast(retval);
      }
    }
 else     if (obj instanceof List) {
      retval=(Object)traverseList(v,null,args,(List)obj);
      retList.addLast(retval);
    }
 else {
      throw new RuntimeException("String_Node_Str" + obj.getClass());
    }
  }
  return retList;
}

Fixed version (ground truth):
public static final LinkedList traverseList(IVisitor v,TreeNode parent,LinkedList args,List childList){
  Object retval;
  LinkedList retList=new LinkedList();
  Iterator itr=childList.listIterator();
  while (itr.hasNext()) {
    Object obj=itr.next();
    if (obj instanceof TreeNode) {
      TreeNode node=(TreeNode)obj;
      retval=node.accept(v,args);
      if (retval == null) {
        retList.addLast(NullValue.instance);
      }
 else {
        retList.addLast(retval);
      }
    }
 else     if (obj instanceof List) {
      retval=(Object)traverseList(v,null,args,(List)obj);
      retList.addLast(retval);
    }
 else {
      throw new RuntimeException("String_Node_Str" + obj.getClass());
    }
  }
  return retList;
}
Program: 76189
Project: 76189
Buggy source:
public Object childReturnValueAt(int index){
  LinkedList retList=(LinkedList)getDefinedProperty("String_Node_Str");
  return retList.get(index);
}

Fixed version (ground truth):
public Object childReturnValueAt(int index){
  LinkedList retList=(LinkedList)getDefinedProperty(CHILD_RETURN_VALUES_KEY);
  return retList.get(index);
}
Program: 76190
Project: 76190
Buggy source:
public Object accept(IVisitor v,LinkedList visitorArgs){
  Object retval;
switch (v.traversalMethod()) {
case IVisitor.TM_CHILDREN_FIRST:
{
      traverseChildren(v,visitorArgs);
      retval=acceptHere(v,visitorArgs);
      removeProperty("String_Node_Str");
    }
  break;
case IVisitor.TM_SELF_FIRST:
{
  retval=acceptHere(v,visitorArgs);
  traverseChildren(v,visitorArgs);
}
break;
case IVisitor.TM_CUSTOM:
{
retval=acceptHere(v,visitorArgs);
}
break;
default :
{
throw new RuntimeException("String_Node_Str");
}
}
return retval;
}

Fixed version (ground truth):
public Object accept(IVisitor v,LinkedList visitorArgs){
  Object retval;
switch (v.traversalMethod()) {
case IVisitor.TM_CHILDREN_FIRST:
{
      traverseChildren(v,visitorArgs);
      retval=acceptHere(v,visitorArgs);
      removeProperty(CHILD_RETURN_VALUES_KEY);
    }
  break;
case IVisitor.TM_SELF_FIRST:
{
  retval=acceptHere(v,visitorArgs);
  traverseChildren(v,visitorArgs);
}
break;
case IVisitor.TM_CUSTOM:
{
retval=acceptHere(v,visitorArgs);
}
break;
default :
throw new RuntimeException("String_Node_Str");
}
return retval;
}
Program: 76191
Project: 76191
Buggy source:
public Object childReturnValueFor(Object child){
  ListIterator itr=_childList.listIterator();
  int index=0;
  while (itr.hasNext()) {
    if (child == itr.next()) {
      return childReturnValueAt(index);
    }
    index++;
  }
  ApplicationUtility.error("String_Node_Str");
  return null;
}

Fixed version (ground truth):
public Object childReturnValueFor(Object child){
  Iterator itr=_childList.iterator();
  int index=0;
  while (itr.hasNext()) {
    if (child == itr.next()) {
      return childReturnValueAt(index);
    }
    index++;
  }
  ApplicationUtility.error("String_Node_Str");
  return null;
}
Program: 76192
Project: 76192
Buggy source:
public void traverseChildren(IVisitor v,LinkedList args){
  LinkedList retList=TNLManip.traverseList(v,this,args,_childList);
  setProperty("String_Node_Str",retList);
}

Fixed version (ground truth):
public void traverseChildren(IVisitor v,LinkedList args){
  LinkedList retList=TNLManip.traverseList(v,this,args,_childList);
  setProperty(CHILD_RETURN_VALUES_KEY,retList);
}
Program: 76193
Project: 76193
Buggy source:
/** 
 * Construct a scheduler in the given workspace with the name "Scheduler". If the workspace argument is null, use the default workspace. The scheduler is added to the list of objects in the workspace. Increment the version number of the workspace.
 * @param workspace Object for synchronization and version tracking.
 */
public Scheduler(Workspace ws){
  super(ws);
  try {
    setName(_DEFAULT_SCHEDULER_NAME);
  }
 catch (  KernelException ex) {
    throw new InternalErrorException(ex.toString());
  }
}

Fixed version (ground truth):
/** 
 * Construct a scheduler in the given workspace with the name "Scheduler". If the workspace argument is null, use the default workspace. The scheduler is added to the list of objects in the workspace. Increment the version number of the workspace.
 * @param workspace Object for synchronization and version tracking.
 */
public Scheduler(Workspace workspace){
  super(workspace);
  try {
    setName(_DEFAULT_SCHEDULER_NAME);
  }
 catch (  KernelException ex) {
    throw new InternalErrorException(ex.toString());
  }
}
Program: 76194
Project: 76194
Buggy source:
/** 
 * Clone the scheduler into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is a new scheduler with no container, and no valid schedule.
 * @param ws The workspace for the cloned object.
 * @exception CloneNotSupportedException If one of the attributescannot be cloned.
 * @return The new Scheduler.
 */
public Object clone(Workspace ws) throws CloneNotSupportedException {
  Scheduler newobj=(Scheduler)super.clone(ws);
  newobj._container=null;
  newobj._valid=false;
  newobj._cachedSchedule=null;
  return newobj;
}

Fixed version (ground truth):
/** 
 * Clone the scheduler into the specified workspace. The new object is <i>not</i> added to the directory of that workspace (you must do this yourself if you want it there). The result is a new scheduler with no container, and no valid schedule.
 * @param workspace The workspace for the cloned object.
 * @exception CloneNotSupportedException If one of the attributescannot be cloned.
 * @return The new Scheduler.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Scheduler newobj=(Scheduler)super.clone(workspace);
  newobj._container=null;
  newobj._valid=false;
  newobj._cachedSchedule=null;
  return newobj;
}
Program: 76195
Project: 76195
Buggy source:
/** 
 * Notify this query that the value of the specified variable has changed.  This is called by an attached parameter when its value changes.
 * @param variable The variable that has changed.
 */
public void valueChanged(Variable variable){
  if (_listening) {
    set(variable.getName(),variable.stringRepresentation());
  }
}

Fixed version (ground truth):
/** 
 * Notify this query that the value of the specified variable has changed.  This is called by an attached parameter when its value changes. Note that more than one entry may be attached to the same variable. In this case, all such entries will be notified.
 * @param variable The variable that has changed.
 */
public void valueChanged(Variable variable){
  if (_parameters.containsValue(variable)) {
    List entryNameList=(List)_varToListOfEntries.get(variable);
    Iterator entryNames=entryNameList.iterator();
    while (entryNames.hasNext()) {
      String name=(String)entryNames.next();
      Map ignoreVarChangePart2=(Map)_ignoreVarChangePart1.get(variable);
      if (((Boolean)ignoreVarChangePart2.get(name)).booleanValue() == false) {
        set(name,variable.stringRepresentation());
        _ignoreEntryChange.put(name,new Boolean(true));
      }
 else {
        ignoreVarChangePart2.put(name,new Boolean(false));
      }
    }
  }
 else {
    System.out.println("String_Node_Str" + "String_Node_Str" + variable.getFullName());
  }
}
Program: 76196
Project: 76196
Buggy source:
/** 
 * Construct a panel with no queries in it.
 */
public PtolemyQuery(){
  super();
  this.addQueryListener(this);
  _parameters=new HashMap();
}

Fixed version (ground truth):
/** 
 * Construct a panel with no queries in it. When an entry changes, a change request is queued with the director. The director will then schedule the corresponding variable's value to be updated at an appropriate time in  the execution of the model. Note that only one PtolemyQuerey object is allowed per director. 
 * @param director The director for a model. This shouldbe the director associated with all variables that are attached to query entries.
 */
public PtolemyQuery(Director director){
  super();
  _constructorDirector=true;
  this.addQueryListener(this);
  _parameters=new HashMap();
  this._director=director;
  _ignoreValueChanged=0;
  _ignoreChanged=0;
  _varToListOfEntries=new HashMap();
  _ignoreEntryChange=new HashMap();
  _ignoreVarChangePart1=new HashMap();
}
Program: 76197
Project: 76197
Buggy source:
/** 
 * Attach a variable <i>var</i> to an entry, <i>entryName</i>, of a Query. After attaching the <i>var</i> to the entry, automatically set <i>var</i> when <i>entryName</i> changes. If <i>var</i> has previously been attached to an entry, then the old value is replaced with <i>entryName</i>.
 * @param var The variable to attach to an entry.
 * @param entryName The entry to attach the variable to.
 */
public void attachParameter(Variable var,String entryName){
  _parameters.put(entryName,var);
  var.addValueListener(this);
  String tip=Documentation.consolidate(var);
  if (tip != null) {
    setToolTip(entryName,tip);
  }
}

Fixed version (ground truth):
/** 
 * Attach a variable <i>var</i> to an entry, <i>entryName</i>, of a Query. After attaching the <i>var</i> to the entry, automatically set <i>var</i> when <i>entryName</i> changes. If <i>var</i> has previously been attached to an entry, then the old value is replaced with <i>entryName</i>.
 * @param var The variable to attach to an entry.
 * @param entryName The entry to attach the variable to.
 */
public void attachParameter(Variable var,String entryName){
  _parameters.put(entryName,var);
  var.addValueListener(this);
  String tip=Documentation.consolidate(var);
  if (tip != null) {
    setToolTip(entryName,tip);
  }
  if (_varToListOfEntries.get(var) == null) {
    List entryNameList=new LinkedList();
    entryNameList.add(entryName);
    _varToListOfEntries.put(var,entryNameList);
  }
 else {
    List entryNameList=(List)_varToListOfEntries.get(var);
    Iterator entryNames=entryNameList.iterator();
    boolean found=false;
    while (entryNames.hasNext()) {
      String name=(String)entryNames.next();
      if (name == entryName) {
        found=true;
      }
    }
    if (found == false) {
      entryNameList.add(entryName);
    }
  }
  if (_ignoreEntryChange.containsKey(entryName) == false) {
    _ignoreEntryChange.put(entryName,new Boolean(false));
  }
  if (_ignoreVarChangePart1.containsKey(var) == false) {
    Map ignoreVarChangePart2=new HashMap();
    ignoreVarChangePart2.put(entryName,new Boolean(false));
    _ignoreVarChangePart1.put(var,ignoreVarChangePart2);
  }
 else {
    Map ignoreVarChangePart2=(Map)_ignoreVarChangePart1.get(var);
    if (ignoreVarChangePart2.containsKey(entryName) == false) {
      ignoreVarChangePart2.put(entryName,new Boolean(false));
      ;
    }
  }
}
Program: 76198
Project: 76198
Buggy source:
/** 
 * Set the Variable to the value of the Query entry. This method is called whenever an entry changes.
 * @param name The entry that has changed.
 */
public void changed(String name){
  if (_parameters.containsKey(name)) {
    Variable var=(Variable)(_parameters.get(name));
    _listening=false;
    var.setExpression(stringValue(name));
    try {
      var.getToken();
    }
 catch (    IllegalActionException ex) {
    }
    _listening=true;
  }
}

Fixed version (ground truth):
/** 
 * Set the variable to the value of the Query entry. This method is called whenever an entry changes.
 * @param name The name of the entry that has changed.
 */
public void changed(String name){
  if (_parameters.containsKey(name)) {
    Variable var=(Variable)(_parameters.get(name));
    if (((Boolean)_ignoreEntryChange.get(name)).booleanValue() == false) {
      _ignoreValueChanged=_ignoreValueChanged + 1;
      if (_constructorDirector == false) {
        _director=((Actor)var.getContainer()).getDirector();
      }
      if (_director == null) {
        System.out.println("String_Node_Str" + "String_Node_Str" + var.getFullName());
      }
      _director.requestChange(new SetParameter((Parameter)var,(Parameter)var,stringValue(name)));
    }
 else {
      _ignoreEntryChange.put(name,new Boolean(false));
    }
  }
}
Program: 76199
Project: 76199
Buggy source:
/** 
 * Output the sample value of the sound file corresponding to the current index.
 */
public void fire() throws IllegalActionException {
}

Fixed version (ground truth):
/** 
 * Output the sample value of the sound file corresponding to the current index.
 */
public void fire() throws IllegalActionException {
  input.getArray(0,audioTokenArray);
  int i;
  for (i=0; i < consumptionRate; i++) {
    audioInDoubleArray[i]=audioTokenArray[i].doubleValue();
  }
  double[] currPitchArray=pd.performPitchDetect(audioInDoubleArray);
  for (i=0; i < productionRate; i++) {
    audioTokenArray[i]=new DoubleToken(currPitchArray[i]);
  }
  output.sendArray(0,audioTokenArray);
}
Program: 76200
Project: 76200
Buggy source:
/** 
 * Construct an actor with the given container and name. In addition to invoking the base class constructors, construct the parameters and initialize them to their default vaules.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public AudioSource(TypedCompositeActor container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output=new SDFIOPort(this,"String_Node_Str",false,true);
  output.setTypeEquals(BaseType.DOUBLE);
  output.setMultiport(true);
  pathName=new Parameter(this,"String_Node_Str",new StringToken("String_Node_Str"));
  source=new Parameter(this,"String_Node_Str",new StringToken("String_Node_Str"));
  source.setTypeEquals(BaseType.STRING);
  sampleRate=new Parameter(this,"String_Node_Str",new IntToken(44100));
  sampleRate.setTypeEquals(BaseType.INT);
  sampleSizeInBits=new Parameter(this,"String_Node_Str",new IntToken(16));
  sampleSizeInBits.setTypeEquals(BaseType.INT);
  channels=new Parameter(this,"String_Node_Str",new IntToken(1));
  channels.setTypeEquals(BaseType.INT);
  bufferSize=new Parameter(this,"String_Node_Str",new IntToken(4096));
  bufferSize.setTypeEquals(BaseType.INT);
  tokenProductionRate=new Parameter(this,"String_Node_Str",new IntToken(256));
}

Fixed version (ground truth):
/** 
 * Construct an actor with the given container and name. In addition to invoking the base class constructors, construct the parameters and initialize them to their default values.
 * @param container The container.
 * @param name The name of this actor.
 * @exception IllegalActionException If the actor cannot be containedby the proposed container.
 * @exception NameDuplicationException If the container already has anactor with this name.
 */
public AudioSource(TypedCompositeActor container,String name) throws NameDuplicationException, IllegalActionException {
  super(container,name);
  output=new SDFIOPort(this,"String_Node_Str",false,true);
  output.setTypeEquals(BaseType.DOUBLE);
  output.setMultiport(true);
  pathName=new Parameter(this,"String_Node_Str",new StringToken("String_Node_Str"));
  source=new Parameter(this,"String_Node_Str",new StringToken("String_Node_Str"));
  source.setTypeEquals(BaseType.STRING);
  sampleRate=new Parameter(this,"String_Node_Str",new IntToken(44100));
  sampleRate.setTypeEquals(BaseType.INT);
  sampleSizeInBits=new Parameter(this,"String_Node_Str",new IntToken(16));
  sampleSizeInBits.setTypeEquals(BaseType.INT);
  channels=new Parameter(this,"String_Node_Str",new IntToken(1));
  channels.setTypeEquals(BaseType.INT);
  bufferSize=new Parameter(this,"String_Node_Str",new IntToken(4096));
  bufferSize.setTypeEquals(BaseType.INT);
  tokenProductionRate=new Parameter(this,"String_Node_Str",new IntToken(256));
}
Program: 76202
Project: 76202
Buggy source:
/** 
 * Construct a NoTokenException originating from the given object, with the given error message.
 * @param obj The originating object.
 * @param message The message.
 */
public NoTokenException(Nameable obj,String detail){
  String name;
  if (obj == null) {
    name=new String("String_Node_Str");
    ;
  }
 else {
    try {
      name=obj.getFullName();
    }
 catch (    InvalidStateException ex) {
      name=obj.getName();
    }
  }
  _setMessage(name + "String_Node_Str" + detail);
}

Fixed version (ground truth):
/** 
 * Construct a NoTokenException originating from the given object, with the given error message.
 * @param obj The originating object.
 * @param message The message.
 */
public NoTokenException(Nameable obj,String message){
  String name;
  if (obj == null) {
    name=new String("String_Node_Str");
    ;
  }
 else {
    try {
      name=obj.getFullName();
    }
 catch (    InvalidStateException ex) {
      name=obj.getName();
    }
  }
  _setMessage(name + "String_Node_Str" + message);
}
Program: 76203
Project: 76203
Buggy source:
/** 
 * Remove a change listener. If the specified listener is not on the list, do nothing.
 * @param listener The listener to remove.
 */
public void removeChangeListener(ChangeListener change){
  if (_changeListeners == null) {
    return;
  }
  _changeListeners.remove(change);
}

Fixed version (ground truth):
/** 
 * Remove a change listener. If the specified listener is not on the list, do nothing.
 * @param listener The listener to remove.
 */
public void removeChangeListener(ChangeListener listener){
  if (_changeListeners == null) {
    return;
  }
  _changeListeners.remove(listener);
}
Program: 76204
Project: 76204
Buggy source:
/** 
 * Set the state of execution and notify listeners if the state actually changes.
 * @param newstate The new state.
 */
protected void _setState(State newstate){
  if (_state != newstate) {
    _state=newstate;
    _notifyListenersOfStateChange();
  }
}

Fixed version (ground truth):
/** 
 * Set the state of execution and notify listeners if the state actually changes.
 * @param newState The new state.
 */
protected void _setState(State newState){
  if (_state != newState) {
    _state=newState;
    _notifyListenersOfStateChange();
  }
}
Program: 76205
Project: 76205
Buggy source:
/** 
 * Construct an IOPort with a container and a name that is either an input, an output, or both, depending on the third and fourth arguments. The specified container must implement the Actor interface or an exception will be thrown.
 * @param container The container actor.
 * @param name The name of the port.
 * @param isinput True if this is to be an input port.
 * @param isoutput True if this is to be an output port.
 * @exception IllegalActionException If the port is not of an acceptableclass for the container, or if the container does not implement the Actor interface.
 * @exception NameDuplicationException If the name coincides witha port already in the container.
 */
public IOPort(ComponentEntity container,String name,boolean isinput,boolean isoutput) throws IllegalActionException, NameDuplicationException {
  this(container,name);
  setInput(isinput);
  setOutput(isoutput);
}

Fixed version (ground truth):
/** 
 * Construct an IOPort with a container and a name that is either an input, an output, or both, depending on the third and fourth arguments. The specified container must implement the Actor interface or an exception will be thrown.
 * @param container The container actor.
 * @param name The name of the port.
 * @param isInput True if this is to be an input port.
 * @param isOutput True if this is to be an output port.
 * @exception IllegalActionException If the port is not of an acceptableclass for the container, or if the container does not implement the Actor interface.
 * @exception NameDuplicationException If the name coincides witha port already in the container.
 */
public IOPort(ComponentEntity container,String name,boolean isInput,boolean isOutput) throws IllegalActionException, NameDuplicationException {
  this(container,name);
  setInput(isInput);
  setOutput(isOutput);
}
Program: 76207
Project: 76207
Buggy source:
/** 
 * Return true if the specified channel can accept a token via the put() method.  If this port is not an output, or the channel index is out of range, then throws IllegalActionException.  If there are multiple receivers in the group associated with the channel, then return true only if all the receivers can accept a token.
 * @param channelindex The channel index.
 * @return True if there is room for a token in the channel.
 * @exception IllegalActionException If the receivers do not supportthis query, if this is not an output port, or if the channel index is out of range.
 */
public boolean hasRoom(int channelindex) throws IllegalActionException {
  try {
    Receiver[][] farRecs=getRemoteReceivers();
    if (farRecs == null || farRecs[channelindex] == null) {
      return false;
    }
    for (int j=0; j < farRecs[channelindex].length; j++) {
      if (!farRecs[channelindex][j].hasRoom())       return false;
    }
  }
 catch (  ArrayIndexOutOfBoundsException ex) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Return true if the specified channel can accept a token via the put() method.  If this port is not an output, or the channel index is out of range, then throws IllegalActionException.  If there are multiple receivers in the group associated with the channel, then return true only if all the receivers can accept a token.
 * @param channelIndex The channel index.
 * @return True if there is room for a token in the channel.
 * @exception IllegalActionException If the receivers do not supportthis query, if this is not an output port, or if the channel index is out of range.
 */
public boolean hasRoom(int channelIndex) throws IllegalActionException {
  try {
    Receiver[][] farRecs=getRemoteReceivers();
    if (farRecs == null || farRecs[channelIndex] == null) {
      return false;
    }
    for (int j=0; j < farRecs[channelIndex].length; j++) {
      if (!farRecs[channelIndex][j].hasRoom())       return false;
    }
  }
 catch (  ArrayIndexOutOfBoundsException ex) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  return true;
}