nus-yam/ex-repair huggingface dataset:
Program: 76208
Project: 76208
Buggy source:
/** 
 * If the argument is true, make the port an output port. If the argument is false, make the port not an output port. This has no effect if the port is a transparent port that is linked on the inside to output ports.  In that case, the port is an output port regardless of whether and how this method is called. This method is write-synchronized on the workspace.
 * @param isoutput True to make the port an output.
 */
public void setOutput(boolean isoutput){
  _workspace.getWriteAccess();
  _isoutput=isoutput;
  _workspace.doneWriting();
}

Fixed version (ground truth):
/** 
 * If the argument is true, make the port an output port. If the argument is false, make the port not an output port. This has no effect if the port is a transparent port that is linked on the inside to output ports.  In that case, the port is an output port regardless of whether and how this method is called. This method is write-synchronized on the workspace.
 * @param isOutput True to make the port an output.
 */
public void setOutput(boolean isOutput){
  _workspace.getWriteAccess();
  _isOutput=isOutput;
  _workspace.doneWriting();
}
Program: 76209
Project: 76209
Buggy source:
/** 
 * Return true if the port is an input.  The port is an input if either setInput() has been called with a <i>true</i> argument, or it is connected on the inside to an input port, or if it is connected on the inside to the inside of an output port. In other words, it is an input if data can be put directly into it or sent through it to an input. This method is read-synchronized on the workspace.
 * @return True if the port is an input.
 */
public boolean isInput(){
  long version=_workspace.getVersion();
  if (_insideinputversion != version) {
    try {
      _workspace.getReadAccess();
      Iterator ports=deepInsidePortList().iterator();
      while (ports.hasNext()) {
        IOPort p=(IOPort)ports.next();
        if (p != this && p.isInput())         _isinput=true;
      }
      _insideinputversion=version;
    }
  finally {
      _workspace.doneReading();
    }
  }
  return _isinput;
}

Fixed version (ground truth):
/** 
 * Return true if the port is an input.  The port is an input if either setInput() has been called with a <i>true</i> argument, or it is connected on the inside to an input port, or if it is connected on the inside to the inside of an output port. In other words, it is an input if data can be put directly into it or sent through it to an input. This method is read-synchronized on the workspace.
 * @return True if the port is an input.
 */
public boolean isInput(){
  long version=_workspace.getVersion();
  if (_insideinputversion != version) {
    try {
      _workspace.getReadAccess();
      Iterator ports=deepInsidePortList().iterator();
      while (ports.hasNext()) {
        IOPort p=(IOPort)ports.next();
        if (p != this && p.isInput())         _isInput=true;
      }
      _insideinputversion=version;
    }
  finally {
      _workspace.doneReading();
    }
  }
  return _isInput;
}
Program: 76210
Project: 76210
Buggy source:
/** 
 * If the argument is true, make the port a multiport. That is, make it capable of linking with multiple IORelations, or with IORelations that have width greater than one. If the argument is false, allow only links with a single IORelation of width one. This has no effect if the port is a transparent port that is linked on the inside to a multiport.  In that case, the port is a multiport regardless of whether and how this method is called. This method is write-synchronized on the workspace.
 * @param ismultiport True to make the port a multiport.
 */
public void setMultiport(boolean ismultiport){
  _workspace.getWriteAccess();
  _ismultiport=ismultiport;
  _workspace.doneWriting();
}

Fixed version (ground truth):
/** 
 * If the argument is true, make the port a multiport. That is, make it capable of linking with multiple IORelations, or with IORelations that have width greater than one. If the argument is false, allow only links with a single IORelation of width one. This has no effect if the port is a transparent port that is linked on the inside to a multiport.  In that case, the port is a multiport regardless of whether and how this method is called. This method is write-synchronized on the workspace.
 * @param isMulitport True to make the port a multiport.
 */
public void setMultiport(boolean isMulitport){
  _workspace.getWriteAccess();
  _isMulitport=isMulitport;
  _workspace.doneWriting();
}
Program: 76211
Project: 76211
Buggy source:
/** 
 * Write a MoML description of the contents of this object, which in this class is the attributes plus possibly a special attribute to indicate whether the port is a multiport.  This method is called by _exportMoML().  If there are attributes, then each attribute description is indented according to the specified depth and terminated with a newline character.
 * @param output The output stream to write to.
 * @param depth The depth in the hierarchy, to determine indenting.
 * @exception IOException If an I/O error occurs.
 */
protected void _exportMoMLContents(Writer output,int depth) throws IOException {
  if (_isinput) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str");
  }
  if (_isoutput) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str");
  }
  if (_ismultiport) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str");
  }
  super._exportMoMLContents(output,depth);
}

Fixed version (ground truth):
/** 
 * Write a MoML description of the contents of this object, which in this class is the attributes plus possibly a special attribute to indicate whether the port is a multiport.  This method is called by _exportMoML().  If there are attributes, then each attribute description is indented according to the specified depth and terminated with a newline character.
 * @param output The output stream to write to.
 * @param depth The depth in the hierarchy, to determine indenting.
 * @exception IOException If an I/O error occurs.
 */
protected void _exportMoMLContents(Writer output,int depth) throws IOException {
  if (_isInput) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str");
  }
  if (_isOutput) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str");
  }
  if (_isMulitport) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str");
  }
  super._exportMoMLContents(output,depth);
}
Program: 76212
Project: 76212
Buggy source:
/** 
 * Return true if the port is a multiport.  The port is a multiport if setMultiport() has been called with a true argument.
 * @return True if the port is a multiport.
 */
public boolean isMultiport(){
  return _ismultiport;
}

Fixed version (ground truth):
/** 
 * Return true if the port is a multiport.  The port is a multiport if setMultiport() has been called with a true argument.
 * @return True if the port is a multiport.
 */
public boolean isMultiport(){
  return _isMulitport;
}
Program: 76213
Project: 76213
Buggy source:
/** 
 * If the argument is true, make the port an input port. If the argument is false, make the port not an input port. This has no effect if the port is a transparent port. In that case, the port is an input port regardless of whether and how this method is called. This method is write-synchronized on the workspace.
 * @param isinput True to make the port an input.
 */
public void setInput(boolean isinput){
  _workspace.getWriteAccess();
  _isinput=isinput;
  _workspace.doneWriting();
}

Fixed version (ground truth):
/** 
 * If the argument is true, make the port an input port. If the argument is false, make the port not an input port. This has no effect if the port is a transparent port. In that case, the port is an input port regardless of whether and how this method is called. This method is write-synchronized on the workspace.
 * @param isInput True to make the port an input.
 */
public void setInput(boolean isInput){
  _workspace.getWriteAccess();
  _isInput=isInput;
  _workspace.doneWriting();
}
Program: 76214
Project: 76214
Buggy source:
/** 
 * Return true if the port is an output. The port is an output if either setOutput() has been called with a true argument, or it is connected on the inside to an output port, or it is connected on the inside to the inside of an input port. This method is read-synchronized on the workspace.
 * @return True if the port is an output.
 */
public boolean isOutput(){
  long version=_workspace.getVersion();
  if (_insideoutputversion != version) {
    try {
      _workspace.getReadAccess();
      Iterator ports=deepInsidePortList().iterator();
      while (ports.hasNext()) {
        IOPort p=(IOPort)ports.next();
        if (p != this && p.isOutput())         _isoutput=true;
      }
      _insideoutputversion=version;
    }
  finally {
      _workspace.doneReading();
    }
  }
  return _isoutput;
}

Fixed version (ground truth):
/** 
 * Return true if the port is an output. The port is an output if either setOutput() has been called with a true argument, or it is connected on the inside to an output port, or it is connected on the inside to the inside of an input port. This method is read-synchronized on the workspace.
 * @return True if the port is an output.
 */
public boolean isOutput(){
  long version=_workspace.getVersion();
  if (_insideoutputversion != version) {
    try {
      _workspace.getReadAccess();
      Iterator ports=deepInsidePortList().iterator();
      while (ports.hasNext()) {
        IOPort p=(IOPort)ports.next();
        if (p != this && p.isOutput())         _isOutput=true;
      }
      _insideoutputversion=version;
    }
  finally {
      _workspace.doneReading();
    }
  }
  return _isOutput;
}
Program: 76215
Project: 76215
Buggy source:
/** 
 * Return true if the specified channel has a token to deliver via the get() method.  If this port is not an input, or if the channel index is out of range, then throw an exception. Note that this does not report any tokens in inside receivers of an output port. Those are accessible only through getInsideReceivers().
 * @param channelindex The channel index.
 * @return True if there is a token in the channel.
 * @exception IllegalActionException If the receivers do not supportthis query, if there is no director, and hence no receivers, if the port is not an input port, or if the channel index is out of range.
 */
public boolean hasToken(int channelindex) throws IllegalActionException {
  try {
    Receiver[][] recs=getReceivers();
    if (recs == null || recs[channelindex] == null) {
      return false;
    }
    for (int j=0; j < recs[channelindex].length; j++) {
      if (recs[channelindex][j].hasToken())       return true;
    }
  }
 catch (  ArrayIndexOutOfBoundsException ex) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Return true if the specified channel has a token to deliver via the get() method.  If this port is not an input, or if the channel index is out of range, then throw an exception. Note that this does not report any tokens in inside receivers of an output port. Those are accessible only through getInsideReceivers().
 * @param channelIndex The channel index.
 * @return True if there is a token in the channel.
 * @exception IllegalActionException If the receivers do not supportthis query, if there is no director, and hence no receivers, if the port is not an input port, or if the channel index is out of range.
 */
public boolean hasToken(int channelIndex) throws IllegalActionException {
  try {
    Receiver[][] recs=getReceivers();
    if (recs == null || recs[channelIndex] == null) {
      return false;
    }
    for (int j=0; j < recs[channelIndex].length; j++) {
      if (recs[channelIndex][j].hasToken())       return true;
    }
  }
 catch (  ArrayIndexOutOfBoundsException ex) {
    throw new IllegalActionException(this,"String_Node_Str");
  }
  return false;
}
Program: 76217
Project: 76217
Buggy source:
/** 
 * Construct a TypedIOPort 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 TypedActor 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 TypedActor interface.
 * @exception NameDuplicationException If the name coincides witha port already in the container.
 */
public TypedIOPort(ComponentEntity container,String name,boolean isinput,boolean isoutput) throws IllegalActionException, NameDuplicationException {
  super(container,name,isinput,isoutput);
}

Fixed version (ground truth):
/** 
 * Construct a TypedIOPort 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 TypedActor 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 TypedActor interface.
 * @exception NameDuplicationException If the name coincides witha port already in the container.
 */
public TypedIOPort(ComponentEntity container,String name,boolean isInput,boolean isOutput) throws IllegalActionException, NameDuplicationException {
  super(container,name,isInput,isOutput);
}
Program: 76219
Project: 76219
Buggy source:
/** 
 * Read <i>tokenConsumptionRate</i> tokens from each channel. Write these tokens to a sound file and/or send them to the speaker, depending on the current mode, which is determined by the value of <i>sink</i>.
 * @exception IllegalActionException If there is no director.
 */
public boolean postfire() throws IllegalActionException {
  for (int j=0; j < _channels; j++) {
    DoubleToken[] audioTokenArray=new DoubleToken[_consumptionRate];
    input.getArray(j,audioTokenArray);
    for (int i=0; i < _consumptionRate; i++) {
      _audioInDoubleArray[j][i]=audioTokenArray[i].doubleValue();
    }
  }
  _soundPlayback.putSamples(_audioInDoubleArray);
  return true;
}

Fixed version (ground truth):
/** 
 * Read <i>tokenConsumptionRate</i> tokens from each channel. Write these tokens to a sound file and/or send them to the speaker, depending on the current mode, which is determined by the value of <i>sink</i>.
 * @exception IllegalActionException If there is no director.
 */
public boolean postfire() throws IllegalActionException {
  for (int j=0; j < _channels; j++) {
    input.getArray(j,_audioTokenArray);
    for (int i=0; i < _consumptionRate; i++) {
      _audioInDoubleArray[j][i]=_audioTokenArray[i].doubleValue();
    }
  }
  _soundPlayback.putSamples(_audioInDoubleArray);
  return true;
}
Program: 76221
Project: 76221
Buggy source:
/** 
 * Output sample values of the sound file. Semantically, only one token (a DoubleToken) is output. In the actual implementation, however, the number of tokens output is equal to the token production rate.
 * @return True if there are samples available from theaudio source. False if there are no more samples (end of sound file reached).
 */
public boolean postfire() throws IllegalActionException {
  _audioInDoubleArray=_soundCapture.getSamples();
  if (_audioInDoubleArray != null) {
    for (int j=0; j < _channels; j++) {
      _audioTokenArray=new DoubleToken[_productionRate];
      for (int i=0; i < _productionRate; i++) {
        _audioTokenArray[i]=new DoubleToken(_audioInDoubleArray[j][i]);
      }
      output.sendArray(j,_audioTokenArray);
    }
    return true;
  }
 else {
    _audioTokenArray=new DoubleToken[_productionRate];
    for (int i=0; i < _productionRate; i++) {
      _audioTokenArray[i]=new DoubleToken(0);
    }
    for (int j=0; j < _channels; j++) {
      output.sendArray(j,_audioTokenArray);
    }
    System.out.println("String_Node_Str");
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Output sample values of the sound file. Semantically, only one token (a DoubleToken) is output. In the actual implementation, however, the number of tokens output is equal to the token production rate.
 * @return True if there are samples available from theaudio source. False if there are no more samples (end of sound file reached).
 */
public boolean postfire() throws IllegalActionException {
  _audioInDoubleArray=_soundCapture.getSamples();
  if (_audioInDoubleArray != null) {
    for (int j=0; j < _channels; j++) {
      for (int i=0; i < _productionRate; i++) {
        _audioTokenArray[i]=new DoubleToken(_audioInDoubleArray[j][i]);
      }
      output.sendArray(j,_audioTokenArray);
    }
    return true;
  }
 else {
    for (int i=0; i < _productionRate; i++) {
      _audioTokenArray[i]=new DoubleToken(0);
    }
    for (int j=0; j < _channels; j++) {
      output.sendArray(j,_audioTokenArray);
    }
    System.out.println("String_Node_Str");
    return false;
  }
}
Program: 76223
Project: 76223
Buggy source:
/** 
 * 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);
}

Fixed version (ground truth):
/** 
 * Output the sample value of the sound file corresponding to the current index.
 */
public void fire() throws IllegalActionException {
}
Program: 76224
Project: 76224
Buggy source:
/** 
 * Clone the actor 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 composite actor with clones of the ports of the original actor, the contained actors, and the contained relations. The ports of the returned actor are not connected to anything. The connections of the relations are duplicated in the new composite, unless they cross levels, in which case an exception is thrown. The local director is cloned, if there is one. The executive director is not cloned. NOTE: This will not work if there are level-crossing transitions.
 * @param ws The workspace for the cloned object.
 * @exception CloneNotSupportedException If the actor containslevel crossing transitions so that its connections cannot be cloned, or if one of the attributes cannot be cloned.
 * @return A new CompositeActor.
 */
public Object clone(Workspace ws) throws CloneNotSupportedException {
  CompositeActor newobj=(CompositeActor)super.clone(ws);
  if (_director != null) {
    newobj._director=(Director)_director.clone();
  }
 else {
    newobj._director=null;
  }
  newobj._inputPortsVersion=-1;
  newobj._outputPortsVersion=-1;
  return newobj;
}

Fixed version (ground truth):
/** 
 * Clone the actor 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 composite actor with clones of the ports of the original actor, the contained actors, and the contained relations. The ports of the returned actor are not connected to anything. The connections of the relations are duplicated in the new composite, unless they cross levels, in which case an exception is thrown. The local director is cloned, if there is one. The executive director is not cloned. NOTE: This will not work if there are level-crossing transitions.
 * @param ws The workspace for the cloned object.
 * @exception CloneNotSupportedException If the actor containslevel crossing transitions so that its connections cannot be cloned, or if one of the attributes cannot be cloned.
 * @return A new CompositeActor.
 */
public Object clone(Workspace ws) throws CloneNotSupportedException {
  CompositeActor newobj=(CompositeActor)super.clone(ws);
  if (_director != null) {
    newobj._director=(Director)_director.clone();
    newobj._director._makeDirectorOf(newobj);
  }
 else {
    newobj._director=null;
  }
  newobj._inputPortsVersion=-1;
  newobj._outputPortsVersion=-1;
  return newobj;
}
Program: 76225
Project: 76225
Buggy source:
/** 
 * Return the name of this document factory.
 */
public String getName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Return a string which is the name associated with this document factory.
 */
public String getName(){
  return "String_Node_Str";
}
Program: 76227
Project: 76227
Buggy source:
/** 
 * Parse the xml libraries
 */
public void parseLibraries(){
  URL iconlibURL=null;
  URL entitylibURL=null;
  try {
    iconlibURL=getGUIResources().getResource("String_Node_Str");
    entitylibURL=getGUIResources().getResource("String_Node_Str");
    MoMLParser parser;
    parser=new MoMLParser();
    _iconLibrary=(CompositeEntity)parser.parse(iconlibURL,iconlibURL.openStream());
    LibraryIcon.setIconLibrary(_iconLibrary);
    parser=new MoMLParser();
    _entityLibrary=(CompositeEntity)parser.parse(entitylibURL,entitylibURL.openStream());
  }
 catch (  Exception e) {
    System.out.println(e);
  }
}

Fixed version (ground truth):
/** 
 * Parse the entity and icon xml libraries.  Set the entity and icon libraries for this application.
 */
public void parseLibraries(){
  URL iconlibURL=null;
  URL entitylibURL=null;
  try {
    iconlibURL=getGUIResources().getResource("String_Node_Str");
    entitylibURL=getGUIResources().getResource("String_Node_Str");
    MoMLParser parser;
    parser=new MoMLParser();
    _iconLibrary=(CompositeEntity)parser.parse(iconlibURL,iconlibURL.openStream());
    LibraryIcon.setIconLibrary(_iconLibrary);
    parser=new MoMLParser();
    _entityLibrary=(CompositeEntity)parser.parse(entitylibURL,entitylibURL.openStream());
  }
 catch (  Exception e) {
    System.out.println(e);
  }
}
Program: 76228
Project: 76228
Buggy source:
/** 
 * Create and run a new graph application
 */
public static void main(String argv[]){
  VergilApplication ge=new VergilApplication();
  ge.setVisible(true);
}

Fixed version (ground truth):
/** 
 * Create and run a new graph application.
 */
public static void main(String argv[]){
  VergilApplication ge=new VergilApplication();
  ge.setVisible(true);
}
Program: 76229
Project: 76229
Buggy source:
/** 
 * Get the title of this application
 */
public String getTitle(){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Get the title of this application.  Return the string "Vergil".
 */
public String getTitle(){
  return "String_Node_Str";
}
Program: 76230
Project: 76230
Buggy source:
/** 
 * Remove a factory that creates new documents for use by subclasses constructors only.
 */
protected void removeDocumentFactory(VergilDocumentFactory df){
  int index=_documentFactoryList.indexOf(df);
  _documentFactoryList.remove(df);
  _fileNewMenu.remove(_fileNewMenu.getItem(index));
}

Fixed version (ground truth):
/** 
 * Remove the given factory that creates new documents from this application.  Remove its entry in the file->new menu.
 */
protected void removeDocumentFactory(VergilDocumentFactory df){
  int index=_documentFactoryList.indexOf(df);
  _documentFactoryList.remove(df);
  _fileNewMenu.remove(_fileNewMenu.getItem(index));
}
Program: 76231
Project: 76231
Buggy source:
/** 
 * Return the icon library associated with this Vergil
 */
public CompositeEntity getIconLibrary(){
  return _iconLibrary;
}

Fixed version (ground truth):
/** 
 * Return the icon library associated with this Vergil.
 */
public CompositeEntity getIconLibrary(){
  return _iconLibrary;
}
Program: 76232
Project: 76232
Buggy source:
/** 
 * Set the given document to be the current document, and raise the internal window that corresponds to that component. In this class, there are some things that we want to enable and disable if there are no documents present.
 */
public void setCurrentDocument(Document d){
  super.setCurrentDocument(d);
  if (d == null) {
    Action saveAction=getAction(DefaultActions.SAVE);
    saveAction.setEnabled(false);
    Action saveAsAction=getAction(DefaultActions.SAVE_AS);
    saveAsAction.setEnabled(false);
  }
 else {
    Action saveAction=getAction(DefaultActions.SAVE);
    saveAction.setEnabled(true);
    Action saveAsAction=getAction(DefaultActions.SAVE_AS);
    saveAsAction.setEnabled(true);
  }
}

Fixed version (ground truth):
/** 
 * Set the given document to be the current document, and raise the internal window that corresponds to that component. If there are no documents present, then disable the appropriate  menu entries.
 */
public void setCurrentDocument(Document d){
  super.setCurrentDocument(d);
  if (d == null) {
    Action saveAction=getAction(DefaultActions.SAVE);
    saveAction.setEnabled(false);
    Action saveAsAction=getAction(DefaultActions.SAVE_AS);
    saveAsAction.setEnabled(false);
  }
 else {
    Action saveAction=getAction(DefaultActions.SAVE);
    saveAction.setEnabled(true);
    Action saveAsAction=getAction(DefaultActions.SAVE_AS);
    saveAsAction.setEnabled(true);
  }
}
Program: 76233
Project: 76233
Buggy source:
/** 
 * Return the document factory with the given name. public DocumentFactory getDocumentFactory(name) {  return (DocumentFactory)_documentFactoryList.get(name); } /** Return the entity library for this application.
 */
public CompositeEntity getEntityLibrary(){
  return _entityLibrary;
}

Fixed version (ground truth):
/** 
 * Return the entity library for this application.
 */
public CompositeEntity getEntityLibrary(){
  return _entityLibrary;
}
Program: 76234
Project: 76234
Buggy source:
/** 
 * Add a factory that creates new documents.  The factory will appear in the list of factories with the given name.
 */
protected void addDocumentFactory(VergilDocumentFactory df){
  _documentFactoryList.add(df);
  _fileNewMenu.add(df.getName());
}

Fixed version (ground truth):
/** 
 * Add the factory that creates new documents.  Also add create a new action and add it to the file->new menu that will create documents with the given factory.
 */
protected void addDocumentFactory(VergilDocumentFactory df){
  final VergilDocumentFactory factory=df;
  final VergilApplication app=this;
  _documentFactoryList.add(factory);
  Action action=new AbstractAction(factory.getName()){
    public void actionPerformed(    ActionEvent e){
      Document doc=factory.createDocument(app);
      addDocument(doc);
      displayDocument(doc);
      setCurrentDocument(doc);
    }
  }
;
  _fileNewMenu.add(action);
}
Program: 76235
Project: 76235
Buggy source:
/** 
 * Redisplay a document after it appears on the screen. This method should be overridden by applications that need to perform some form of update when the component appears on the screen. This class executes a graph layout algorithm on the document
 */
public void redisplay(Document d,JComponent c){
  JGraph jgraph=(JGraph)c;
}

Fixed version (ground truth):
/** 
 * Redisplay a document after it appears on the screen. In this class, do nothing.
 */
public void redisplay(Document d,JComponent c){
  JGraph jgraph=(JGraph)c;
}
Program: 76237
Project: 76237
Buggy source:
/** 
 * Add a menu to the menu bar of this application.
 */
public void addMenu(JMenu menu){
  JFrame frame=getApplicationFrame();
  if (frame == null)   return;
  JMenuBar menuBar=frame.getJMenuBar();
  menuBar.add(menu);
}

Fixed version (ground truth):
/** 
 * Add the menu to the menu bar of this application.
 */
public void addMenu(JMenu menu){
  JFrame frame=getApplicationFrame();
  if (frame == null)   return;
  JMenuBar menuBar=frame.getJMenuBar();
  menuBar.add(menu);
}
Program: 76238
Project: 76238
Buggy source:
/** 
 * Remove the menu to the menu bar of this application.
 */
public void removeMenu(JMenu menu){
  JFrame frame=getApplicationFrame();
  if (frame == null)   return;
  JMenuBar menuBar=frame.getJMenuBar();
  menuBar.remove(menu);
}

Fixed version (ground truth):
/** 
 * Remove the given menu from the menu bar of this application.
 */
public void removeMenu(JMenu menu){
  JFrame frame=getApplicationFrame();
  if (frame == null)   return;
  JMenuBar menuBar=frame.getJMenuBar();
  menuBar.remove(menu);
}
Program: 76239
Project: 76239
Buggy source:
public void createTreeNodes(JTreePane pane,String parent,CompositeEntity library){
  Iterator entities=library.entityList().iterator();
  int i=0;
  while (entities.hasNext()) {
    Entity entity=(Entity)entities.next();
    if (!(entity instanceof CompositeEntity)) {
      GraphPalette palette=(GraphPalette)pane.getComponentAt(library.getFullName());
      ptolemy.moml.Icon icon=(ptolemy.moml.Icon)entity.getAttribute("String_Node_Str");
      palette.addNode(icon,60,50 + (i++) * 50);
    }
    if (entity instanceof CompositeEntity) {
      GraphPalette palette=new GraphPalette();
      pane.addEntry(parent,entity.getFullName(),palette);
      createTreeNodes(pane,entity.getFullName(),(CompositeEntity)entity);
    }
  }
}

Fixed version (ground truth):
/** 
 * Populate the tree pane with icons for each entity in the given composite entity.
 * @param pane The tree pane.
 * @param parent The name of the node in the tree to add the icons to.
 * @param library The composite entity to add icons for.
 */
public void createTreeNodes(JTreePane pane,String parent,CompositeEntity library){
  Iterator entities=library.entityList().iterator();
  int i=0;
  while (entities.hasNext()) {
    Entity entity=(Entity)entities.next();
    if (!(entity instanceof CompositeEntity)) {
      GraphPalette palette=(GraphPalette)pane.getComponentAt(library.getFullName());
      ptolemy.moml.Icon icon=(ptolemy.moml.Icon)entity.getAttribute("String_Node_Str");
      palette.addNode(icon,60,50 + (i++) * 50);
    }
    if (entity instanceof CompositeEntity) {
      GraphPalette palette=new GraphPalette();
      pane.addEntry(parent,entity.getFullName(),palette);
      createTreeNodes(pane,entity.getFullName(),(CompositeEntity)entity);
    }
  }
}
Program: 76240
Project: 76240
Buggy source:
public void contentsChanged(ListDataEvent e){
  System.out.println("String_Node_Str");
  VergilDocument document=(VergilDocument)getCurrentDocument();
  if (document == null)   return;
  JComponent component=getView(document);
  if (component == null)   return;
  if (!component.hasFocus()) {
    component.requestFocus();
  }
}

Fixed version (ground truth):
public void contentsChanged(ListDataEvent e){
  VergilDocument document=(VergilDocument)getCurrentDocument();
  if (document == null)   return;
  JComponent component=getView(document);
  if (component == null)   return;
  if (!component.hasFocus()) {
    component.requestFocus();
  }
}
Program: 76241
Project: 76241
Buggy source:
/** 
 * Return the name of this Factory
 */
public String getName();

Fixed version (ground truth):
/** 
 * Return a string which is the name associated with this document factory.
 */
public String getName();
Program: 76243
Project: 76243
Buggy source:
/** 
 * Begin capturing audio. This method must be invoked prior to the first invocation of <i>getSamples</i>. This method must not be called more than once between invocations of <i>stopAudio()</i>.
 */
public void startCapture(){
  System.out.println("String_Node_Str");
  if (_constructorWasCalled != true) {
    System.out.println("String_Node_Str");
  }
  if (_isRealTime == true) {
    _startCaptureRealTime();
  }
 else {
    _startCaptureFromFile();
  }
}

Fixed version (ground truth):
/** 
 * Begin capturing audio. This method must be invoked prior to the first invocation of <i>getSamples</i>. This method must not be called more than once between invocations of <i>stopAudio()</i>.
 */
public void startCapture(){
  if (_isRealTime == true) {
    _startCaptureRealTime();
  }
 else {
    _startCaptureFromFile();
  }
}
Program: 76244
Project: 76244
Buggy source:
/** 
 * Construct a sound capture object. This constructor creates an object that captures audio from a sound file.
 * @param isURL True means that a URL to a file is given. False meansthat the file name specifies the location of the file on the local filesystem.
 * @param fileName The name of the file. This can be either a URLfile name or a local file sytem file name.
 * @param getSamplesSize Size of the array returned by<i>getSamples()</i>.
 */
public SoundCapture(boolean isURL,String fileName,int getSamplesSize){
  System.out.println("String_Node_Str");
  this._isRealTime=false;
  this._isURL=isURL;
  this._fileName=fileName;
  this._productionRate=getSamplesSize;
  this._constructorWasCalled=true;
}

Fixed version (ground truth):
/** 
 * Construct a sound capture object. This constructor creates an object that captures audio from a sound file.
 * @param isURL True means that a URL to a file is given. False meansthat the file name specifies the location of the file on the local filesystem.
 * @param fileName The name of the file. This can be either a URLfile name or a local file sytem file name.
 * @param getSamplesSize Size of the array returned by<i>getSamples()</i>.
 */
public SoundCapture(boolean isURL,String fileName,int getSamplesSize){
  System.out.println("String_Node_Str");
  this._isRealTime=false;
  this._isURL=isURL;
  this._fileName=fileName;
  this._productionRate=getSamplesSize;
}
Program: 76245
Project: 76245
Buggy source:
/** 
 * Construct a SqrtRaisedCosineSampleGenerator.
 * @param firstZeroCrossing The time of the first zero crossing ofthe corresponding raised cosine pulse.
 * @param excess The excess bandwidth of the corresponding raisedcosine pulse.
 */
public SqrtRaisedCosineSampleGenerator(double firstZeroCrossing,double excess){
  _excess=excess;
  _oneOverFZC=1.0 / firstZeroCrossing;
  _sqrtFZC=Math.sqrt(firstZeroCrossing);
  _squareFZC=firstZeroCrossing * firstZeroCrossing;
  _onePlus=(1.0 + _excess) * Math.PI * _oneOverFZC;
  _oneMinus=(1.0 - _excess) * Math.PI * _oneOverFZC;
  _fourExcess=4.0 * _excess;
  _eightExcessPI=8.0 * _excess * Math.PI;
  _sixteenExcess=16.0 * _excess;
  _sampleAtZero=((_fourExcess / Math.PI) + 1.0 - _excess) / _sqrtFZC;
  _fourExcessOverPISqrtFZC=_fourExcess / (Math.PI * _sqrtFZC);
  _fzcSqrtFZCOverEightExcessPI=firstZeroCrossing * _sqrtFZC / _eightExcessPI;
  _fzcOverFourExcess=firstZeroCrossing / _fourExcess;
  _oneMinusFZCOverFourExcess=_oneMinus * firstZeroCrossing / _fourExcess;
}

Fixed version (ground truth):
/** 
 * Construct a SqrtRaisedCosineSampleGenerator.
 * @param firstZeroCrossing The time of the first zero crossing ofthe corresponding raised cosine pulse.
 * @param excess The excess bandwidth of the corresponding raisedcosine pulse.
 */
public SqrtRaisedCosineSampleGenerator(double firstZeroCrossing,double excess){
  _excess=excess;
  _oneOverFZC=1.0 / firstZeroCrossing;
  _sqrtFZC=Math.sqrt(firstZeroCrossing);
  _squareFZC=firstZeroCrossing * firstZeroCrossing;
  _onePlus=(1.0 + _excess) * Math.PI * _oneOverFZC;
  _oneMinus=(1.0 - _excess) * Math.PI * _oneOverFZC;
  _fourExcess=4.0 * _excess;
  _eightExcessPI=8.0 * _excess * Math.PI;
  _sixteenExcessSquared=_fourExcess * _fourExcess;
  double fourExcessOverPI=_fourExcess / Math.PI;
  double oneOverSqrtFZC=1.0 / _sqrtFZC;
  _sampleAtZero=(fourExcessOverPI + 1.0 - _excess) * oneOverSqrtFZC;
  _fourExcessOverPISqrtFZC=fourExcessOverPI * oneOverSqrtFZC;
  _fzcSqrtFZCOverEightExcessPI=firstZeroCrossing * _sqrtFZC / _eightExcessPI;
  _fzcOverFourExcess=firstZeroCrossing / _fourExcess;
  _oneMinusFZCOverFourExcess=_oneMinus * _fzcOverFourExcess;
}
Program: 76246
Project: 76246
Buggy source:
public final double sampleAt(double time){
  if (time == 0.0) {
    return _sampleAtZero;
  }
  double x=time * _oneOverFZC;
  if (_excess == 0.0) {
    return _sqrtFZC * Math.sin(Math.PI * x) / (Math.PI * time);
  }
  double squareTime=time * time;
  double oneMinusTime=_oneMinus * time;
  double onePlusTime=_onePlus * time;
  double denominator=squareTime * _sixteenExcess - _squareFZC;
  if (close(denominator,0.0)) {
    double oneOverTime=1.0 / time;
    return _fzcSqrtFZCOverEightExcessPI * oneOverTime * (_onePlus * Math.sin(onePlusTime) - _oneMinusFZCOverFourExcess * oneOverTime * Math.cos(oneMinusTime) + _fzcOverFourExcess * squareTime * Math.sin(oneMinusTime));
  }
  return _fourExcessOverPISqrtFZC * (Math.cos(onePlusTime) + Math.sin(oneMinusTime) / (x * _fourExcess)) / (1.0 - _sixteenExcess * x * x);
}

Fixed version (ground truth):
public final double sampleAt(double time){
  if (time == 0.0) {
    return _sampleAtZero;
  }
  double x=time * _oneOverFZC;
  if (_excess == 0.0) {
    return _sqrtFZC * Math.sin(Math.PI * x) / (Math.PI * time);
  }
  double oneMinusTime=_oneMinus * time;
  double onePlusTime=_onePlus * time;
  double denominator=time * time * _sixteenExcessSquared - _squareFZC;
  if (close(denominator,0.0)) {
    double oneOverTime=1.0 / time;
    double oneOverTimeSquared=oneOverTime * oneOverTime;
    return _fzcSqrtFZCOverEightExcessPI * oneOverTime * (_onePlus * Math.sin(onePlusTime) - _oneMinusFZCOverFourExcess * oneOverTime * Math.cos(oneMinusTime) + _fzcOverFourExcess * oneOverTimeSquared * Math.sin(oneMinusTime));
  }
  return _fourExcessOverPISqrtFZC * (Math.cos(onePlusTime) + Math.sin(oneMinusTime) / (x * _fourExcess)) / (1.0 - _sixteenExcessSquared * x * x);
}
Program: 76249
Project: 76249
Buggy source:
/** 
 * Return a token from the queue. If no token is available, then throw a NoTokenException. If at any point during this method this receiver is scheduled for termination, then throw a TerminateProcessException to cease execution of the actor that contains this receiver. <P> IMPORTANT: This method is designed to be called after hasToken() has been called. Verify that this method is safe to call by calling hasToken() first. Note that this method does not perform a blocking read but hasToken() does.
 * @return The oldest token on this queue.
 * @exception NoTokenException If this method is called whilehasToken() returns false.
 * @see hasToken()
 */
public Token get() throws NoTokenException {
  DDEDirector director=(DDEDirector)((Actor)getContainer().getContainer()).getDirector();
synchronized (this) {
    if (_terminate) {
      throw new TerminateProcessException("String_Node_Str");
    }
    Token token=super.get();
    if (_writePending) {
      director.removeWriteBlock(this);
      _writePending=false;
      notifyAll();
    }
    Thread thread=Thread.currentThread();
    if (thread instanceof DDEThread) {
      TimeKeeper timeKeeper=((DDEThread)thread).getTimeKeeper();
      timeKeeper.sendOutNullTokens(this);
    }
    return token;
  }
}

Fixed version (ground truth):
/** 
 * Return a token from the queue. If no token is available, then throw a NoTokenException. If at any point during this method this receiver is scheduled for termination, then throw a TerminateProcessException to cease execution of the actor that contains this receiver. <P> IMPORTANT: This method is designed to be called after hasToken() has been called. Verify that this method is safe to call by calling hasToken() first. Note that this method does not perform a blocking read but hasToken() does.
 * @return The oldest token on this queue.
 * @exception NoTokenException If this method is called whilehasToken() returns false.
 * @see #hasToken()
 */
public Token get() throws NoTokenException {
  DDEDirector director=(DDEDirector)((Actor)getContainer().getContainer()).getDirector();
synchronized (this) {
    if (_terminate) {
      throw new TerminateProcessException("String_Node_Str");
    }
    Token token=super.get();
    if (_writePending) {
      director.removeWriteBlock(this);
      _writePending=false;
      notifyAll();
    }
    Thread thread=Thread.currentThread();
    if (thread instanceof DDEThread) {
      TimeKeeper timeKeeper=((DDEThread)thread).getTimeKeeper();
      timeKeeper.sendOutNullTokens(this);
    }
    return token;
  }
}
Program: 76253
Project: 76253
Buggy source:
/** 
 * Return true if this is an embedded director and the current fire is successful. The success is determined by asking all the step size control actors in the output schedule. If this is a top level director, then return true always.
 * @return True if the current step is successful.
 */
public boolean isThisStepSuccessful(){
  try {
    if (!_isStateAcceptable()) {
      _stateAcceptable=false;
      return false;
    }
 else     if (!_isOutputAcceptable()) {
      _outputAcceptable=false;
      return false;
    }
 else {
      _stateAcceptable=true;
      _outputAcceptable=true;
      return true;
    }
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Return true if this is an embedded director and the current fire is successful. The success is determined by asking all the step size control actors in the output schedule. If this is a top level director, then return true always.
 * @return True if the current step is successful.
 */
public boolean isThisStepSuccessful(){
  try {
    _debug(getName() + "String_Node_Str");
    if (!_isStateAcceptable()) {
      _stateAcceptable=false;
      return false;
    }
 else     if (!_isOutputAcceptable()) {
      _outputAcceptable=false;
      return false;
    }
 else {
      _stateAcceptable=true;
      _outputAcceptable=true;
      return true;
    }
  }
 catch (  IllegalActionException ex) {
    throw new InternalErrorException("String_Node_Str" + ex.getMessage());
  }
}
Program: 76255
Project: 76255
Buggy source:
/** 
 * Return true if the newly resolved state is acceptable. It does it by asking all the step control actors in the state transition and dynamic schedule. If one of them returns false, then the method returns false.
 * @exception IllegalActionException If the scheduler throws it.
 */
protected boolean _isStateAcceptable() throws IllegalActionException {
  boolean successful=true;
  CTScheduler sched=(CTScheduler)getScheduler();
  Iterator sscs=sched.stateTransitionSSCActorList().iterator();
  while (sscs.hasNext()) {
    CTStepSizeControlActor a=(CTStepSizeControlActor)sscs.next();
    successful=successful && a.isThisStepSuccessful();
  }
  return successful;
}

Fixed version (ground truth):
/** 
 * Return true if the newly resolved state is acceptable. It does it by asking all the step control actors in the state transition and dynamic schedule. If one of them returns false, then the method returns false.
 * @exception IllegalActionException If the scheduler throws it.
 */
protected boolean _isStateAcceptable() throws IllegalActionException {
  boolean successful=true;
  CTScheduler sched=(CTScheduler)getScheduler();
  Iterator sscs=sched.stateTransitionSSCActorList().iterator();
  while (sscs.hasNext()) {
    CTStepSizeControlActor a=(CTStepSizeControlActor)sscs.next();
    if (_debugging)     _debug("String_Node_Str" + ((NamedObj)a).getName());
    successful=successful && a.isThisStepSuccessful();
  }
  return successful;
}
Program: 76256
Project: 76256
Buggy source:
/** 
 * Return true if the newly resolved state is acceptable. It does it by asking all the step control actors in the state transition and dynamic schedule. If one of them returns false, then the method returns false.
 * @exception IllegalActionException If the scheduler throws it.
 */
protected boolean _isOutputAcceptable() throws IllegalActionException {
  boolean successful=true;
  CTScheduler sched=(CTScheduler)getScheduler();
  Iterator sscs=sched.outputSSCActorList().iterator();
  while (sscs.hasNext()) {
    CTStepSizeControlActor a=(CTStepSizeControlActor)sscs.next();
    successful=successful && a.isThisStepSuccessful();
  }
  return successful;
}

Fixed version (ground truth):
/** 
 * Return true if the newly resolved state is acceptable. It does it by asking all the step control actors in the state transition and dynamic schedule. If one of them returns false, then the method returns false.
 * @exception IllegalActionException If the scheduler throws it.
 */
protected boolean _isOutputAcceptable() throws IllegalActionException {
  boolean successful=true;
  CTScheduler sched=(CTScheduler)getScheduler();
  Iterator sscs=sched.outputSSCActorList().iterator();
  while (sscs.hasNext()) {
    System.out.println("String_Node_Str");
    CTStepSizeControlActor a=(CTStepSizeControlActor)sscs.next();
    if (_debugging)     _debug("String_Node_Str" + ((NamedObj)a).getName());
    successful=successful && a.isThisStepSuccessful();
  }
  return successful;
}
Program: 76257
Project: 76257
Buggy source:
/** 
 * Consume the input token and the trigger token. The trigger token will be used for finding the zero crossing in isThisStepSuccessful() method.
 * @exception IllegalActionException If no token is available.
 */
public void fire() throws IllegalActionException {
  _thisTrg=((DoubleToken)trigger.get(0)).doubleValue();
  _debug(getFullName() + "String_Node_Str" + _thisTrg);
  _inputToken=input.get(0);
}

Fixed version (ground truth):
/** 
 * Consume the input token and the trigger token. The trigger token will be used for finding the zero crossing in isThisStepSuccessful() method.
 * @exception IllegalActionException If no token is available.
 */
public void fire() throws IllegalActionException {
  _thisTrg=((DoubleToken)trigger.get(0)).doubleValue();
  if (_debugging)   _debug(getFullName() + "String_Node_Str" + _thisTrg);
  _inputToken=input.get(0);
}
Program: 76258
Project: 76258
Buggy source:
/** 
 * Emit the event at current time if there is any. There will be no current event after emitting it. If there is no current event, do nothing.
 * @exception IllegalActionException If the event cannot be broadcasted.
 */
public void emitCurrentEvents() throws IllegalActionException {
  _debug(this.getFullName() + "String_Node_Str");
  if (_eventNow) {
    _debug(getFullName() + "String_Node_Str" + _inputToken.toString());
    output.broadcast(_inputToken);
    _eventNow=false;
  }
}

Fixed version (ground truth):
/** 
 * Emit the event at current time if there is any. There will be no current event after emitting it. If there is no current event, do nothing.
 * @exception IllegalActionException If the event cannot be broadcasted.
 */
public void emitCurrentEvents() throws IllegalActionException {
  if (_debugging)   _debug(this.getFullName() + "String_Node_Str");
  if (_eventNow) {
    if (_debugging)     _debug(getFullName() + "String_Node_Str" + _inputToken.toString());
    output.broadcast(_inputToken);
    _eventNow=false;
  }
}
Program: 76259
Project: 76259
Buggy source:
/** 
 * Set up parameters and internal state, so that it has no history before the first firing.
 * @exception IllegalActionException If thrown by the super class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  updateParameters();
  _first=true;
  _debug(getFullName() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Set up parameters and internal state, so that it has no history before the first firing.
 * @exception IllegalActionException If thrown by the super class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  updateParameters();
  _first=true;
  if (_debugging)   _debug(getFullName() + "String_Node_Str");
}