nus-yam/ex-repair huggingface dataset:
Program: 75861
Project: 75861
Buggy source:
/** 
 * Return true if get() will succeed in returning a token the given number of times.
 * @return A boolean indicating whether there are the given number oftokens in this receiver.
 * @exception IllegalArgumentException If the argument is lessthan one.  This is a runtime exception, so it need not be declared explicitly by the caller.
 */
public boolean hasToken(int tokens) throws IllegalArgumentException {
  if (tokens < 1)   throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  return _queue.size() >= tokens;
}

Fixed version (ground truth):
/** 
 * Return true if get() will succeed in returning a token the given number of times.
 * @return A boolean indicating whether there are the given number oftokens in this receiver.
 * @exception IllegalArgumentException If the argument is lessthan one.  This is a runtime exception, so it need not be declared explicitly by the caller.
 */
public boolean hasToken(int tokens) throws IllegalArgumentException {
  if (tokens < 0)   throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  return _queue.size() >= tokens;
}
Program: 75862
Project: 75862
Buggy source:
/** 
 * Return the function result.
 * @return A Type.
 */
public Object getValue(){
  Type inputType=_port.getType();
  if (inputType == BaseType.COMPLEX) {
    return BaseType.DOUBLE;
  }
 else   if (inputType == BaseType.COMPLEX_MATRIX) {
    return BaseType.INT_MATRIX;
  }
 else {
    return inputType;
  }
}

Fixed version (ground truth):
/** 
 * Return the function result.
 * @return A Type.
 */
public Object getValue(){
  Type inputType=_port.getType();
  if (inputType == BaseType.COMPLEX) {
    return BaseType.DOUBLE;
  }
 else   if (inputType == BaseType.COMPLEX_MATRIX) {
    return BaseType.DOUBLE_MATRIX;
  }
 else {
    return inputType;
  }
}
Program: 75863
Project: 75863
Buggy source:
/** 
 * Initialize/Reinitialize audio resources. First stop playback, and. Then reread all parameters, and start audio capture. <p> This method is synchronized since it is not safe to call LiveSound methods while this method is executing.
 * @exception IllegalActionException If there is a problem initializingaudio capture.
 */
private synchronized void _initializeCapture() throws IllegalActionException, IOException {
  if (_debugInfo) {
    System.out.println("String_Node_Str");
  }
  if (LiveSound.isCaptureActive()) {
    LiveSound.stopCapture(this);
  }
  int sampleRateInt=((IntToken)sampleRate.getToken()).intValue();
  int bitsPerSampleInt=((IntToken)bitsPerSample.getToken()).intValue();
  int channelsInt=((IntToken)channels.getToken()).intValue();
  if (LiveSound.getSampleRate() != sampleRateInt) {
    LiveSound.setSampleRate(sampleRateInt);
  }
  if (LiveSound.getBitsPerSample() != bitsPerSampleInt) {
    LiveSound.setBitsPerSample(bitsPerSampleInt);
  }
  if (LiveSound.getChannels() != channelsInt) {
    LiveSound.setChannels(channelsInt);
  }
  if (LiveSound.getBufferSize() != 4096) {
    LiveSound.setBufferSize(4096);
  }
  if (LiveSound.getTransferSize() != 128) {
    LiveSound.setTransferSize(128);
  }
  try {
    LiveSound.startCapture(this);
  }
 catch (  IOException ex) {
    throw new IllegalActionException("String_Node_Str" + ex);
  }
}

Fixed version (ground truth):
/** 
 * Initialize audio resources. Reread all parameters, and start  audio capture. <p> This method is synchronized since it is not safe to call LiveSound methods while this method is executing.
 * @exception IllegalActionException If there is a problem initializingaudio capture.
 */
private synchronized void _initializeCapture() throws IllegalActionException, IOException {
  if (_debugInfo) {
    System.out.println("String_Node_Str");
  }
  if (LiveSound.isCaptureActive()) {
    throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str");
  }
  int sampleRateInt=((IntToken)sampleRate.getToken()).intValue();
  int bitsPerSampleInt=((IntToken)bitsPerSample.getToken()).intValue();
  int channelsInt=((IntToken)channels.getToken()).intValue();
  if (LiveSound.getSampleRate() != sampleRateInt) {
    LiveSound.setSampleRate(sampleRateInt);
  }
  if (LiveSound.getBitsPerSample() != bitsPerSampleInt) {
    LiveSound.setBitsPerSample(bitsPerSampleInt);
  }
  if (LiveSound.getChannels() != channelsInt) {
    LiveSound.setChannels(channelsInt);
  }
  if (LiveSound.getBufferSize() != 4096) {
    LiveSound.setBufferSize(4096);
  }
  if (LiveSound.getTransferSize() != 128) {
    LiveSound.setTransferSize(128);
  }
  try {
    LiveSound.startCapture(this);
  }
 catch (  IOException ex) {
    throw new IllegalActionException("String_Node_Str" + ex);
  }
}
Program: 75865
Project: 75865
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ArrayAppend newObject=(ArrayAppend)(super.clone(workspace));
  newObject.output.setTypeAtLeast(input);
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and then creates new ports and parameters.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  ArrayAppend newObject=(ArrayAppend)(super.clone(workspace));
  newObject.output.setTypeAtLeast(newObject.input);
  return newObject;
}
Program: 75866
Project: 75866
Buggy source:
/** 
 * Invoke a specified number of iterations of this actor. Each iteration updates the state of the actor by adding the value of the <i>step</i> parameter to the state and sending the value of the state to the output. The iteration count is also incremented by the value of <i>count</i>, and if the result is greater than or equal to <i>firingCountLimit</i> then return STOP_ITERATING. <p> This method should be called instead of the usual prefire(), fire(), postfire() methods when this actor is used in a domain that supports vectorized actors.  This leads to more efficient execution.
 * @param count The number of iterations to perform.
 * @return COMPLETED if the actor was successfully iterated thespecified number of times. Otherwise, if the maximum iteration count has been reached, return STOP_ITERATING.
 * @exception IllegalActionException If iterating cannot beperformed.
 */
public int iterate(int count) throws IllegalActionException {
  if (count > _resultArray.length) {
    _resultArray=new Token[count];
  }
  for (int i=0; i < count; i++) {
    _resultArray[i]=_stateToken;
    try {
      _stateToken=_stateToken.add(_step);
    }
 catch (    IllegalActionException ex) {
      throw new InternalErrorException(ex.getMessage());
    }
  }
  output.send(0,_resultArray,count);
  if (_firingCountLimit != 0) {
    _iterationCount+=count;
    if (_iterationCount >= _firingCountLimit) {
      return STOP_ITERATING;
    }
  }
  return COMPLETED;
}

Fixed version (ground truth):
/** 
 * Invoke a specified number of iterations of this actor. Each iteration updates the state of the actor by adding the value of the <i>step</i> parameter to the state and sending the value of the state to the output. The iteration count is also incremented by the value of <i>count</i>, and if the result is greater than or equal to <i>firingCountLimit</i> then return STOP_ITERATING. <p> This method should be called instead of the usual prefire(), fire(), postfire() methods when this actor is used in a domain that supports vectorized actors.  This leads to more efficient execution.
 * @param count The number of iterations to perform.
 * @return COMPLETED if the actor was successfully iterated thespecified number of times. Otherwise, if the maximum iteration count has been reached, return STOP_ITERATING.
 * @exception IllegalActionException If iterating cannot beperformed.
 */
public int iterate(int count) throws IllegalActionException {
  super.iterate(count);
  if (count > _resultArray.length) {
    _resultArray=new Token[count];
  }
  for (int i=0; i < count; i++) {
    _resultArray[i]=_stateToken;
    try {
      _stateToken=_stateToken.add(_step);
    }
 catch (    IllegalActionException ex) {
      throw new InternalErrorException(ex.getMessage());
    }
  }
  output.send(0,_resultArray,count);
  if (_firingCountLimit != 0) {
    _iterationCount+=count;
    if (_iterationCount >= _firingCountLimit) {
      return STOP_ITERATING;
    }
  }
  return COMPLETED;
}
Program: 75867
Project: 75867
Buggy source:
/** 
 * Start audio playback. The specified object will be given an exclusive lock on the audio playback resources until the stopPlayback() method is called with the same object reference. After this method returns, the putSamples() method may be repeatedly invoked (using the object reference as a parameter) to playback audio. <p> If audio playback is already active, then an exception will occur.
 * @param consumer The object to be given exclusive accessto the playback audio resources.
 * @exception IllegalStateException If this method is calledwhile audio playback is already active.
 */
public static void startPlayback(Object producer) throws IOException, IllegalStateException {
  _startPlayback();
  _playbackIsActive=true;
}

Fixed version (ground truth):
/** 
 * Start audio playback. The specified object will be given an exclusive lock on the audio playback resources until the stopPlayback() method is called with the same object reference. After this method returns, the putSamples() method may be repeatedly invoked (using the object reference as a parameter) to playback audio. <p> If audio playback is already active, then an exception will occur.
 * @param consumer The object to be given exclusive accessto the playback audio resources.
 * @exception IllegalStateException If this method is calledwhile audio playback is already active.
 */
public static void startPlayback(Object producer) throws IOException, IllegalStateException {
  if (_debug) {
    System.out.println("String_Node_Str");
  }
  _startPlayback();
  _playbackIsActive=true;
}
Program: 75869
Project: 75869
Buggy source:
/** 
 * Get the array length (in samples per channel) to use for capturing and playing samples via the putSamples() and getSamples() methods. This method gets the size of the 2nd dimension of the 2-dimensional array used by the putSamples() and getSamples() methods. This method returns the value that was set by the  setTransferSize(). If setTransferSize() was not invoked, the default value of 64 is returns. <p> This method should only be called while audio capture and playback are inactive. Otherwise an exception will occur.
 * @return The size of the 2nd dimension of the 2-dimensional array used by the putSamples() and getSamples() methods.
 */
public static int getTransferSize(){
  return _transferSize;
}

Fixed version (ground truth):
/** 
 * Get the array length (in samples per channel) to use for capturing and playing samples via the putSamples() and getSamples() methods. This method gets the size of the 2nd dimension of the 2-dimensional array used by the putSamples() and getSamples() methods. This method returns the value that was set by the  setTransferSize(). If setTransferSize() was not invoked, the default value of 128 is returns. <p> This method should only be called while audio capture and playback are inactive. Otherwise an exception will occur.
 * @return The size of the 2nd dimension of the 2-dimensional array used by the putSamples() and getSamples() methods.
 */
public static int getTransferSize(){
  return _transferSize;
}
Program: 75870
Project: 75870
Buggy source:
/** 
 * Stop audio playback. If the specified object has the lock on audio playback when this method is invoked, then stop audio playback. Otherwise an exception will occur.
 * @param producer The object that held on exclusivelock on the playback audio resources when this method was invoked.
 * @exception IllegalStateException If the specifiedobject did not hold an exclusive lock on the playback audio resources when this method was invoked.
 */
public static void stopPlayback(Object producer) throws IOException, IllegalStateException {
  if (_sourceLine != null) {
    _sourceLine.drain();
    _sourceLine.stop();
    _sourceLine.close();
  }
  _sourceLine=null;
  _playbackIsActive=false;
}

Fixed version (ground truth):
/** 
 * Stop audio playback. If the specified object has the lock on audio playback when this method is invoked, then stop audio playback. Otherwise an exception will occur.
 * @param producer The object that held on exclusivelock on the playback audio resources when this method was invoked.
 * @exception IllegalStateException If the specifiedobject did not hold an exclusive lock on the playback audio resources when this method was invoked.
 */
public static void stopPlayback(Object producer) throws IOException, IllegalStateException {
  if (_debug) {
    System.out.println("String_Node_Str");
  }
  if (_sourceLine != null) {
    _sourceLine.drain();
    _sourceLine.stop();
    _sourceLine.close();
  }
  _sourceLine=null;
  _playbackIsActive=false;
}
Program: 75871
Project: 75871
Buggy source:
/** 
 * Set the number of bits per sample to use for audio capture and playback. Allowable values include 8 and 16 bits. If this method is not invoked, then the default value of 8 bits is used. <p> This method should only be called while audio capture and playback are inactive. Otherwise an exception will occur.
 * @param bitsPerSample The number of bits per sample.
 * @exception IllegalStateException If this method is calledwhile audio capture or playback are active.
 */
public static void setBitsPerSample(int bitsPerSample) throws IllegalStateException {
  if ((_captureIsActive) || (_playbackIsActive)) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
 else {
    _bitsPerSample=bitsPerSample;
  }
}

Fixed version (ground truth):
/** 
 * Set the number of bits per sample to use for audio capture and playback. Allowable values include 8 and 16 bits. If this method is not invoked, then the default value of 16 bits is used. <p> This method should only be called while audio capture and playback are inactive. Otherwise an exception will occur.
 * @param bitsPerSample The number of bits per sample.
 * @exception IllegalStateException If this method is calledwhile audio capture or playback are active.
 */
public static void setBitsPerSample(int bitsPerSample) throws IllegalStateException {
  if ((_captureIsActive) || (_playbackIsActive)) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
 else {
    _bitsPerSample=bitsPerSample;
  }
}
Program: 75872
Project: 75872
Buggy source:
/** 
 * Set the array length (in samples per channel) to use for capturing and playing samples via the putSamples() and getSamples() methods. This method sets the size of the 2nd dimension of the 2-dimensional array used by the putSamples() and getSamples() methods. If this method is not invoked, the default value of 64 is used. <p> This method should only be called while audio capture and playback are inactive. Otherwise an exception will occur.
 * @param transferSize The  size of the 2nd dimension of the 2-dimensional array used by the putSamples() and  getSamples() methods
 * @exception IllegalStateException If this method is calledwhile audio capture or playback are active.
 */
public static void setTransferSize(int transferSize) throws IllegalStateException {
  if (_debug) {
    System.out.println("String_Node_Str" + "String_Node_Str" + transferSize);
  }
  if ((_captureIsActive) || (_playbackIsActive)) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
 else {
    _transferSize=transferSize;
  }
}

Fixed version (ground truth):
/** 
 * Set the array length (in samples per channel) to use for capturing and playing samples via the putSamples() and getSamples() methods. This method sets the size of the 2nd dimension of the 2-dimensional array used by the putSamples() and getSamples() methods. If this method is not invoked, the default value of 128 is used. <p> This method should only be called while audio capture and playback are inactive. Otherwise an exception will occur.
 * @param transferSize The  size of the 2nd dimension of the 2-dimensional array used by the putSamples() and  getSamples() methods
 * @exception IllegalStateException If this method is calledwhile audio capture or playback are active.
 */
public static void setTransferSize(int transferSize) throws IllegalStateException {
  if (_debug) {
    System.out.println("String_Node_Str" + "String_Node_Str" + transferSize);
  }
  if ((_captureIsActive) || (_playbackIsActive)) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
 else {
    _transferSize=transferSize;
  }
}
Program: 75873
Project: 75873
Buggy source:
/** 
 * Return the number of bits per audio sample, which is set by the setBitsPerSample() method. The default value of this parameter is 8 bits.
 * @return The sample size in bits. 
 */
public static int getBitsPerSample(){
  return _bitsPerSample;
}

Fixed version (ground truth):
/** 
 * Return the number of bits per audio sample, which is set by the setBitsPerSample() method. The default value of this parameter is 16 bits.
 * @return The sample size in bits. 
 */
public static int getBitsPerSample(){
  return _bitsPerSample;
}
Program: 75874
Project: 75874
Buggy source:
private static void _startPlayback() throws IOException {
  boolean signed=true;
  boolean bigEndian=true;
  AudioFormat format=new AudioFormat((float)_sampleRate,_bitsPerSample,_channels,signed,bigEndian);
  _frameSizeInBytes=format.getFrameSize();
  DataLine.Info sourceInfo=new DataLine.Info(SourceDataLine.class,format,AudioSystem.NOT_SPECIFIED);
  try {
    _sourceLine=(SourceDataLine)AudioSystem.getLine(sourceInfo);
    _sourceLine.open(format,_bufferSize * _frameSizeInBytes);
  }
 catch (  LineUnavailableException ex) {
    throw new IOException("String_Node_Str" + "String_Node_Str" + ex);
  }
  _data=new byte[_transferSize * _frameSizeInBytes * _channels];
  _sourceLine.start();
}

Fixed version (ground truth):
private static void _startPlayback() throws IOException {
  boolean signed=true;
  boolean bigEndian=true;
  AudioFormat format=new AudioFormat((float)_sampleRate,_bitsPerSample,_channels,signed,bigEndian);
  _frameSizeInBytes=format.getFrameSize();
  DataLine.Info sourceInfo=new DataLine.Info(SourceDataLine.class,format,AudioSystem.NOT_SPECIFIED);
  try {
    _sourceLine=(SourceDataLine)AudioSystem.getLine(sourceInfo);
    _sourceLine.open(format,_bufferSize * _frameSizeInBytes);
  }
 catch (  LineUnavailableException ex) {
    throw new IOException("String_Node_Str" + "String_Node_Str" + ex);
  }
  _data=new byte[_transferSize * _frameSizeInBytes * _channels];
  _bytesPerSample=_bitsPerSample / 8;
  _sourceLine.start();
}
Program: 75876
Project: 75876
Buggy source:
/** 
 * Stop capturing audio. This method should be called when no more calls to getSamples(). are required, so that the system resources involved in the audio capture may be freed.
 * @exception IOException If there is a problem closing theaudio resources.
 */
public void stopCapture() throws IOException {
  _isAudioCaptureActive=false;
  if (_audioInputStream != null) {
    _audioInputStream.close();
  }
  if (_properFormatAudioInputStream != null) {
    _properFormatAudioInputStream.close();
  }
  if (_targetLine != null) {
    if (_targetLine.isOpen() == true) {
      _targetLine.stop();
      _targetLine.close();
      _targetLine=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Stop capturing audio. This method should be called when no more calls to getSamples(). are required, so that the system resources involved in the audio capture may be freed.
 * @exception IOException If there is a problem closing theaudio resources.
 */
public void stopCapture() throws IOException {
  if (_isAudioCaptureActive == true) {
    if (_audioInputStream != null) {
      _audioInputStream.close();
      _audioInputStream=null;
    }
    if (_properFormatAudioInputStream != null) {
      _properFormatAudioInputStream.close();
      _properFormatAudioInputStream=null;
    }
    if (_targetLine != null) {
      if (_targetLine.isOpen() == true) {
        _targetLine.stop();
        _targetLine.close();
        _targetLine=null;
      }
    }
  }
  _isAudioCaptureActive=false;
}
Program: 75877
Project: 75877
Buggy source:
/** 
 * Stop playing/writing audio. This method should be called when no more calls to putSamples(). are required, so that the system resources involved in the audio playback may be freed. <p> If the "write audio data to file" constructor was used, then the sound file specified by the constructor is saved and closed.
 * @exception IOException If there is a problem closing theaudio resources, or if the "write audio data to file" constructor was used  and the sound file has an unsupported format.
 */
public void stopPlayback() throws IOException {
  _isAudioPlaybackActive=false;
  if (_playbackMode == "String_Node_Str") {
    if (_sourceLine != null) {
      _sourceLine.drain();
      _sourceLine.stop();
      _sourceLine.close();
    }
    _sourceLine=null;
  }
 else   if (_playbackMode == "String_Node_Str") {
    _stopPlaybackToFile();
  }
 else {
  }
}

Fixed version (ground truth):
/** 
 * Stop playing/writing audio. This method should be called when no more calls to putSamples(). are required, so that the system resources involved in the audio playback may be freed. <p> If the "write audio data to file" constructor was used, then the sound file specified by the constructor is saved and closed.
 * @exception IOException If there is a problem closing theaudio resources, or if the "write audio data to file" constructor was used  and the sound file has an unsupported format.
 */
public void stopPlayback() throws IOException {
  if (_isAudioPlaybackActive == true) {
    if (_playbackMode == "String_Node_Str") {
      if (_sourceLine != null) {
        _sourceLine.drain();
        _sourceLine.stop();
        _sourceLine.close();
      }
      _sourceLine=null;
    }
 else     if (_playbackMode == "String_Node_Str") {
      _stopPlaybackToFile();
    }
 else {
    }
  }
  _isAudioPlaybackActive=false;
}
Program: 75878
Project: 75878
Buggy source:
/** 
 * Send a token to all connected receivers. Tokens are in general immutable, so each receiver is given a reference to the same token and no clones are made. The transfer is accomplished by calling getRemoteReceivers() to determine the number of channels with valid receivers and then calling send on the appropriate channels. It would probably be faster to call put() directly on the receivers. If there are no destination receivers, then nothing is sent. If the port is not connected to anything, or receivers have not been created in the remote port, then just return. This method is read-synchronized on the workspace.
 * @param token The token to send
 * @exception IllegalActionException If the port is not an output.
 * @exception NoRoomException If a send to one of the channels throwsit.
 */
public void broadcast(Token token) throws IllegalActionException, NoRoomException {
  try {
    _workspace.getReadAccess();
    Receiver farReceivers[][]=getRemoteReceivers();
    if (farReceivers == null) {
      return;
    }
    for (int j=0; j < farReceivers.length; j++) {
      send(j,token);
    }
  }
  finally {
    _workspace.doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Send the specified portion of a token array to all receivers connected to this port. The first <i>vectorLength</i> tokens of the token array are sent. <p> Tokens are in general immutable, so each receiver is given a reference to the same token and no clones are made. If the port is not connected to anything, or receivers have not been created in the remote port, or the channel index is out of range, or the port is not an output port, then just silently return.  This behavior makes it easy to leave output ports unconnected when you are not interested in the output.  The transfer is accomplished by calling the vectorized put() method of the remote receivers. If the port is not connected to anything, or receivers have not been created in the remote port, then just return. <p> Some of this method is read-synchronized on the workspace. Since it is possible for a thread to block while executing a put, it is important that the thread does not hold read access on the workspace when it is blocked. Thus this method releases read access on the workspace before calling put.
 * @param tokenArray The token array to send
 * @param vectorLength The number of elements of of the tokenarray to send.
 * @exception NoRoomException If there is no room in the receiver.
 * @exception IllegalActionException Not thrown in this base class.
 */
public void broadcast(Token[] tokenArray,int vectorLength) throws IllegalActionException, NoRoomException {
  Receiver[][] farReceivers;
  try {
    _workspace.getReadAccess();
    farReceivers=getRemoteReceivers();
    if (farReceivers == null) {
      return;
    }
  }
  finally {
    _workspace.doneReading();
  }
  try {
    for (int i=0; i < farReceivers.length; i++) {
      if (farReceivers[i] == null)       continue;
      for (int j=0; j < farReceivers[i].length; j++) {
        farReceivers[i][j].putArray(tokenArray,vectorLength);
      }
    }
  }
 catch (  ArrayIndexOutOfBoundsException ex) {
  }
}
Program: 75879
Project: 75879
Buggy source:
/** 
 * Given a CompileUnitNode, return the complete package name.
 * @param loadedAST The CompileUnitNode of the class
 * @return The full package name of the class
 */
public static String getPackageName(CompileUnitNode loadedAST){
  StringBuffer packageBuffer=new StringBuffer(((UserTypeDeclNode)loadedAST.getDefTypes().get(0)).getName().getIdent());
  NameNode packageNode=(NameNode)loadedAST.getPkg();
  while (packageNode.getQualifier() != AbsentTreeNode.instance) {
    packageBuffer.insert(0,packageNode.getIdent() + '.');
    packageNode=(NameNode)packageNode.getQualifier();
  }
  packageBuffer.insert(0,packageNode.getIdent() + '.');
  return packageBuffer.toString();
}

Fixed version (ground truth):
/** 
 * Given a CompileUnitNode, return the complete package name. If no package name is associated with the CompileUnitNode, then return the default package name for code generation. 
 * @param loadedAST The CompileUnitNode of the class
 * @return The full package name of the class
 */
public static String getPackageName(CompileUnitNode loadedAST){
  StringBuffer packageBuffer=new StringBuffer(((UserTypeDeclNode)loadedAST.getDefTypes().get(0)).getName().getIdent());
  Object packageReturnValue=loadedAST.getPkg();
  if (!(packageReturnValue instanceof NameNode))   return (JavaStaticSemanticConstants.DEFAULT_PACKAGE_NAME);
 else {
    NameNode packageNode=(NameNode)packageReturnValue;
    while (packageNode.getQualifier() != AbsentTreeNode.instance) {
      packageBuffer.insert(0,packageNode.getIdent() + '.');
      packageNode=(NameNode)packageNode.getQualifier();
    }
    packageBuffer.insert(0,packageNode.getIdent() + '.');
    return packageBuffer.toString();
  }
}
Program: 75881
Project: 75881
Buggy source:
protected void _execute() throws Exception {
  super._execute();
  link.setTail(newLinkTail);
  if (relationNameToAdd != null) {
    ComponentRelation relation=(ComponentRelation)container.getRelation(relationNameToAdd);
    link.setRelation(relation);
  }
 else {
    link.setRelation(null);
  }
}

Fixed version (ground truth):
protected void _execute() throws Exception {
  super._execute();
  link.setTail(newLinkTail);
  if (relationNameToAdd != null) {
    ComponentRelation relation=(ComponentRelation)container.getRelation(relationNameToAdd);
    if (relation == null)     throw new InternalErrorException("String_Node_Str" + relationNameToAdd + "String_Node_Str"+ container);
    link.setRelation(relation);
  }
 else {
    link.setRelation(null);
  }
}
Program: 75887
Project: 75887
Buggy source:
protected void _execute() throws Exception {
  super._execute();
  link.setTail(newLinkTail);
  if (relationNameToAdd != null) {
    link.setRelation(getToplevel().getRelation(relationNameToAdd));
  }
 else {
    link.setRelation(null);
  }
}

Fixed version (ground truth):
protected void _execute() throws Exception {
  super._execute();
  link.setTail(newLinkTail);
  if (relationNameToAdd != null) {
    ComponentRelation relation=(ComponentRelation)container.getRelation(relationNameToAdd);
    link.setRelation(relation);
  }
 else {
    link.setRelation(null);
  }
}
Program: 75889
Project: 75889
Buggy source:
public Object visitIfExprNode(IfExprNode node,LinkedList args){
  LinkedList e1StringList=(LinkedList)node.childReturnValueAt(node.CHILD_INDEX_EXPR1);
  LinkedList e2StringList=(LinkedList)node.childReturnValueAt(node.CHILD_INDEX_EXPR2);
  LinkedList e3StringList=(LinkedList)node.childReturnValueAt(node.CHILD_INDEX_EXPR3);
  e1StringList=_parenExpr(node.getExpr1(),e1StringList);
  e2StringList=_parenExpr(node.getExpr2(),e2StringList);
  e3StringList=_parenExpr(node.getExpr3(),e2StringList);
  return TNLManip.arrayToList(new Object[]{e1StringList,"String_Node_Str",e2StringList,"String_Node_Str",e3StringList});
}

Fixed version (ground truth):
public Object visitIfExprNode(IfExprNode node,LinkedList args){
  LinkedList e1StringList=(LinkedList)node.childReturnValueAt(node.CHILD_INDEX_EXPR1);
  LinkedList e2StringList=(LinkedList)node.childReturnValueAt(node.CHILD_INDEX_EXPR2);
  LinkedList e3StringList=(LinkedList)node.childReturnValueAt(node.CHILD_INDEX_EXPR3);
  e1StringList=_parenExpr(node.getExpr1(),e1StringList);
  e2StringList=_parenExpr(node.getExpr2(),e2StringList);
  e3StringList=_parenExpr(node.getExpr3(),e3StringList);
  return TNLManip.arrayToList(new Object[]{e1StringList,"String_Node_Str",e2StringList,"String_Node_Str",e3StringList});
}
Program: 75891
Project: 75891
Buggy source:
public void method1(){
  int var1=5;
  int var2=7;
  float y=2;
  var1=var1 + var2;
  var2=var2 - var1;
  _privatevar1=var1 * var2;
  _privatevar2=var2 / var1;
}

Fixed version (ground truth):
public void method1(){
  int var1=5;
  int var2=7;
  float y=2;
  var1=var1 + var2 + y;
  var2=var2 - var1;
  _privatevar1=var1 * var2;
  _privatevar2=var2 / var1;
}
Program: 75893
Project: 75893
Buggy source:
/** 
 * Put an array of objects in the queue and return true if this will not cause the capacity to be exceeded. Otherwise, do not put any of the object in the queue and return false. The specified number of objects from the array will be put in the queue.
 * @param element An array of objects to be put in the queue.
 * @param count The number of objects to be put in the queue.
 * @return A boolean indicating success.
 */
public boolean putArray(Object element[],int count){
  if (_queueArray.length - _queueSize >= count) {
    int i;
    if (count <= (_queueArray.length - _queueFront)) {
      System.arraycopy(element,0,_queueArray,_queueFront,count);
      _queueFront+=count;
      if (_queueFront >= _queueArray.length)       _queueFront=_queueFront % _queueArray.length;
      _queueSize+=count;
    }
 else {
      System.arraycopy(element,0,_queueArray,_queueFront,_queueArray.length - _queueFront);
      System.arraycopy(element,_queueArray.length - _queueFront,_queueArray,0,count - (_queueArray.length - _queueFront));
      _queueFront+=count;
      if (_queueFront >= _queueArray.length)       _queueFront=_queueFront % _queueArray.length;
      _queueSize+=count;
    }
    return true;
  }
 else {
    if (_queueMaxCapacity == INFINITE_CAPACITY) {
      try {
        _resizeArray(_queueArray.length * 2);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      return putArray(element);
    }
 else     return false;
  }
}

Fixed version (ground truth):
/** 
 * Put an array of objects in the queue and return true if this will not cause the capacity to be exceeded. Otherwise, do not put any of the object in the queue and return false. The specified number of objects from the array will be put in the queue.
 * @param element An array of objects to be put in the queue.
 * @param count The number of objects to be put in the queue.
 * @return A boolean indicating success.
 */
public boolean putArray(Object element[],int count){
  if (_queueArray.length - _queueSize >= count) {
    int i;
    if (count <= (_queueArray.length - _queueFront)) {
      System.arraycopy(element,0,_queueArray,_queueFront,count);
      _queueFront+=count;
      if (_queueFront >= _queueArray.length)       _queueFront=_queueFront % _queueArray.length;
      _queueSize+=count;
    }
 else {
      System.arraycopy(element,0,_queueArray,_queueFront,_queueArray.length - _queueFront);
      System.arraycopy(element,_queueArray.length - _queueFront,_queueArray,0,count - (_queueArray.length - _queueFront));
      _queueFront+=count;
      if (_queueFront >= _queueArray.length)       _queueFront=_queueFront % _queueArray.length;
      _queueSize+=count;
    }
    return true;
  }
 else {
    if (_queueMaxCapacity == INFINITE_CAPACITY) {
      try {
        _resizeArray(_queueArray.length * 2);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
      return putArray(element,count);
    }
 else     return false;
  }
}
Program: 75896
Project: 75896
Buggy source:
/** 
 * Clone the actor into the specified workspace. This calls the base class and sets the public variables to point to the new ports.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Switch newObject=(Switch)super.clone(workspace);
  newObject.select=(TypedIOPort)newObject.getPort("String_Node_Str");
  return newObject;
}

Fixed version (ground truth):
/** 
 * Clone the actor into the specified workspace. This calls the base class and sets the public variables to point to the new ports.
 * @param workspace The workspace for the new object.
 * @return A new actor.
 * @exception CloneNotSupportedException If a derived class containsan attribute that cannot be cloned.
 */
public Object clone(Workspace workspace) throws CloneNotSupportedException {
  Switch3D newObject=(Switch3D)super.clone(workspace);
  newObject.select=(TypedIOPort)newObject.getPort("String_Node_Str");
  return newObject;
}
Program: 75898
Project: 75898
Buggy source:
/** 
 * Initialize the local data members of this object.  
 */
protected void _localMemberInitialize(){
  _firingvector=new TreeMap(new NamedObjComparator());
  _firingvectorvalid=true;
}

Fixed version (ground truth):
/** 
 * Initialize the local data members of this object.  
 */
protected void _localMemberInitialize(){
  _firingvector=new TreeMap(new NamedObjComparator());
  _firingvectorvalid=true;
  addDebugListener(new StreamListener());
}
Program: 75900
Project: 75900
Buggy source:
/** 
 * Called when a connector end is dropped--attach or detach the edge as appropriate.
 */
public void connectorDropped(ConnectorEvent evt){
  Connector c=evt.getConnector();
  Figure f=evt.getTarget();
  Object edge=c.getUserObject();
  Object node=(f == null) ? null : f.getUserObject();
  FSMGraphModel model=(FSMGraphModel)getController().getGraphModel();
switch (evt.getEnd()) {
case ConnectorEvent.HEAD_END:
    model.getArcModel().setHead(edge,node);
  break;
case ConnectorEvent.TAIL_END:
model.getArcModel().setTail(edge,node);
break;
default :
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
/** 
 * Called when a connector end is dropped--attach or detach the edge as appropriate.
 */
public void connectorDropped(ConnectorEvent evt){
  Connector c=evt.getConnector();
  Figure f=evt.getTarget();
  Object edge=c.getUserObject();
  Object node=(f == null) ? null : f.getUserObject();
  FSMGraphModel model=(FSMGraphModel)getController().getGraphModel();
switch (evt.getEnd()) {
case ConnectorEvent.HEAD_END:
    model.getArcModel().setHead(edge,node);
  break;
case ConnectorEvent.TAIL_END:
model.getArcModel().setTail(edge,node);
break;
default :
throw new IllegalStateException("String_Node_Str");
}
getController().rerenderEdge(edge);
}
Program: 75901
Project: 75901
Buggy source:
/** 
 * Render a visual representation of the given edge.
 */
public Connector render(Object edge,Site tailSite,Site headSite){
  AbstractConnector c=new ArcConnector(tailSite,headSite);
  c.setHeadEnd(new Arrowhead());
  c.setLineWidth((float)2.0);
  c.setUserObject(edge);
  Arc arc=(Arc)edge;
  Transition transition=(Transition)arc.getRelation();
  if (transition != null) {
    c.setToolTipText(transition.getName());
    StringBuffer buffer=new StringBuffer();
    if (transition.guardExpression != null && transition.guardExpression.getExpression() != null) {
      buffer.append(transition.guardExpression.getExpression());
    }
    String action=transition.actions.getExpression();
    if (action != null && !action.trim().equals("String_Node_Str")) {
      buffer.append("String_Node_Str");
      buffer.append(action);
    }
    LabelFigure label=new LabelFigure(buffer.toString(),_labelFont);
    label.setFillPaint(Color.blue);
    c.setLabelFigure(label);
  }
  return c;
}

Fixed version (ground truth):
/** 
 * Render a visual representation of the given edge.
 */
public Connector render(Object edge,Site tailSite,Site headSite){
  AbstractConnector c=new ArcConnector(tailSite,headSite);
  c.setHeadEnd(new Arrowhead());
  c.setLineWidth((float)2.0);
  c.setUserObject(edge);
  Arc arc=(Arc)edge;
  Transition transition=(Transition)arc.getRelation();
  if (transition != null) {
    c.setToolTipText(transition.getName());
    StringBuffer buffer=new StringBuffer();
    boolean aLabel=false;
    String guard=transition.guardExpression.getExpression();
    if (guard != null) {
      buffer.append(guard);
      aLabel=true;
    }
    String action=transition.actions.getExpression();
    if (action != null && !action.trim().equals("String_Node_Str")) {
      if (aLabel)       buffer.append("String_Node_Str");
      buffer.append(action);
      aLabel=true;
    }
    if (aLabel) {
      LabelFigure label=new LabelFigure(buffer.toString(),_labelFont);
      label.setFillPaint(Color.blue);
      c.setLabelFigure(label);
    }
  }
  return c;
}
Program: 75903
Project: 75903
Buggy source:
/** 
 * Return a new token whose value is the product of this token and the argument. The type of the specified token must be lower than ComplexMatrixToken.
 * @param t The token to multiply this Token by.
 * @return A new token containing the result.
 * @exception IllegalActionException If the type of the specifiedtoken is not lower than ComplexMatrixToken.
 */
public final Token multiplyReverse(final Token t) throws IllegalActionException {
  int compare=TypeLattice.compare(this,t);
  if (!(compare == CPO.HIGHER)) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + t.getClass().getName() + "String_Node_Str"+ getClass().getName());
  }
  if (t instanceof ScalarToken) {
    return multiply(t);
  }
 else {
    ComplexMatrixToken tem=(ComplexMatrixToken)this.convert(t);
    return new ComplexMatrixToken(ComplexMatrixMath.multiply(tem._getInternalComplexMatrix(),_value),DO_NOT_COPY);
  }
}

Fixed version (ground truth):
/** 
 * Return a new token whose value is the product of this token and the argument. The type of the specified token must be lower than ComplexMatrixToken.
 * @param t The token to multiply this Token by.
 * @return A new token containing the result.
 * @exception IllegalActionException If the type of the specifiedtoken is not lower than ComplexMatrixToken.
 */
public final Token multiplyReverse(final Token t) throws IllegalActionException {
  int compare=TypeLattice.compare(this,t);
  if (!(compare == CPO.HIGHER)) {
    throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + t.getClass().getName() + "String_Node_Str"+ getClass().getName());
  }
  if (t instanceof ScalarToken) {
    return multiply(t);
  }
 else {
    ComplexMatrixToken tem=(ComplexMatrixToken)this.convert(t);
    if (tem.getColumnCount() != _rowCount) {
      throw new IllegalActionException("String_Node_Str" + "String_Node_Str" + tem.getColumnCount() + "String_Node_Str"+ _rowCount+ "String_Node_Str");
    }
    return new ComplexMatrixToken(ComplexMatrixMath.multiply(tem._getInternalComplexMatrix(),_value),DO_NOT_COPY);
  }
}
Program: 75906
Project: 75906
Buggy source:
/** 
 * Return the refinement of this state. The name of the refinement is specified by the <i>refinementName</i> attribute. The refinement must be a TypedActor and have the same container as the FSMActor containing this state, otherwise an exception is thrown. This method is read-synchronized on the workspace.
 * @return The refinement of this state.
 * @exception IllegalActionException If the specified refinementcannot be found.
 */
public TypedActor getRefinement() throws IllegalActionException {
  if (_refinementVersion == workspace().getVersion()) {
    return _refinement;
  }
  try {
    workspace().getReadAccess();
    String name=refinementName.getExpression();
    if (name != null && name != "String_Node_Str") {
      Nameable cont=getContainer();
      TypedCompositeActor contContainer=(TypedCompositeActor)cont.getContainer();
      _refinement=(TypedActor)contContainer.getEntity(name);
      if (_refinement == null) {
        throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + name + "String_Node_Str"+ contContainer.getFullName());
      }
    }
 else {
      _refinement=null;
    }
    _refinementVersion=workspace().getVersion();
    return _refinement;
  }
  finally {
    workspace().doneReading();
  }
}

Fixed version (ground truth):
/** 
 * Return the refinement of this state. The name of the refinement is specified by the <i>refinementName</i> attribute. The refinement must be a TypedActor and have the same container as the FSMActor containing this state, otherwise an exception is thrown. This method is read-synchronized on the workspace.
 * @return The refinement of this state.
 * @exception IllegalActionException If the specified refinementcannot be found.
 */
public TypedActor getRefinement() throws IllegalActionException {
  if (_refinementVersion == workspace().getVersion()) {
    return _refinement;
  }
  try {
    workspace().getReadAccess();
    String name=refinementName.getExpression();
    if (name != null && !name.trim().equals("String_Node_Str")) {
      Nameable cont=getContainer();
      TypedCompositeActor contContainer=(TypedCompositeActor)cont.getContainer();
      _refinement=(TypedActor)contContainer.getEntity(name);
      if (_refinement == null) {
        throw new IllegalActionException(this,"String_Node_Str" + "String_Node_Str" + name + "String_Node_Str"+ contContainer.getFullName());
      }
    }
 else {
      _refinement=null;
    }
    _refinementVersion=workspace().getVersion();
    return _refinement;
  }
  finally {
    workspace().doneReading();
  }
}
Program: 75907
Project: 75907
Buggy source:
/** 
 * Read the model from the <i>modelURL</i> applet parameter.
 * @param workspace The workspace in which to create the model.
 * @return A model.
 * @throws Exception If something goes wrong.
 */
protected CompositeActor _createModel(Workspace workspace) throws Exception {
  String modelURL=getParameter("String_Node_Str");
  if (modelURL == null) {
    modelURL=getParameter("String_Node_Str");
    if (modelURL == null) {
      throw new Exception("String_Node_Str");
    }
  }
  MoMLParser parser=new MoMLParser();
  URL docBase=getDocumentBase();
  URL xmlFile=new URL(docBase,modelURL);
  _manager=null;
  CompositeActor result=null;
  NamedObj toplevel=parser.parse(docBase,xmlFile);
  _workspace=toplevel.workspace();
  if (toplevel instanceof CompositeActor) {
    result=(CompositeActor)toplevel;
    _manager=result.getManager();
    if (_manager == null) {
      _manager=new Manager(_workspace,"String_Node_Str");
      result.setManager(_manager);
    }
    _manager.addExecutionListener(this);
  }
 else {
    throw new Exception("String_Node_Str");
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Read the model from the <i>modelURL</i> applet parameter.
 * @param workspace The workspace in which to create the model.
 * @return A model.
 * @throws Exception If something goes wrong.
 */
protected NamedObj _createModel(Workspace workspace) throws Exception {
  String modelURL=getParameter("String_Node_Str");
  if (modelURL == null) {
    modelURL=getParameter("String_Node_Str");
    if (modelURL == null) {
      throw new Exception("String_Node_Str");
    }
  }
  MoMLParser parser=new MoMLParser();
  URL docBase=getDocumentBase();
  URL xmlFile=new URL(docBase,modelURL);
  _manager=null;
  NamedObj toplevel=parser.parse(docBase,xmlFile);
  _workspace=toplevel.workspace();
  if (toplevel instanceof CompositeActor) {
    CompositeActor result=(CompositeActor)toplevel;
    _manager=result.getManager();
    if (_manager == null) {
      _manager=new Manager(_workspace,"String_Node_Str");
      result.setManager(_manager);
    }
    _manager.addExecutionListener(this);
  }
  return toplevel;
}
Program: 75908
Project: 75908
Buggy source:
/** 
 * Initialize the applet. This method is called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start() method is called. In this base class, this method creates a new workspace, and instantiates in it the model whose class name is given by the <i>modelClass</i> applet parameter.  If that model does not contain a manager, then this method creates one for it.
 */
public void init(){
  super.init();
  _setupOK=true;
  _workspace=new Workspace(getClass().getName());
  try {
    _toplevel=_createModel(_workspace);
    if (_toplevel.getManager() == null) {
      _manager=new Manager(_workspace,"String_Node_Str");
      _manager.addExecutionListener(this);
      _toplevel.setManager(_manager);
    }
 else {
      _manager=_toplevel.getManager();
    }
  }
 catch (  Exception ex) {
    _setupOK=false;
    report("String_Node_Str",ex);
  }
  _createView();
}

Fixed version (ground truth):
/** 
 * Initialize the applet. This method is called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start() method is called. In this base class, this method creates a new workspace, and instantiates in it the model whose class name is given by the <i>modelClass</i> applet parameter.  If that model does not contain a manager, then this method creates one for it.
 */
public void init(){
  super.init();
  _setupOK=true;
  _workspace=new Workspace(getClass().getName());
  try {
    _toplevel=_createModel(_workspace);
    if (_toplevel instanceof CompositeActor) {
      if (((CompositeActor)_toplevel).getManager() == null) {
        _manager=new Manager(_workspace,"String_Node_Str");
        _manager.addExecutionListener(this);
        ((CompositeActor)_toplevel).setManager(_manager);
      }
 else {
        _manager=((CompositeActor)_toplevel).getManager();
      }
    }
  }
 catch (  Exception ex) {
    _setupOK=false;
    report("String_Node_Str",ex);
  }
  _createView();
}