nus-yam/ex-repair huggingface dataset:
Program: 75318
Project: 75318
Buggy source:
/** 
 * Initialize the private variables.
 * @exception IllegalActionException If thrown by the base class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _currentState=Idle;
  _interference=0.0;
  _numBusyTimers=0;
}

Fixed version (ground truth):
/** 
 * Initialize the private variables.
 * @exception IllegalActionException If thrown by the base class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _currentState=PHY_Idle;
  _interference=0.0;
  _numBusyTimers=0;
}
Program: 75319
Project: 75319
Buggy source:
private void _handleInterference() throws IllegalActionException {
  fromChannel.get(0);
  RecordToken properties=(RecordToken)((WirelessIOPort)fromChannel).getProperties(0);
  double power=((DoubleToken)properties.get("String_Node_Str")).doubleValue();
  double duration=((DoubleToken)properties.get("String_Node_Str")).doubleValue();
  double currentTime=getDirector().getCurrentTime();
  setTimer2(InterferenceDone,currentTime + duration,power);
  _interference=_interference + power;
  if (power > _sensitivity)   _numBusyTimers++;
  if (_numBusyTimers == 1) {
    Token[] value={new IntToken(Busy)};
    RecordToken ChannelStatusMsg=new RecordToken(SignalMsgFields,value);
    channelStatus.send(0,ChannelStatusMsg);
  }
}

Fixed version (ground truth):
private void _handleInterference() throws IllegalActionException {
  double power=0.5, duration=-1;
  ;
  fromChannel.get(0);
  Iterator connectedPorts=fromChannel.sourcePortList().iterator();
  while (connectedPorts.hasNext()) {
    IOPort port=(IOPort)connectedPorts.next();
    if (port.isInput() && port instanceof WirelessIOPort) {
      RecordToken properties=(RecordToken)((WirelessIOPort)port).getProperties(0);
      power=((DoubleToken)properties.get("String_Node_Str")).doubleValue();
      duration=((DoubleToken)properties.get("String_Node_Str")).doubleValue();
      break;
    }
  }
  double currentTime=getDirector().getCurrentTime();
  setTimer2(InterferenceDone,currentTime + duration,power);
  _interference=_interference + power;
  if (power > _sensitivity) {
    _numBusyTimers++;
  }
  if (_numBusyTimers == 1) {
    Token[] value={new IntToken(Busy)};
    RecordToken ChannelStatusMsg=new RecordToken(SignalMsgFields,value);
    channelStatus.send(0,ChannelStatusMsg);
  }
}
Program: 75321
Project: 75321
Buggy source:
/** 
 * Close the window.  Derived classes should override this to release any resources or remove any listeners.  In this class, if the data associated with this window has been modified, and there are no other tableaux in the parent effigy or any effigy that contains it, then ask the user whether to save the data before closing.
 * @return False if the user cancels on a save query.
 */
protected boolean _close(){
  if (getEffigy() == null) {
    return super._close();
  }
  Effigy topEffigy=getEffigy().topEffigy();
  if (!_tableau.isMaster()) {
    List tableaux=topEffigy.entityList(Tableau.class);
    Iterator tableauxIterator=tableaux.iterator();
    while (tableauxIterator.hasNext()) {
      Tableau tableau=(Tableau)tableauxIterator.next();
      if (!(tableau instanceof DialogTableau) && (tableau != _tableau)) {
        dispose();
        return true;
      }
    }
  }
  if (isModified()) {
    int reply=_queryForSave();
    if (reply == _DISCARDED || reply == _FAILED) {
      if (!_checkForDerivedObjects()) {
        return false;
      }
      dispose();
      return true;
    }
    return false;
  }
 else {
    dispose();
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Close the window.  Derived classes should override this to release any resources or remove any listeners.  In this class, if the data associated with this window has been modified, and there are no other tableaux in the parent effigy or any effigy that contains it, then ask the user whether to save the data before closing.
 * @return False if the user cancels on a save query.
 */
protected boolean _close(){
  if (getEffigy() == null) {
    return super._close();
  }
  Effigy topEffigy=getEffigy().topEffigy();
  if (!_tableau.isMaster()) {
    List tableaux=topEffigy.entityList(Tableau.class);
    Iterator tableauxIterator=tableaux.iterator();
    while (tableauxIterator.hasNext()) {
      Tableau tableau=(Tableau)tableauxIterator.next();
      if (!(tableau instanceof DialogTableau) && (tableau != _tableau)) {
        dispose();
        return true;
      }
    }
  }
  if (isModified()) {
    int reply=_queryForSave();
    if (reply == _DISCARDED || reply == _FAILED) {
      if (!_checkForDerivedObjects()) {
        return false;
      }
    }
    if (reply == _SAVED || reply == _DISCARDED) {
      dispose();
      return true;
    }
    return false;
  }
 else {
    dispose();
    return true;
  }
}
Program: 75325
Project: 75325
Buggy source:
private void _backoffDone(int cnt) throws IllegalActionException {
  Token[] value={new IntToken(BkDone),new IntToken(_cnt)};
  BKDone.send(0,new RecordToken(BackoffDoneMsgFields,value));
  mBkIP=false;
  _state=No_Backoff;
}

Fixed version (ground truth):
private void _backoffDone(int cnt) throws IllegalActionException {
  Token[] value={new IntToken(BkDone),new IntToken(cnt)};
  BKDone.send(0,new RecordToken(BackoffDoneMsgFields,value));
  mBkIP=false;
  _state=No_Backoff;
}
Program: 75326
Project: 75326
Buggy source:
private boolean _setNav() throws IllegalActionException {
  double expirationTime=((DoubleToken)_inputMessage.get("String_Node_Str")).doubleValue() + ((IntToken)_inputMessage.get("String_Node_Str")).intValue() * 1e-6;
  tNavEnd=expirationTime;
  if (expirationTime > _currentTime) {
    _NavTimer=setTimer(NavTimeOut,expirationTime);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
private boolean _setNav() throws IllegalActionException {
  double expirationTime=((DoubleToken)_inputMessage.get("String_Node_Str")).doubleValue() + ((IntToken)_inputMessage.get("String_Node_Str")).intValue() * 1e-6;
  tNavEnd=expirationTime;
  if (expirationTime > _currentTime) {
    if (_NavTimer != null)     cancelTimer(_NavTimer);
    _NavTimer=setTimer(NavTimeOut,expirationTime);
    return true;
  }
 else {
    return false;
  }
}
Program: 75328
Project: 75328
Buggy source:
/** 
 * Initialize the private variables.
 * @exception IllegalActionException If thrown by the base class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _dDIfs=_aSifsTime + 2 * _aSlotTime;
  _dEIfs=_aSifsTime + _sAckCtsLng / _mBrate + _aPreambleLength + _aPlcpHeaderLength + _dDIfs;
  _dIfs=_dEIfs;
  _state=0;
  _curSrc=nosrc;
  _inputMessage=null;
  _messageType=UNKNOWN;
  _changeStatus(Busy);
}

Fixed version (ground truth):
/** 
 * Initialize the private variables.
 * @exception IllegalActionException If thrown by the base class.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  _dDIfs=_aSifsTime + 2 * _aSlotTime;
  _dEIfs=_aSifsTime + _sAckCtsLng / _mBrate + _aPreambleLength + _aPlcpHeaderLength + _dDIfs;
  _dIfs=_dEIfs;
  _state=0;
  _curSrc=nosrc;
  _inputMessage=null;
  _messageType=UNKNOWN;
  _IfsTimer=null;
  _NavTimer=null;
  _changeStatus(Busy);
}
Program: 75329
Project: 75329
Buggy source:
/** 
 * Given the elementName, perform any filter operations that are appropriate for the MOMLParser.endElement() method.
 * @param container  The container for this attribute.in this method.
 * @param elementName The element type name.
 * @return the filtered element name, or null ifMoMLParser.endElement() should immediately return.
 */
public String filterEndElement(NamedObj container,String elementName) throws Exception {
  return elementName;
}

Fixed version (ground truth):
/** 
 * Given the elementName, perform any filter operations that are appropriate for the MOMLParser.endElement() method.
 * @param container  The container for this attribute.in this method.
 * @param elementName The element type name.
 * @return the filtered element name, or null ifMoMLParser.endElement() should immediately return.
 */
public String filterEndElement(NamedObj container,String elementName) throws Exception {
  _foundPort=false;
  return elementName;
}
Program: 75330
Project: 75330
Buggy source:
/** 
 * If the attributeName is "class" and attributeValue names a class that has had its port classes changed between releases, then substitute in the new port classes.
 * @param container  The container for this attribute.in this method.
 * @param attributeName The name of the attribute.
 * @param attributeValue The value of the attribute.
 * @return the value of the attributeValue argument.
 */
public String filterAttributeValue(NamedObj container,String attributeName,String attributeValue){
  if (attributeValue == null) {
    return null;
  }
  if (attributeName.equals("String_Node_Str")) {
    _lastNameSeen=attributeValue;
    if (_currentlyProcessingActorWithPortClassChanges && _portMap != null && _portMap.containsKey(attributeValue)) {
      _classMap=(HashMap)_portMap.get(attributeValue);
      _portName=attributeValue;
      _foundPort=true;
    }
  }
  if (attributeName.equals("String_Node_Str")) {
    if (_actorsWithPortClassChanges.containsKey(attributeValue)) {
      _currentlyProcessingActorWithPortClassChanges=true;
      _doneProcessingActorWithPortClassChanges=false;
      _portMap=(HashMap)_actorsWithPortClassChanges.get(attributeValue);
    }
 else     if (_foundPort && _lastNameSeen.equals(_portName) && _classMap.containsKey(attributeValue)) {
      String newClass=(String)_classMap.get(attributeValue);
      _currentlyProcessingActorWithPortClassChanges=false;
      _doneProcessingActorWithPortClassChanges=true;
      _foundPort=false;
      MoMLParser.setModified(true);
      return newClass;
    }
  }
  return attributeValue;
}

Fixed version (ground truth):
/** 
 * If the attributeName is "class" and attributeValue names a class that has had its port classes changed between releases, then substitute in the new port classes.
 * @param container  The container for this attribute.in this method.
 * @param attributeName The name of the attribute.
 * @param attributeValue The value of the attribute.
 * @return the value of the attributeValue argument.
 */
public String filterAttributeValue(NamedObj container,String attributeName,String attributeValue){
  if (attributeValue == null) {
    return null;
  }
  if (attributeName.equals("String_Node_Str")) {
    _lastNameSeen=attributeValue;
    if (_currentlyProcessingActorWithPortClassChanges && _portMap != null && _portMap.containsKey(attributeValue)) {
      _classMap=(HashMap)_portMap.get(attributeValue);
      _portName=attributeValue;
      _foundPort=true;
    }
  }
  if (attributeName.equals("String_Node_Str")) {
    if (_actorsWithPortClassChanges.containsKey(attributeValue)) {
      _currentlyProcessingActorWithPortClassChanges=true;
      _portMap=(HashMap)_actorsWithPortClassChanges.get(attributeValue);
    }
 else     if (_foundPort && _lastNameSeen.equals(_portName) && _classMap.containsKey(attributeValue)) {
      String newClass=(String)_classMap.get(attributeValue);
      _currentlyProcessingActorWithPortClassChanges=false;
      _foundPort=false;
      MoMLParser.setModified(true);
      return newClass;
    }
  }
  return attributeValue;
}
Program: 75331
Project: 75331
Buggy source:
/** 
 * Given the elementName, perform any filter operations that are appropriate for the MOMLParser.endElement() method.
 * @param container  The container for this attribute.in this method.
 * @param elementName The element type name.
 * @return the filtered element name, or null ifMoMLParser.endElement() should immediately return.
 */
public String filterEndElement(NamedObj container,String elementName) throws Exception {
  return elementName;
}

Fixed version (ground truth):
/** 
 * Given the elementName, perform any filter operations that are appropriate for the MOMLParser.endElement() method.
 * @param container  The container for this attribute.in this method.
 * @param elementName The element type name.
 * @return the filtered element name, or null ifMoMLParser.endElement() should immediately return.
 */
public String filterEndElement(NamedObj container,String elementName) throws Exception {
  _foundChange=false;
  return elementName;
}
Program: 75332
Project: 75332
Buggy source:
protected void _processButtonPress(String button){
  if (button.equals("String_Node_Str")) {
    _apply();
  }
 else   if (button.equals("String_Node_Str")) {
    _apply();
    _cancel();
  }
 else   if (button.equals("String_Node_Str")) {
    _portTableModel.addNewPort();
  }
 else   if ((button.length() > 5) && (button.substring(0,6).equals("String_Node_Str"))) {
    _portTableModel.removePort();
  }
 else {
    super._processButtonPress(button);
  }
}

Fixed version (ground truth):
protected void _processButtonPress(String button){
  if (button.equals("String_Node_Str")) {
    _apply();
  }
 else   if (button.equals("String_Node_Str")) {
    _apply();
    _cancel();
  }
 else   if (button.equals("String_Node_Str")) {
    _portTableModel.addNewPort();
  }
 else   if ((button.length() > 5) && (button.substring(0,6).equals("String_Node_Str"))) {
    _portTableModel.removePort();
    _setSelectedRow(-1);
  }
 else {
    super._processButtonPress(button);
  }
}
Program: 75334
Project: 75334
Buggy source:
/** 
 * Removes a port.
 */
public void removePort(){
  _ports.remove(_selectedRow);
  fireTableRowsDeleted(_selectedRow,_selectedRow);
}

Fixed version (ground truth):
/** 
 * Removes a port.
 */
public void removePort(){
  _ports.remove(_selectedRow);
  fireTableRowsDeleted(_selectedRow,_selectedRow);
  _enableApplyButton(true);
  _setDirty(true);
}
Program: 75335
Project: 75335
Buggy source:
public void valueChanged(ListSelectionEvent e){
  if (e.getValueIsAdjusting())   return;
  ListSelectionModel lsm=(ListSelectionModel)e.getSource();
  if (lsm.isSelectionEmpty()) {
    _removeButton.setText("String_Node_Str");
    _removeButton.setEnabled(false);
    _selectedRow=-1;
  }
 else {
    _selectedRow=lsm.getMinSelectionIndex();
    String portName=((String)((Object[])(_ports.elementAt(_selectedRow)))[0]);
    if (portName.length() < 10) {
      portName+="String_Node_Str";
      portName=portName.substring(0,9);
    }
 else     if (portName.length() > 10) {
      portName=portName.substring(0,7) + "String_Node_Str";
    }
    _removeButton.setText("String_Node_Str" + portName);
    _removeButton.setEnabled(true);
  }
}

Fixed version (ground truth):
public void valueChanged(ListSelectionEvent e){
  if (e.getValueIsAdjusting())   return;
  ListSelectionModel lsm=(ListSelectionModel)e.getSource();
  if (lsm.isSelectionEmpty()) {
    _setSelectedRow(-1);
  }
 else {
    _selectedRow=lsm.getMinSelectionIndex();
    _setSelectedRow(_selectedRow);
  }
}
Program: 75336
Project: 75336
Buggy source:
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int col){
  setOpaque(true);
  setText((String)value);
  if (!table.isCellEditable(row,col))   setBackground(_CLASS_ELEMENT_HIGHLIGHT_COLOR);
 else   setBackground(Color.white);
  return this;
}

Fixed version (ground truth):
public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int col){
  setOpaque(true);
  setText((String)value);
  if (!table.isCellEditable(row,col))   setBackground(LocatableNodeController.CLASS_ELEMENT_HIGHLIGHT_COLOR);
 else   setBackground(Color.white);
  return this;
}
Program: 75337
Project: 75337
Buggy source:
/** 
 * Override the base class so that tableaux contained by this object are removed before this effigy is removed from the ModelDirectory. This causes the frames associated with those tableaux to be closed.
 * @param container The directory in which to list this effigy.
 * @exception IllegalActionException If the proposed container is notan instance of ModelDirectory, or if the superclass throws it.
 * @exception NameDuplicationException If the container already hasan entity with the specified name.
 */
public void setContainer(CompositeEntity container) throws IllegalActionException, NameDuplicationException {
  if (container == null) {
    Iterator tableaux=entityList(Tableau.class).iterator();
    while (tableaux.hasNext()) {
      ComponentEntity tableau=(ComponentEntity)tableaux.next();
      tableau.setContainer(null);
    }
    Iterator effigies=entityList(Effigy.class).iterator();
    while (effigies.hasNext()) {
      ComponentEntity effigy=(ComponentEntity)effigies.next();
      effigy.setContainer(null);
    }
  }
  super.setContainer(container);
}

Fixed version (ground truth):
/** 
 * Override the base class so that tableaux contained by this object are removed before this effigy is removed from the ModelDirectory. This causes the frames associated with those tableaux to be closed.  Also, if the argument is null and there is a URI associated with this model, then purge any record of the model that the MoMLParser class is keeping so that future efforts to open the model result in re-parsing.
 * @param container The directory in which to list this effigy.
 * @exception IllegalActionException If the proposed container is notan instance of ModelDirectory, or if the superclass throws it.
 * @exception NameDuplicationException If the container already hasan entity with the specified name.
 */
public void setContainer(CompositeEntity container) throws IllegalActionException, NameDuplicationException {
  if (container == null) {
    Iterator tableaux=entityList(Tableau.class).iterator();
    while (tableaux.hasNext()) {
      ComponentEntity tableau=(ComponentEntity)tableaux.next();
      tableau.setContainer(null);
    }
    Iterator effigies=entityList(Effigy.class).iterator();
    while (effigies.hasNext()) {
      ComponentEntity effigy=(ComponentEntity)effigies.next();
      effigy.setContainer(null);
    }
    if (uri != null) {
      try {
        URL url=uri.getURL();
        MoMLParser.purgeModelRecord(url);
      }
 catch (      MalformedURLException e) {
      }
    }
  }
  super.setContainer(container);
}
Program: 75339
Project: 75339
Buggy source:
/** 
 * Read a Configuration from the URL given by the specified string. The URL may absolute, or relative to the Ptolemy II tree root, or in the classpath.  To convert a String to a URL suitable for use by this method, call specToURL(String).
 * @param specificationURL A string describing a URL.
 * @return A configuration.
 * @exception Exception If the configuration cannot be opened, orif the contents of the URL is not a configuration.
 */
protected Configuration _readConfiguration(URL specificationURL) throws Exception {
  _parser.reset();
  Configuration toplevel=(Configuration)_parser.parse(specificationURL,specificationURL.openStream());
  ComponentEntity directory=((Configuration)toplevel).getEntity("String_Node_Str");
  if (directory instanceof ModelDirectory) {
    PtolemyEffigy effigy=new PtolemyEffigy((ModelDirectory)directory,toplevel.getName());
    effigy.setModel(toplevel);
    effigy.identifier.setExpression(specificationURL.toExternalForm());
  }
  return toplevel;
}

Fixed version (ground truth):
/** 
 * Read a Configuration from the URL given by the specified string. The URL may absolute, or relative to the Ptolemy II tree root, or in the classpath.  To convert a String to a URL suitable for use by this method, call specToURL(String).
 * @param specificationURL A string describing a URL.
 * @return A configuration.
 * @exception Exception If the configuration cannot be opened, orif the contents of the URL is not a configuration.
 */
protected Configuration _readConfiguration(URL specificationURL) throws Exception {
  _parser.reset();
  Configuration toplevel=(Configuration)_parser.parse(specificationURL,specificationURL);
  ComponentEntity directory=((Configuration)toplevel).getEntity("String_Node_Str");
  if (directory instanceof ModelDirectory) {
    PtolemyEffigy effigy=new PtolemyEffigy((ModelDirectory)directory,toplevel.getName());
    effigy.setModel(toplevel);
    effigy.identifier.setExpression(specificationURL.toExternalForm());
  }
  return toplevel;
}
Program: 75340
Project: 75340
Buggy source:
/** 
 * Parse a command-line argument.
 * @return True if the argument is understood, false otherwise.
 * @exception Exception If something goes wrong.
 */
protected boolean _parseArg(String arg) throws Exception {
  if (arg.equals("String_Node_Str")) {
    _expectingClass=true;
  }
 else   if (arg.equals("String_Node_Str")) {
    System.out.println(_usage());
    System.exit(0);
  }
 else   if (arg.equals("String_Node_Str")) {
    _test=true;
  }
 else   if (arg.equals("String_Node_Str")) {
    System.out.println("String_Node_Str" + VersionAttribute.CURRENT_VERSION + "String_Node_Str");
    System.exit(0);
  }
 else   if (arg.equals("String_Node_Str")) {
  }
 else {
    if (_expectingClass) {
      _expectingClass=false;
      Class newClass=Class.forName(arg);
      Workspace workspace=new Workspace();
      Class[] argTypes=new Class[1];
      argTypes[0]=workspace.getClass();
      Constructor constructor=newClass.getConstructor(argTypes);
      Object args[]=new Object[1];
      args[0]=workspace;
      constructor.newInstance(args);
    }
 else {
      if (!arg.startsWith("String_Node_Str")) {
        URL inURL=MoMLApplication.specToURL(arg);
        URL base=inURL;
        _parser.reset();
        _toplevel=(CompositeActor)_parser.parse(base,inURL.openStream());
      }
 else {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Parse a command-line argument.
 * @return True if the argument is understood, false otherwise.
 * @exception Exception If something goes wrong.
 */
protected boolean _parseArg(String arg) throws Exception {
  if (arg.equals("String_Node_Str")) {
    _expectingClass=true;
  }
 else   if (arg.equals("String_Node_Str")) {
    System.out.println(_usage());
    System.exit(0);
  }
 else   if (arg.equals("String_Node_Str")) {
    _test=true;
  }
 else   if (arg.equals("String_Node_Str")) {
    System.out.println("String_Node_Str" + VersionAttribute.CURRENT_VERSION + "String_Node_Str");
    System.exit(0);
  }
 else   if (arg.equals("String_Node_Str")) {
  }
 else {
    if (_expectingClass) {
      _expectingClass=false;
      Class newClass=Class.forName(arg);
      Workspace workspace=new Workspace();
      Class[] argTypes=new Class[1];
      argTypes[0]=workspace.getClass();
      Constructor constructor=newClass.getConstructor(argTypes);
      Object args[]=new Object[1];
      args[0]=workspace;
      constructor.newInstance(args);
    }
 else {
      if (!arg.startsWith("String_Node_Str")) {
        URL inURL=MoMLApplication.specToURL(arg);
        URL base=inURL;
        _parser.reset();
        _toplevel=(CompositeActor)_parser.parse(base,inURL);
      }
 else {
        return false;
      }
    }
  }
  return true;
}
Program: 75341
Project: 75341
Buggy source:
/** 
 * Return a default Configuration, which in this case is given by the MoML file ptolemy/configuration/runPanelConfiguration.xml. That configuration supports executing, but not editing, Ptolemy models.
 * @return A default configuration.
 * @exception Exception If the configuration cannot be opened.
 */
protected Configuration _createDefaultConfiguration() throws Exception {
  if (_configurationURL == null) {
    _configurationURL=specToURL("String_Node_Str");
  }
  MoMLParser parser=new MoMLParser();
  _configuration=(Configuration)parser.parse(_configurationURL,_configurationURL.openStream());
  return _configuration;
}

Fixed version (ground truth):
/** 
 * Return a default Configuration, which in this case is given by the MoML file ptolemy/configuration/runPanelConfiguration.xml. That configuration supports executing, but not editing, Ptolemy models.
 * @return A default configuration.
 * @exception Exception If the configuration cannot be opened.
 */
protected Configuration _createDefaultConfiguration() throws Exception {
  if (_configurationURL == null) {
    _configurationURL=specToURL("String_Node_Str");
  }
  MoMLParser parser=new MoMLParser();
  _configuration=(Configuration)parser.parse(_configurationURL,_configurationURL);
  return _configuration;
}
Program: 75342
Project: 75342
Buggy source:
/** 
 * Return a default Configuration to use when there are no command-line arguments, which in this case is the same as the default configuration given by _createDefaultConfiguration, but with the additional contents of the file ptolemy/configs/runWelcomeWindow.xml.
 * @return A configuration for when there no command-line arguments.
 * @exception Exception If the configuration cannot be opened.
 */
protected Configuration _createEmptyConfiguration() throws Exception {
  Configuration configuration=_createDefaultConfiguration();
  URL inURL=specToURL("String_Node_Str");
  _parser.reset();
  _parser.setContext(configuration);
  _parser.parse(inURL,inURL.openStream());
  Effigy doc=(Effigy)configuration.getEntity("String_Node_Str");
  URL idURL=specToURL("String_Node_Str");
  doc.identifier.setExpression(idURL.toExternalForm());
  return configuration;
}

Fixed version (ground truth):
/** 
 * Return a default Configuration to use when there are no command-line arguments, which in this case is the same as the default configuration given by _createDefaultConfiguration, but with the additional contents of the file ptolemy/configs/runWelcomeWindow.xml.
 * @return A configuration for when there no command-line arguments.
 * @exception Exception If the configuration cannot be opened.
 */
protected Configuration _createEmptyConfiguration() throws Exception {
  Configuration configuration=_createDefaultConfiguration();
  URL inURL=specToURL("String_Node_Str");
  _parser.reset();
  _parser.setContext(configuration);
  _parser.parse(inURL,inURL);
  Effigy doc=(Effigy)configuration.getEntity("String_Node_Str");
  URL idURL=specToURL("String_Node_Str");
  doc.identifier.setExpression(idURL.toExternalForm());
  return configuration;
}
Program: 75345
Project: 75345
Buggy source:
/** 
 * Close the window.  Derived classes should override this to release any resources or remove any listeners.  In this class, if the data associated with this window has been modified, and there are no other tableaux in the parent effigy or any effigy that contains it, then ask the user whether to save the data before closing.
 * @return False if the user cancels on a save query.
 */
protected boolean _close(){
  if (getEffigy() == null) {
    return super._close();
  }
  Effigy topEffigy=getEffigy().topEffigy();
  if (!_tableau.isMaster()) {
    List tableaux=topEffigy.entityList(Tableau.class);
    Iterator tableauxIterator=tableaux.iterator();
    while (tableauxIterator.hasNext()) {
      Tableau tableau=(Tableau)tableauxIterator.next();
      if (!(tableau instanceof DialogTableau) && (tableau != _tableau)) {
        dispose();
        return true;
      }
    }
  }
  return super._close();
}

Fixed version (ground truth):
/** 
 * Close the window.  Derived classes should override this to release any resources or remove any listeners.  In this class, if the data associated with this window has been modified, and there are no other tableaux in the parent effigy or any effigy that contains it, then ask the user whether to save the data before closing.
 * @return False if the user cancels on a save query.
 */
protected boolean _close(){
  if (getEffigy() == null) {
    return super._close();
  }
  Effigy topEffigy=getEffigy().topEffigy();
  if (!_tableau.isMaster()) {
    List tableaux=topEffigy.entityList(Tableau.class);
    Iterator tableauxIterator=tableaux.iterator();
    while (tableauxIterator.hasNext()) {
      Tableau tableau=(Tableau)tableauxIterator.next();
      if (!(tableau instanceof DialogTableau) && (tableau != _tableau)) {
        dispose();
        return true;
      }
    }
  }
  if (isModified()) {
    int reply=_queryForSave();
    if (reply == _DISCARDED || reply == _FAILED) {
      if (!_checkForDerivedObjects()) {
        return false;
      }
      dispose();
      return true;
    }
    return false;
  }
 else {
    dispose();
    return true;
  }
}
Program: 75346
Project: 75346
Buggy source:
/** 
 * Clear the current contents.  This base class checks to see whether the contents have been modified, and if so, then prompts the user to save them.  Derived classes should override this method to first call this parent class method, then clear the data, unless the return value is false.  A return value of false indicates that the user has canceled the action.
 * @return False if the user cancels the clear.
 */
protected boolean _clear(){
  return _queryForSave();
}

Fixed version (ground truth):
/** 
 * Clear the current contents.  This base class checks to see whether the contents have been modified, and if so, then prompts the user to save them.  Derived classes should override this method to first call this parent class method, then clear the data, unless the return value is false.  A return value of false indicates that the user has canceled the action.
 * @return True if the current contents are either saved or discardedwith permission from the user.
 */
protected boolean _clear(){
  int result=_queryForSave();
  return (result == _SAVED || result == _DISCARDED);
}
Program: 75347
Project: 75347
Buggy source:
/** 
 * Exit the application after querying the user to save data. Derived classes should override this to do something more reasonable, so that user data is not discarded.
 */
protected void _exit(){
  if (isModified()) {
    if (_queryForSave()) {
      System.exit(0);
    }
  }
 else {
    System.exit(0);
  }
}

Fixed version (ground truth):
/** 
 * Exit the application after querying the user to save data. Derived classes should override this to do something more reasonable, so that user data is not discarded.
 */
protected void _exit(){
  if (isModified()) {
    int result=_queryForSave();
    if (result == _SAVED || result == _DISCARDED) {
      System.exit(0);
    }
  }
 else {
    System.exit(0);
  }
}
Program: 75348
Project: 75348
Buggy source:
private boolean _queryForSave(){
  Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
  String query="String_Node_Str" + StringUtilities.split(_getName()) + "String_Node_Str";
  int selected=JOptionPane.showOptionDialog(this,query,"String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[0]);
  if (selected == 0) {
    return _save();
  }
 else   if (selected == 1) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Open a dialog to prompt the user to save the data. Return false if the user clicks "cancel", and otherwise return true. If the user clicks "Save", this also saves the data.
 * @return _SAVED if the file is saved, _DISCARDED if the modifications arediscarded, _CANCELED if the operation is canceled by the user, and _FAILED if the user selects save and the save fails.
 */
protected int _queryForSave(){
  Object[] options={"String_Node_Str","String_Node_Str","String_Node_Str"};
  String query="String_Node_Str" + StringUtilities.split(_getName()) + "String_Node_Str";
  int selected=JOptionPane.showOptionDialog(this,query,"String_Node_Str",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE,null,options,options[0]);
  if (selected == 0) {
    if (_save()) {
      return _SAVED;
    }
 else {
      return _FAILED;
    }
  }
  if (selected == 1) {
    return _DISCARDED;
  }
  return _CANCELED;
}
Program: 75349
Project: 75349
Buggy source:
/** 
 * Close the window.  Derived classes should override this to release any resources or remove any listeners.  In this class, if the data associated with this window has been modified, as indicated by isModified(), then ask the user whether to save the data before closing.
 * @return False if the user cancels on a save query.
 */
protected boolean _close(){
  if (isModified()) {
    if (_queryForSave()) {
      dispose();
      return true;
    }
    return false;
  }
 else {
    dispose();
    return true;
  }
}

Fixed version (ground truth):
/** 
 * Close the window.  Derived classes should override this to release any resources or remove any listeners.  In this class, if the data associated with this window has been modified, as indicated by isModified(), then ask the user whether to save the data before closing.
 * @return False if the user cancels on a save query.
 */
protected boolean _close(){
  if (isModified()) {
    int result=_queryForSave();
    if (result == _SAVED || result == _DISCARDED) {
      dispose();
      return true;
    }
    return false;
  }
 else {
    dispose();
    return true;
  }
}
Program: 75352
Project: 75352
Buggy source:
/** 
 * Check that the specified token is compatible with the resolved type of this port.     * 
 * @param token The token to check.
 * @throws IllegalActionException If the specified token iseither incomparable to the resolved type or higher in the type lattice.
 */
protected void _checkType(Token token) throws IllegalActionException {
  int compare=TypeLattice.compare(token.getType(),_resolvedType);
  if (compare == CPO.HIGHER || compare == CPO.INCOMPARABLE) {
    throw new IllegalActionException(this,"String_Node_Str" + token + "String_Node_Str"+ "String_Node_Str"+ getType().toString());
  }
}

Fixed version (ground truth):
/** 
 * Check that the specified token is compatible with the resolved type of this port.     * 
 * @param token The token to check.
 * @throws IllegalActionException If the specified token iseither incomparable to the resolved type or higher in the type lattice.
 */
protected void _checkType(Token token) throws IllegalActionException {
  int compare=TypeLattice.compare(token.getType(),_resolvedType);
  if (compare == CPO.HIGHER || compare == CPO.INCOMPARABLE) {
    throw new IllegalActionException(this,"String_Node_Str" + token + "String_Node_Str"+ token.getType()+ "String_Node_Str"+ getType().toString());
  }
}
Program: 75355
Project: 75355
Buggy source:
/** 
 * Visit a UnitExpr by visiting the UnitRerms.
 * @param unitExpr The UnitExpr to visit.
 * @return
 * @exception IllegalActionException Not thrown in this base class
 */
protected Object _visitUnitExpr(UnitExpr unitExpr) throws IllegalActionException {
  Iterator iter=unitExpr.getUTerms().iterator();
  Vector uTerms=new Vector();
  while (iter.hasNext()) {
    UnitTerm term=(UnitTerm)(iter.next());
    term.visit(this);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Visit a UnitExpr by visiting the UnitRerms.
 * @param unitExpr The UnitExpr to visit.
 * @return Null, can be overriden in a concrete visitor.
 * @exception IllegalActionException Not thrown in this base class
 */
protected Object _visitUnitExpr(UnitExpr unitExpr) throws IllegalActionException {
  Iterator iter=unitExpr.getUTerms().iterator();
  Vector uTerms=new Vector();
  while (iter.hasNext()) {
    UnitTerm term=(UnitTerm)(iter.next());
    term.visit(this);
  }
  return null;
}
Program: 75356
Project: 75356
Buggy source:
/** 
 * Visit a UnitTerm by visiting the UnitExpr if there is one. This method will almost certainly be overridden in a subclass.
 * @param uTerm The UnitTerm to visit.
 * @return
 * @exception IllegalActionException Not thrown in this base class
 */
protected Object _visitUnitTerm(UnitTerm uTerm) throws IllegalActionException {
  if (uTerm.isUnitExpr()) {
    UnitExpr uExpr=uTerm.getUnitExpr();
    _visitUnitExpr(uExpr);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Visit a UnitTerm by visiting the UnitExpr if there is one. This method will almost certainly be overridden in a subclass.
 * @param uTerm The UnitTerm to visit.
 * @return Null, can be overriden in a concrete visitor.
 * @exception IllegalActionException Not thrown in this base class
 */
protected Object _visitUnitTerm(UnitTerm uTerm) throws IllegalActionException {
  if (uTerm.isUnitExpr()) {
    UnitExpr uExpr=uTerm.getUnitExpr();
    _visitUnitExpr(uExpr);
  }
  return null;
}
Program: 75357
Project: 75357
Buggy source:
/** 
 * Visit a UnitEquation by visiting the left and right sides of the equation.
 * @param uEquation The UnitEquation to visit.
 * @return
 * @exception IllegalActionException Not thrown in this base class
 */
protected Object _visitUnitEquation(UnitEquation uEquation) throws IllegalActionException {
  _visitUnitExpr(uEquation.getLhs());
  _visitUnitExpr(uEquation.getRhs());
  return null;
}

Fixed version (ground truth):
/** 
 * Visit a UnitEquation by visiting the left and right sides of the equation.
 * @param uEquation The UnitEquation to visit.
 * @return Null, can be overriden in a concrete visitor.
 * @exception IllegalActionException Not thrown in this base class
 */
protected Object _visitUnitEquation(UnitEquation uEquation) throws IllegalActionException {
  _visitUnitExpr(uEquation.getLhs());
  _visitUnitExpr(uEquation.getRhs());
  return null;
}
Program: 75358
Project: 75358
Buggy source:
/** 
 * @param expression
 * @param equations
 */
public Vector parseEquations(String stringIn) throws ParseException {
  Reader reader=new StringReader(stringIn);
  this.ReInit(reader);
  Vector _equations=Equations();
  return _equations;
}

Fixed version (ground truth):
/** 
 * Parse a set of equations separated by semicolons.
 * @param expression
 * @exception ParseException If parsing error is encountered.
 */
public Vector parseEquations(String expression) throws ParseException {
  Reader reader=new StringReader(expression);
  this.ReInit(reader);
  Vector _equations=Equations();
  return _equations;
}
Program: 75359
Project: 75359
Buggy source:
public UnitExpr parseUnitExpr(String stringIn) throws ParseException {
  Reader reader=new StringReader(stringIn);
  this.ReInit(reader);
  UnitExpr unitExpr=uExpr();
  return unitExpr;
}

Fixed version (ground truth):
/** 
 * Parse a unit expression.
 * @param expression
 * @exception ParseException If parsing error is encountered.
 */
public UnitExpr parseUnitExpr(String expression) throws ParseException {
  Reader reader=new StringReader(expression);
  this.ReInit(reader);
  UnitExpr unitExpr=uExpr();
  return unitExpr;
}
Program: 75360
Project: 75360
Buggy source:
/** 
 * Return whether or not the given element name is undoable. NOTE: we need this method as the list of actions on namespaces and _current does not apply to elements such as "link"
 * @param elementName  Description of Parameter
 * @return              Description of the Returned Value
 * @since Ptolemy 2.1
 */
private boolean _isUndoableElement(String elementName){
  if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Return whether or not the given element name is undoable. NOTE: we need this method as the list of actions on namespaces and _current does not apply to elements such as "link"
 * @param elementName  Description of Parameter
 * @return              Description of the Returned Value
 * @since Ptolemy 2.1
 */
private boolean _isUndoableElement(String elementName){
  if (elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str") || elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")|| elementName.equals("String_Node_Str")) {
    return true;
  }
  return false;
}
Program: 75363
Project: 75363
Buggy source:
/** 
 * Create an entity controller associated with the specified graph controller with full access.
 * @param controller The associated graph controller.
 */
public ActorInstanceController(GraphController controller){
  super(controller,FULL);
  _menuFactory.addMenuItemFactory(new MenuActionFactory(_convertToClassAction));
}

Fixed version (ground truth):
/** 
 * Create an entity controller associated with the specified graph controller with the specified access.
 * @param controller The associated graph controller.
 */
public ActorInstanceController(GraphController controller,Access access){
  super(controller,access);
  if (access == FULL) {
    _menuFactory.addMenuItemFactory(new MenuActionFactory(_convertToClassAction));
  }
  Filter portFilter=new Filter(){
    public boolean accept(    Object candidate){
      GraphModel model=getController().getGraphModel();
      Object semanticObject=model.getSemanticObject(candidate);
      if (candidate instanceof Locatable && semanticObject instanceof Entity && !((Entity)semanticObject).isClassDefinition()) {
        return true;
      }
 else {
        return false;
      }
    }
  }
;
  GlobalLayout layout=new EntityLayout();
  controller.addGraphViewListener(new IncrementalLayoutListener(new IncrLayoutAdapter(layout){
    public void nodeDrawn(    Object node){
      layout(node);
    }
  }
,portFilter));
}
Program: 75364
Project: 75364
Buggy source:
public void actionPerformed(ActionEvent e){
  super.actionPerformed(e);
  NamedObj object=getTarget();
  NamedObj container=(NamedObj)object.getContainer();
  StringBuffer moml=new StringBuffer();
  if (!((Prototype)object).isClassDefinition()) {
    moml.append("String_Node_Str" + object.getName() + "String_Node_Str");
  }
 else {
  }
  MoMLChangeRequest request=new MoMLChangeRequest(this,container,moml.toString());
  container.requestChange(request);
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  if (_access != FULL) {
    return;
  }
  super.actionPerformed(e);
  NamedObj object=getTarget();
  NamedObj container=(NamedObj)object.getContainer();
  StringBuffer moml=new StringBuffer();
  if (!((Prototype)object).isClassDefinition()) {
    moml.append("String_Node_Str" + object.getName() + "String_Node_Str");
  }
 else {
  }
  MoMLChangeRequest request=new MoMLChangeRequest(this,container,moml.toString());
  container.requestChange(request);
}
Program: 75365
Project: 75365
Buggy source:
/** 
 * Create the controllers for nodes in this graph. In this base class, controllers with PARTIAL access are created. This is called by the constructor, so derived classes that override this must be careful not to reference local variables defined in the derived classes, because the derived classes will not have been fully constructed by the time this is called.
 */
protected void _createControllers(){
  super._createControllers();
  _attributeController=new AttributeController(this,AttributeController.PARTIAL);
  _classDefinitionController=new ActorController(this,AttributeController.PARTIAL);
  _entityController=new ActorController(this,AttributeController.PARTIAL);
  _entityPortController=new IOPortController(this,AttributeController.PARTIAL);
  _relationController=new RelationController(this);
  _linkController=new LinkController(this);
}

Fixed version (ground truth):
/** 
 * Create the controllers for nodes in this graph. In this base class, controllers with PARTIAL access are created. This is called by the constructor, so derived classes that override this must be careful not to reference local variables defined in the derived classes, because the derived classes will not have been fully constructed by the time this is called.
 */
protected void _createControllers(){
  super._createControllers();
  _attributeController=new AttributeController(this,AttributeController.PARTIAL);
  _classDefinitionController=new ClassDefinitionController(this,AttributeController.PARTIAL);
  _entityController=new ActorInstanceController(this,AttributeController.PARTIAL);
  _entityPortController=new IOPortController(this,AttributeController.PARTIAL);
  _relationController=new RelationController(this);
  _linkController=new LinkController(this);
}
Program: 75366
Project: 75366
Buggy source:
/** 
 * Return the node controller appropriate for the given object. If the object is an instance of Vertex, then return the local relation controller.  If it implements Locatable, then determine whether it is an Entity, Attribute, or Port, and return the appropriate default controller. If the argument is an instance of Port, then return the local port controller.
 * @param object A Vertex, Locatable, or Port.
 */
public NodeController getNodeController(Object object){
  NodeController result=super.getNodeController(object);
  if (result != null) {
    return result;
  }
  if (object instanceof Vertex) {
    return _relationController;
  }
 else   if (object instanceof Locatable) {
    Object semanticObject=getGraphModel().getSemanticObject(object);
    if (semanticObject instanceof Entity) {
      if (((Entity)semanticObject).isClassDefinition()) {
        return _classDefinitionController;
      }
 else {
        return _entityController;
      }
    }
 else     if (semanticObject instanceof Attribute) {
      return _attributeController;
    }
 else     if (semanticObject instanceof Port) {
      return _portController;
    }
 else {
      throw new RuntimeException("String_Node_Str" + semanticObject);
    }
  }
 else   if (object instanceof Port) {
    return _entityPortController;
  }
  throw new RuntimeException("String_Node_Str" + object);
}

Fixed version (ground truth):
/** 
 * Return the node controller appropriate for the given object. If the object is an instance of Vertex, then return the local relation controller.  If it implements Locatable, then determine whether it is an Entity, Attribute, or Port, and return the appropriate default controller. If the argument is an instance of Port, then return the local port controller.
 * @param object A Vertex, Locatable, or Port.
 */
public NodeController getNodeController(Object object){
  NodeController result=super.getNodeController(object);
  if (result != null) {
    return result;
  }
  if (object instanceof Vertex) {
    return _relationController;
  }
 else   if (object instanceof Locatable) {
    Object semanticObject=getGraphModel().getSemanticObject(object);
    if (semanticObject instanceof Entity) {
      if (_classDefinitionController != null && ((Entity)semanticObject).isClassDefinition()) {
        return _classDefinitionController;
      }
 else {
        return _entityController;
      }
    }
 else     if (semanticObject instanceof Attribute) {
      return _attributeController;
    }
 else     if (semanticObject instanceof Port) {
      return _portController;
    }
 else {
      throw new RuntimeException("String_Node_Str" + semanticObject);
    }
  }
 else   if (object instanceof Port) {
    return _entityPortController;
  }
  throw new RuntimeException("String_Node_Str" + object);
}
Program: 75369
Project: 75369
Buggy source:
/** 
 * Output an absent value by calling the sendClear() method of the output port.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  super.fire();
  output.sendClear(0);
}

Fixed version (ground truth):
/** 
 * Output an absent value by calling the sendClear() method of the output port.
 * @exception IllegalActionException If there is no director.
 */
public void fire() throws IllegalActionException {
  output.sendClear(0);
}
Program: 75370
Project: 75370
Buggy source:
/** 
 * Return a new array that is a copy of the array argument.
 * @param matrix An array of ints.
 * @return A new array of ints.
 */
public static final double[] allocCopy(final double[] array){
  int elements=array.length;
  double[] newArray=new double[elements];
  System.arraycopy(array,0,newArray,0,elements);
  return newArray;
}

Fixed version (ground truth):
/** 
 * Return a new array that is a copy of the array argument.
 * @param array An array of ints.
 * @return A new array of ints.
 */
public static final double[] allocCopy(final double[] array){
  int elements=array.length;
  double[] newArray=new double[elements];
  System.arraycopy(array,0,newArray,0,elements);
  return newArray;
}