nus-yam/ex-repair huggingface dataset:
Program: 76033
Project: 76033
Buggy source:
/** 
 * Create a bank of radio buttons.  A radio button provides a list of choices, only one of which may be chosen at a time.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param values The list of possible choices.
 * @param defaultValue Default value.
 */
public void addRadioButtons(String name,String label,String[] values,String defaultValue){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  FlowLayout flow=new FlowLayout();
  flow.setAlignment(FlowLayout.LEFT);
  Panel buttonPanel=new Panel(flow);
  ButtonGroup group=new ButtonGroup();
  QueryActionListener listener=new QueryActionListener(name);
  JRadioButton[] buttons=new JRadioButton[values.length];
  for (int i=0; i < values.length; i++) {
    JRadioButton checkbox=new JRadioButton(values[i]);
    buttons[i]=checkbox;
    checkbox.setBackground(_background);
    checkbox.setOpaque(false);
    if (values[i].equals(defaultValue)) {
      checkbox.setSelected(true);
    }
    group.add(checkbox);
    buttonPanel.add(checkbox);
    checkbox.addActionListener(listener);
  }
  _addPair(name,lbl,buttonPanel);
  _entries.put(name,buttons);
}

Fixed version (ground truth):
/** 
 * Create a bank of radio buttons.  A radio button provides a list of choices, only one of which may be chosen at a time.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param values The list of possible choices.
 * @param defaultValue Default value.
 */
public void addRadioButtons(String name,String label,String[] values,String defaultValue){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  FlowLayout flow=new FlowLayout();
  flow.setAlignment(FlowLayout.LEFT);
  Panel buttonPanel=new Panel(flow);
  ButtonGroup group=new ButtonGroup();
  QueryActionListener listener=new QueryActionListener(name);
  JRadioButton[] buttons=new JRadioButton[values.length];
  for (int i=0; i < values.length; i++) {
    JRadioButton checkbox=new JRadioButton(values[i]);
    buttons[i]=checkbox;
    checkbox.setBackground(_background);
    checkbox.setOpaque(false);
    if (values[i].equals(defaultValue)) {
      checkbox.setSelected(true);
    }
    group.add(checkbox);
    buttonPanel.add(checkbox);
    checkbox.addActionListener(listener);
  }
  _addPair(name,lbl,buttonPanel,buttons);
}
Program: 76034
Project: 76034
Buggy source:
/** 
 * Add a label and a widget to the panel.
 * @param name The name of the entry.
 * @param label The label.
 * @param widget The interactive entry to the right of the label.
 */
protected void _addPair(String name,JLabel label,Component widget){
  _constraints.gridwidth=1;
  _grid.setConstraints(label,_constraints);
  _entryPanel.add(label);
  _constraints.gridwidth=GridBagConstraints.REMAINDER;
  _grid.setConstraints(widget,_constraints);
  _entryPanel.add(widget);
  _entries.put(name,widget);
  _labels.put(name,label);
  _previous.put(name,stringValue(name));
}

Fixed version (ground truth):
/** 
 * Add a label and a widget to the panel.
 * @param name The name of the entry.
 * @param label The label.
 * @param widget The interactive entry to the right of the label.
 * @param entry The object that contains user data.
 */
protected void _addPair(String name,JLabel label,Component widget,Object entry){
  _constraints.gridwidth=1;
  _grid.setConstraints(label,_constraints);
  _entryPanel.add(label);
  _constraints.gridwidth=GridBagConstraints.REMAINDER;
  _grid.setConstraints(widget,_constraints);
  _entryPanel.add(widget);
  _entries.put(name,entry);
  _labels.put(name,label);
  _previous.put(name,stringValue(name));
}
Program: 76035
Project: 76035
Buggy source:
/** 
 * Create an on-off check box.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param defaultValue The default value (true for on).
 */
public void addCheckBox(String name,String label,boolean defaultValue){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JRadioButton checkbox=new JRadioButton();
  checkbox.setBackground(_background);
  checkbox.setOpaque(false);
  checkbox.setSelected(defaultValue);
  _addPair(name,lbl,checkbox);
  checkbox.addItemListener(new QueryItemListener(name));
}

Fixed version (ground truth):
/** 
 * Create an on-off check box.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param defaultValue The default value (true for on).
 */
public void addCheckBox(String name,String label,boolean defaultValue){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JRadioButton checkbox=new JRadioButton();
  checkbox.setBackground(_background);
  checkbox.setOpaque(false);
  checkbox.setSelected(defaultValue);
  _addPair(name,lbl,checkbox,checkbox);
  checkbox.addItemListener(new QueryItemListener(name));
}
Program: 76036
Project: 76036
Buggy source:
/** 
 * Create a single-line entry box with the specified name, label, and default value.  To control the width of the box, call setTextWidth() first.
 * @param name The name used to identify the entry (when accessingthe entry).
 * @param label The label to attach to the entry.
 * @param defaultValue Default value to appear in the entry box.
 */
public void addLine(String name,String label,String defaultValue){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JTextField entryBox=new JTextField(defaultValue,_width);
  entryBox.setBackground(Color.white);
  _addPair(name,lbl,entryBox);
  entryBox.addActionListener(new QueryActionListener(name));
  entryBox.addFocusListener(new QueryFocusListener(name));
}

Fixed version (ground truth):
/** 
 * Create a single-line entry box with the specified name, label, and default value.  To control the width of the box, call setTextWidth() first.
 * @param name The name used to identify the entry (when accessingthe entry).
 * @param label The label to attach to the entry.
 * @param defaultValue Default value to appear in the entry box.
 */
public void addLine(String name,String label,String defaultValue){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JTextField entryBox=new JTextField(defaultValue,_width);
  entryBox.setBackground(Color.white);
  _addPair(name,lbl,entryBox,entryBox);
  entryBox.addActionListener(new QueryActionListener(name));
  entryBox.addFocusListener(new QueryFocusListener(name));
}
Program: 76037
Project: 76037
Buggy source:
/** 
 * Create a choice menu.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param values The list of possible choices.
 * @param defaultChoice Default choice.
 * @param editable True if an arbitrary choice can be entered, in additionto the choices in values.
 */
public void addChoice(String name,String label,String[] values,String defaultChoice,boolean editable){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JComboBox combobox=new JComboBox(values);
  combobox.setEditable(editable);
  combobox.setBackground(Color.white);
  combobox.setSelectedItem(defaultChoice);
  _addPair(name,lbl,combobox);
  combobox.addItemListener(new QueryItemListener(name));
}

Fixed version (ground truth):
/** 
 * Create a choice menu.
 * @param name The name used to identify the entry (when calling get).
 * @param label The label to attach to the entry.
 * @param values The list of possible choices.
 * @param defaultChoice Default choice.
 * @param editable True if an arbitrary choice can be entered, in additionto the choices in values.
 */
public void addChoice(String name,String label,String[] values,String defaultChoice,boolean editable){
  JLabel lbl=new JLabel(label + "String_Node_Str");
  lbl.setBackground(_background);
  JComboBox combobox=new JComboBox(values);
  combobox.setEditable(editable);
  combobox.setBackground(Color.white);
  combobox.setSelectedItem(defaultChoice);
  _addPair(name,lbl,combobox,combobox);
  combobox.addItemListener(new QueryItemListener(name));
}
Program: 76038
Project: 76038
Buggy source:
/** 
 * Create a slider with the specified name, label, default value, maximum, and minimum.
 * @param name The name used to identify the slider.
 * @param label The label to attach to the slider.
 * @param defaultValue Initial position of slider.
 * @param maximum Maximum value of slider.
 * @param minimum Minimum value of slider.
 * @exception IllegalArgumentException If the desired default valueis not between the minimum and maximum.
 */
public void addSlider(String name,String label,int defaultValue,int minimum,int maximum) throws IllegalArgumentException {
  JLabel lbl=new JLabel(label + "String_Node_Str");
  if (minimum > maximum) {
    int temp=minimum;
    minimum=maximum;
    maximum=temp;
  }
  if ((defaultValue > maximum) || (defaultValue < minimum)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + defaultValue + "String_Node_Str"+ "String_Node_Str");
  }
  JSlider slider=new JSlider(minimum,maximum,defaultValue);
  _addPair(name,lbl,slider);
  slider.addChangeListener(new SliderListener(name));
}

Fixed version (ground truth):
/** 
 * Create a slider with the specified name, label, default value, maximum, and minimum.
 * @param name The name used to identify the slider.
 * @param label The label to attach to the slider.
 * @param defaultValue Initial position of slider.
 * @param maximum Maximum value of slider.
 * @param minimum Minimum value of slider.
 * @exception IllegalArgumentException If the desired default valueis not between the minimum and maximum.
 */
public void addSlider(String name,String label,int defaultValue,int minimum,int maximum) throws IllegalArgumentException {
  JLabel lbl=new JLabel(label + "String_Node_Str");
  if (minimum > maximum) {
    int temp=minimum;
    minimum=maximum;
    maximum=temp;
  }
  if ((defaultValue > maximum) || (defaultValue < minimum)) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str" + defaultValue + "String_Node_Str"+ "String_Node_Str");
  }
  JSlider slider=new JSlider(minimum,maximum,defaultValue);
  _addPair(name,lbl,slider,slider);
  slider.addChangeListener(new SliderListener(name));
}
Program: 76039
Project: 76039
Buggy source:
/** 
 * Construct a mutation request to be executed in the specified context. The context is typically a Ptolemy II container, such as an entity, within which the objects specified by the MoML code will be placed. This method resets and uses a parser that is a static member of this class. A listener to changes will probably want to check the originator so that when it is notified of errors or successful completion of changes, it can tell whether the change is one it requested. Alternatively, it can call waitForCompletion().
 * @param originator The originator of the change request.
 * @param context The context in which to execute the MoML.
 * @param request The mutation request in MoML.
 */
public MoMLChangeRequest(Object originator,NamedObj context,String request){
  super(originator,request);
  _staticParser.reset();
  _parser=_staticParser;
  _parser.setContext(context);
}

Fixed version (ground truth):
/** 
 * Construct a mutation request to be executed in the specified context. The context is typically a Ptolemy II container, such as an entity, within which the objects specified by the MoML code will be placed. This method resets and uses a parser that is a static member of this class. A listener to changes will probably want to check the originator so that when it is notified of errors or successful completion of changes, it can tell whether the change is one it requested. Alternatively, it can call waitForCompletion().
 * @param originator The originator of the change request.
 * @param context The context in which to execute the MoML.
 * @param request The mutation request in MoML.
 */
public MoMLChangeRequest(Object originator,NamedObj context,String request){
  super(originator,request);
  _parser=_staticParser;
  _context=context;
}
Program: 76040
Project: 76040
Buggy source:
/** 
 * Execute the change by evaluating the request using the specified parser.
 * @exception Exception If an exception is thrownwhile evaluating the request.
 */
protected void _execute() throws Exception {
  _parser.parse(getDescription());
}

Fixed version (ground truth):
/** 
 * Execute the change by evaluating the request using the specified parser.
 * @exception Exception If an exception is thrownwhile evaluating the request.
 */
protected void _execute() throws Exception {
  _parser.reset();
  if (_context != null) {
    _parser.setContext(_context);
  }
  _parser.parse(getDescription());
}
Program: 76041
Project: 76041
Buggy source:
/** 
 * Write a MoML description of the contents of this object, which in this class is the configuration information. This method is called by exportMoML().  Each 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 {
  super._exportMoMLContents(output,depth);
  String header="String_Node_Str" + "String_Node_Str";
  output.write(_getIndentPrefix(depth) + "String_Node_Str" + header+ "String_Node_Str");
  PrintWriter print=new PrintWriter(output);
  histogram.writeFormat(print);
  output.write("String_Node_Str" + _getIndentPrefix(depth) + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Write a MoML description of the contents of this object, which in this class is the configuration information. This method is called by exportMoML().  Each 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 {
  super._exportMoMLContents(output,depth);
  String header="String_Node_Str" + "String_Node_Str";
  if (histogram != null) {
    output.write(_getIndentPrefix(depth) + "String_Node_Str" + header+ "String_Node_Str");
    PrintWriter print=new PrintWriter(output);
    histogram.writeFormat(print);
    output.write("String_Node_Str" + _getIndentPrefix(depth) + "String_Node_Str");
  }
}
Program: 76042
Project: 76042
Buggy source:
/** 
 * Notify all registered listeners that something changed for the  specified entry, if it indeed has changed.  The stringValue() method is used to check the current value against the previously notified value, or the original value if there have been no notifications.
 * @param name The entry that may have changed.
 */
void _notifyListeners(String name){
  if (_listeners != null) {
    String previous=(String)_previous.get(name);
    String newValue=stringValue(name);
    if (newValue.equals(previous))     return;
    _previous.put(name,newValue);
    Enumeration listeners=_listeners.elements();
    while (listeners.hasMoreElements()) {
      QueryListener queueListener=(QueryListener)(listeners.nextElement());
      queueListener.changed(name);
    }
  }
}

Fixed version (ground truth):
/** 
 * Notify all registered listeners that something changed for the  specified entry, if it indeed has changed.  The stringValue() method is used to check the current value against the previously notified value, or the original value if there have been no notifications.
 * @param name The entry that may have changed.
 */
void _notifyListeners(String name){
  if (_listeners != null) {
    String previous=(String)_previous.get(name);
    String newValue=stringValue(name);
    if (newValue.equals(previous)) {
      return;
    }
    _previous.put(name,newValue);
    Enumeration listeners=_listeners.elements();
    while (listeners.hasMoreElements()) {
      QueryListener queryListener=(QueryListener)(listeners.nextElement());
      queryListener.changed(name);
    }
  }
}
Program: 76044
Project: 76044
Buggy source:
/** 
 * Specify a message to be displayed above the query.
 * @param message The message to display.
 */
public void setMessage(String message){
  if (_messageArea == null) {
    _messageArea=new JTextArea(message);
    _messageArea.setFont(new Font("String_Node_Str",Font.PLAIN,12));
    _messageArea.setEditable(false);
    _messageArea.setLineWrap(true);
    _messageArea.setWrapStyleWord(true);
    _messageArea.setBackground(getBackground());
    _messageArea.setAlignmentX(0.0f);
    _messagePanel.setLayout(new BoxLayout(_messagePanel,BoxLayout.Y_AXIS));
    _messagePanel.add(_messageArea);
    Component strut=Box.createVerticalStrut(10);
    _messagePanel.add(strut);
  }
 else {
    _messageArea.setText(message);
  }
  validate();
}

Fixed version (ground truth):
/** 
 * Specify a message to be displayed above the query.
 * @param message The message to display.
 */
public void setMessage(String message){
  if (_messageArea == null) {
    _messageArea=new JTextArea(message);
    _messageArea.setFont(new Font("String_Node_Str",Font.PLAIN,12));
    _messageArea.setEditable(false);
    _messageArea.setLineWrap(true);
    _messageArea.setWrapStyleWord(true);
    _messageArea.setBackground(getBackground());
    _messageArea.setAlignmentX(0.0f);
    _messagePanel.setLayout(new BoxLayout(_messagePanel,BoxLayout.Y_AXIS));
    _messagePanel.add(_messageArea);
    _messagePanel.add(Box.createRigidArea(new Dimension(0,10)));
  }
 else {
    _messageArea.setText(message);
  }
  validate();
}
Program: 76045
Project: 76045
Buggy source:
/** 
 * Request restoration of the parameter values to what they were when this object was created.  The actual restoration occurs later, in the UI thread, in order to allow all pending changes to the parameter values to be processed first.
 */
public void restore(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      Iterator entries=_originalValues.entrySet().iterator();
      while (entries.hasNext()) {
        Map.Entry entry=(Map.Entry)entries.next();
        Parameter param=(Parameter)_object.getAttribute((String)entry.getKey());
        param.setExpression((String)entry.getValue());
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Request restoration of the parameter values to what they were when this object was created.  The actual restoration occurs later, in the UI thread, in order to allow all pending changes to the parameter values to be processed first.
 */
public void restore(){
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      Iterator entries=_originalValues.entrySet().iterator();
      while (entries.hasNext()) {
        Map.Entry entry=(Map.Entry)entries.next();
        Parameter param=(Parameter)_object.getAttribute((String)entry.getKey());
        param.setExpression((String)entry.getValue());
        try {
          param.getToken();
        }
 catch (        IllegalActionException ex) {
        }
      }
    }
  }
);
}
Program: 76046
Project: 76046
Buggy source:
public void run(){
  Iterator entries=_originalValues.entrySet().iterator();
  while (entries.hasNext()) {
    Map.Entry entry=(Map.Entry)entries.next();
    Parameter param=(Parameter)_object.getAttribute((String)entry.getKey());
    param.setExpression((String)entry.getValue());
  }
}

Fixed version (ground truth):
public void run(){
  Iterator entries=_originalValues.entrySet().iterator();
  while (entries.hasNext()) {
    Map.Entry entry=(Map.Entry)entries.next();
    Parameter param=(Parameter)_object.getAttribute((String)entry.getKey());
    param.setExpression((String)entry.getValue());
    try {
      param.getToken();
    }
 catch (    IllegalActionException ex) {
    }
  }
}
Program: 76047
Project: 76047
Buggy source:
/** 
 * Construct a configurer for the specified object.
 * @param object The object to configure.
 */
public Configurer(NamedObj object){
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  _object=object;
  Iterator params=object.attributeList(Parameter.class).iterator();
  while (params.hasNext()) {
    Parameter param=(Parameter)params.next();
    _originalValues.put(param.getName(),param.stringRepresentation());
  }
  boolean foundOne=false;
  Iterator editors=object.attributeList(EditorPaneFactory.class).iterator();
  while (editors.hasNext()) {
    foundOne=true;
    EditorPaneFactory editor=(EditorPaneFactory)editors.next();
    Component pane=editor.createEditorPane();
    add(pane);
    if (pane instanceof CloseListener) {
      _closeListeners.add(pane);
    }
  }
  if (!foundOne) {
    try {
      EditorPaneFactory editor=new EditorPaneFactory(object,object.uniqueName("String_Node_Str"));
      Component pane=editor.createEditorPane();
      add(pane);
      if (pane instanceof CloseListener) {
        _closeListeners.add(pane);
      }
    }
 catch (    NameDuplicationException ex) {
      throw new InternalErrorException(ex.toString());
    }
catch (    IllegalActionException ex) {
      throw new InternalErrorException(ex.toString());
    }
  }
}

Fixed version (ground truth):
/** 
 * Construct a configurer for the specified object.
 * @param object The object to configure.
 */
public Configurer(final NamedObj object){
  setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  _object=object;
  Iterator params=object.attributeList(Parameter.class).iterator();
  while (params.hasNext()) {
    Parameter param=(Parameter)params.next();
    _originalValues.put(param.getName(),param.stringRepresentation());
  }
  boolean foundOne=false;
  Iterator editors=object.attributeList(EditorPaneFactory.class).iterator();
  while (editors.hasNext()) {
    foundOne=true;
    EditorPaneFactory editor=(EditorPaneFactory)editors.next();
    Component pane=editor.createEditorPane();
    add(pane);
    if (pane instanceof CloseListener) {
      _closeListeners.add(pane);
    }
  }
  if (!foundOne) {
    Component pane=EditorPaneFactory.createEditorPane(object);
    add(pane);
    if (pane instanceof CloseListener) {
      _closeListeners.add(pane);
    }
  }
}
Program: 76048
Project: 76048
Buggy source:
/** 
 * Return a new widget for configuring the container.
 * @return A new widget for configuring the container.
 */
public Component createEditorPane(){
  Nameable handler=getContainer();
  while (handler != null && !(handler instanceof CompositeEntity)) {
    handler=handler.getContainer();
  }
  PtolemyQuery query=new PtolemyQuery((CompositeEntity)handler);
  query.setTextWidth(25);
  NamedObj container=(NamedObj)getContainer();
  Iterator params=container.attributeList(Parameter.class).iterator();
  boolean foundOne=false;
  while (params.hasNext()) {
    foundOne=true;
    Parameter param=(Parameter)params.next();
    query.addStyledEntry(param);
  }
  if (!foundOne) {
    return new JLabel(container.getName() + "String_Node_Str");
  }
  return query;
}

Fixed version (ground truth):
/** 
 * Return a new widget for configuring the specified object. This can be used for objects that do not contain an instance of EditorPaneFactory as an attribute.
 * @return A new widget for configuring the specified object.
 */
public static Component createEditorPane(NamedObj object){
  PtolemyQuery query=new PtolemyQuery(object);
  query.setTextWidth(25);
  Iterator params=object.attributeList(Parameter.class).iterator();
  boolean foundOne=false;
  while (params.hasNext()) {
    foundOne=true;
    Parameter param=(Parameter)params.next();
    query.addStyledEntry(param);
  }
  if (!foundOne) {
    return new JLabel(object.getName() + "String_Node_Str");
  }
  return query;
}
Program: 76049
Project: 76049
Buggy source:
/** 
 * Return an AST that contains a class declaration. 
 */
public static ClassDeclNode ASTClassDeclNode(Class myClass){
  int modifiers=Modifier.convertModifiers(myClass.getModifiers());
  String fullClassName=myClass.getName();
  NameNode className=new NameNode(AbsentTreeNode.instance,fullClassName.substring(1 + fullClassName.lastIndexOf('.')));
  List interfaceList=new LinkedList();
  Class interfaceClasses[]=myClass.getInterfaces();
  for (int i=0; i < interfaceClasses.length; i++) {
    int interfaceModifiers=Modifier.convertModifiers(interfaceClasses[i].getModifiers());
    String fullInterfaceName=interfaceClasses[i].getName();
    TypeNode interfaceDeclNode=new TypeNameNode(new NameNode(AbsentTreeNode.instance,fullInterfaceName.substring(1 + fullInterfaceName.lastIndexOf('.'))));
    interfaceList.add(interfaceDeclNode);
  }
  LinkedList memberList=new LinkedList();
  memberList.addAll(constructorsASTList(myClass));
  memberList.addAll(methodsASTList(myClass));
  memberList.addAll(fieldsASTList(myClass));
  TreeNode superClass=null;
  if (myClass.getPackage() == null) {
    superClass=(TreeNode)_makeNameNode("String_Node_Str");
  }
 else {
    superClass=(TreeNode)_makeNameNode(myClass.getSuperclass().getName());
  }
  ClassDeclNode classDeclNode=new ClassDeclNode(modifiers,className,interfaceList,memberList,superClass);
  return classDeclNode;
}

Fixed version (ground truth):
/** 
 * Return an AST that contains a class declaration. 
 */
public static ClassDeclNode ASTClassDeclNode(Class myClass){
  int modifiers=Modifier.convertModifiers(myClass.getModifiers());
  String fullClassName=myClass.getName();
  NameNode className=new NameNode(AbsentTreeNode.instance,fullClassName.substring(1 + fullClassName.lastIndexOf('.')));
  List interfaceList=new LinkedList();
  Class interfaceClasses[]=myClass.getInterfaces();
  for (int i=0; i < interfaceClasses.length; i++) {
    int interfaceModifiers=Modifier.convertModifiers(interfaceClasses[i].getModifiers());
    String fullInterfaceName=interfaceClasses[i].getName();
    TypeNode interfaceDeclNode=new TypeNameNode(new NameNode(AbsentTreeNode.instance,fullInterfaceName.substring(1 + fullInterfaceName.lastIndexOf('.'))));
    interfaceList.add(interfaceDeclNode);
  }
  LinkedList memberList=new LinkedList();
  memberList.addAll(constructorsASTList(myClass));
  memberList.addAll(methodsASTList(myClass));
  memberList.addAll(fieldsASTList(myClass));
  TreeNode superClass=null;
  if (myClass.getPackage() == null) {
    superClass=(TreeNode)_makeNameNode("String_Node_Str");
  }
 else {
    if (myClass.getSuperclass() != null) {
      superClass=(TreeNode)_makeNameNode(myClass.getSuperclass().getName());
    }
  }
  ClassDeclNode classDeclNode=new ClassDeclNode(modifiers,className,interfaceList,memberList,superClass);
  return classDeclNode;
}
Program: 76050
Project: 76050
Buggy source:
public final boolean matches(String name,int mask){
  if ((category & mask) != 0) {
    return (name.equals(ANY_NAME) || name.equals(_name));
  }
  return false;
}

Fixed version (ground truth):
public final boolean matches(String name,int mask){
  if ((category & mask) != 0) {
    return (name.equals(ANY_NAME) || _name.equals(ANY_NAME) || name.equals(_name));
  }
  if (category == 0 && mask == 0) {
    return (name.equals(ANY_NAME) || name.equals(_name));
  }
  return false;
}
Program: 76051
Project: 76051
Buggy source:
/** 
 * Constuct an environment nested inside the parent argument, with the given List of Decl's in this environment itself.
 */
public Environ(Environ parent,List declList){
  _parent=parent;
  _declList=declList;
}

Fixed version (ground truth):
/** 
 * Construct an environment nested inside the parent argument, with the given List of Decl's in this environment itself.
 */
public Environ(Environ parent,List declList){
  _parent=parent;
  _declList=declList;
}
Program: 76052
Project: 76052
Buggy source:
/** 
 * Create an entity controller associated with the specified graph controller.
 * @param controller The associated graph controller.
 */
public EntityController(GraphController controller){
  super(controller);
  setNodeRenderer(new EntityRenderer());
  SelectionModel sm=controller.getSelectionModel();
  NodeInteractor interactor=(NodeInteractor)getNodeInteractor();
  interactor.setSelectionModel(sm);
  VergilApplication application=VergilApplication.getInstance();
  Action action=application.getAction("String_Node_Str");
  ActionInteractor actionInteractor=new ActionInteractor(action);
  actionInteractor.setConsuming(false);
  actionInteractor.setMouseFilter(new MouseFilter(1,0,0,2));
  interactor.addInteractor(actionInteractor);
  interactor.setDragInteractor(interactor.getDragInteractor());
  _menuCreator=new MenuCreator(new EntityContextMenuFactory(controller));
  interactor.addInteractor(_menuCreator);
  Filter portFilter=new Filter(){
    public boolean accept(    Object o){
      if (o instanceof Port) {
        return true;
      }
 else {
        return false;
      }
    }
  }
;
  GlobalLayout layout=new EntityLayout();
  controller.addGraphViewListener(new IncrementalLayoutListener(new IncrLayoutAdapter(layout),portFilter));
}

Fixed version (ground truth):
/** 
 * Create an entity controller associated with the specified graph controller.
 * @param controller The associated graph controller.
 */
public EntityController(GraphController controller){
  super(controller);
  setNodeRenderer(new EntityRenderer());
  SelectionModel sm=controller.getSelectionModel();
  NodeInteractor interactor=(NodeInteractor)getNodeInteractor();
  interactor.setSelectionModel(sm);
  VergilApplication application=VergilApplication.getInstance();
  Action action=application.getAction("String_Node_Str");
  ActionInteractor actionInteractor=new ActionInteractor(action);
  actionInteractor.setConsuming(false);
  actionInteractor.setMouseFilter(new MouseFilter(1,0,0,2));
  interactor.addInteractor(actionInteractor);
  interactor.setDragInteractor(interactor.getDragInteractor());
  _menuCreator=new MenuCreator(new EntityContextMenuFactory(controller));
  interactor.addInteractor(_menuCreator);
  Filter portFilter=new Filter(){
    public boolean accept(    Object o){
      GraphModel model=getController().getGraphModel();
      if (o instanceof Port && model.getParent(o) instanceof Icon) {
        return true;
      }
 else {
        return false;
      }
    }
  }
;
  GlobalLayout layout=new EntityLayout();
  controller.addGraphViewListener(new IncrementalLayoutListener(new IncrLayoutAdapter(layout),portFilter));
}
Program: 76053
Project: 76053
Buggy source:
public boolean accept(Object o){
  if (o instanceof Port) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean accept(Object o){
  GraphModel model=getController().getGraphModel();
  if (o instanceof Port && model.getParent(o) instanceof Icon) {
    return true;
  }
 else {
    return false;
  }
}
Program: 76054
Project: 76054
Buggy source:
private byte[] _doubleArrayToByteArray(double[][] doubleArray,int bytesPerSample,int channels){
  int lengthInSamples=doubleArray[0].length;
  double maxSample;
  if (bytesPerSample == 2) {
    maxSample=32768;
  }
 else   if (bytesPerSample == 1) {
    maxSample=128;
  }
 else   if (bytesPerSample == 3) {
    maxSample=8388608;
  }
 else   if (bytesPerSample == 4) {
    maxSample=147483648e9;
  }
 else {
    maxSample=0;
  }
  byte[] byteArray=new byte[lengthInSamples * bytesPerSample * channels];
  byte[] b=new byte[bytesPerSample];
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    int l;
    for (int currChannel=0; currChannel < channels; currChannel++) {
      if (doubleArray[currChannel][currSamp] > 1) {
        l=(int)maxSample;
      }
 else       if (doubleArray[currChannel][currSamp] < -1) {
        l=(int)(-maxSample);
      }
 else {
        l=(int)(doubleArray[currChannel][currSamp] * maxSample);
      }
      for (int i=0; i < bytesPerSample; i+=1, l>>=8)       b[bytesPerSample - i - 1]=(byte)l;
      for (int i=0; i < bytesPerSample; i+=1) {
        byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i]=b[i];
      }
    }
  }
  return byteArray;
}

Fixed version (ground truth):
private byte[] _doubleArrayToByteArray(double[][] doubleArray,int bytesPerSample,int channels){
  int lengthInSamples=doubleArray[0].length;
  double maxSample;
  if (bytesPerSample == 2) {
    maxSample=32768;
  }
 else   if (bytesPerSample == 1) {
    maxSample=128;
  }
 else   if (bytesPerSample == 3) {
    maxSample=8388608;
  }
 else   if (bytesPerSample == 4) {
    maxSample=147483648e9;
  }
 else {
    maxSample=0;
  }
  byte[] byteArray=new byte[lengthInSamples * bytesPerSample * channels];
  byte[] b=new byte[bytesPerSample];
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    int l;
    for (int currChannel=0; currChannel < channels; currChannel++) {
      if (doubleArray[currChannel][currSamp] >= 1) {
        l=(int)maxSample - 1;
      }
 else       if (doubleArray[currChannel][currSamp] <= -1) {
        l=(int)(-maxSample) + 1;
      }
 else {
        l=(int)(doubleArray[currChannel][currSamp] * maxSample);
      }
      for (int i=0; i < bytesPerSample; i+=1, l>>=8)       b[bytesPerSample - i - 1]=(byte)l;
      for (int i=0; i < bytesPerSample; i+=1) {
        byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i]=b[i];
      }
    }
  }
  return byteArray;
}
Program: 76055
Project: 76055
Buggy source:
private byte[] _intArrayToByteArray(int[][] intArray,int bytesPerSample,int channels){
  int lengthInSamples=intArray[0].length;
  byte[] byteArray=new byte[lengthInSamples * bytesPerSample * channels];
  byte[] b=new byte[bytesPerSample];
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    for (int currChannel=0; currChannel < channels; currChannel++) {
      int l=intArray[currChannel][currSamp];
      for (int i=0; i < bytesPerSample; i+=1, l>>=8)       b[bytesPerSample - i - 1]=(byte)l;
      for (int i=0; i < bytesPerSample; i+=1) {
        byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i]=b[i];
      }
    }
  }
  return byteArray;
}

Fixed version (ground truth):
private byte[] _intArrayToByteArray(int[][] intArray,int bytesPerSample,int channels){
  int lengthInSamples=intArray[0].length;
  byte[] byteArray=new byte[lengthInSamples * bytesPerSample * channels];
  byte[] b=new byte[bytesPerSample];
  for (int currSamp=0; currSamp < lengthInSamples; currSamp++) {
    for (int currChannel=0; currChannel < channels; currChannel++) {
      int l=intArray[currChannel][currSamp];
      int maxSample;
      if (bytesPerSample == 2) {
        maxSample=32768;
      }
 else       if (bytesPerSample == 1) {
        maxSample=128;
      }
 else       if (bytesPerSample == 3) {
        maxSample=8388608;
      }
 else       if (bytesPerSample == 4) {
        maxSample=1474836480;
      }
 else {
        maxSample=0;
      }
      if (l > (maxSample - 1)) {
        l=maxSample - 1;
      }
 else       if (l < (-maxSample + 1)) {
        l=-maxSample + 1;
      }
      for (int i=0; i < bytesPerSample; i+=1, l>>=8)       b[bytesPerSample - i - 1]=(byte)l;
      for (int i=0; i < bytesPerSample; i+=1) {
        byteArray[currSamp * bytesPerSample * channels + bytesPerSample * currChannel + i]=b[i];
      }
    }
  }
  return byteArray;
}
Program: 76056
Project: 76056
Buggy source:
/** 
 * Check parameters and begin the sound capture process. If the capture source is a sound file, the file is opened for writing. Any existing file of the same name will be silently overwritten.
 * @exception IllegalActionException If the parametersare out of range.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  if (_debugging)   _debug("String_Node_Str");
  _initializeCapture();
  _haveASample=false;
}

Fixed version (ground truth):
/** 
 * Check parameters and begin the sound capture process. If the capture source is a sound file, the file is opened for writing. Any existing file of the same name will be silently overwritten.
 * @exception IllegalActionException If the parametersare out of range.
 */
public void initialize() throws IllegalActionException {
  super.initialize();
  if (_debugging)   _debug("String_Node_Str");
  _initializeCapture();
  _safeToInitialize=true;
  _haveASample=false;
}
Program: 76057
Project: 76057
Buggy source:
/** 
 * Stop capturing audio. This method should be called when no more calls to getSamples(). are required, so that the system resources involved in the audio capture may be freed.
 * @exception IOException If there is a problem closing theaudio resources.
 */
public void stopCapture() throws IOException {
  _isAudioCaptureActive=false;
  if (_audioInputStream != null) {
    _audioInputStream.close();
  }
  if (_properFormatAudioInputStream != null) {
    _properFormatAudioInputStream.close();
  }
  if (_targetLine != null) {
    _targetLine.close();
  }
}

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

Fixed version (ground truth):
/** 
 * Stop playing/writing audio. This method should be called when no more calls to putSamples(). are required, so that the system resources involved in the audio playback may be freed. <p> If the "write audio data to file" constructor was used, then the sound file specified by the constructor is saved and closed.
 * @exception IOException If there is a problem closing theaudio resources, or if the "write audio data  to file" constructor was used  and the sound file has an unsupported format.
 */
public void stopPlayback() throws IOException {
  _isAudioPlaybackActive=false;
  if (_playbackMode == "String_Node_Str") {
    if (_sourceLine != null) {
      _sourceLine.drain();
      _sourceLine.stop();
      _sourceLine.close();
    }
    _sourceLine=null;
  }
 else   if (_playbackMode == "String_Node_Str") {
    _stopPlaybackToFile();
  }
 else {
  }
}
Program: 76060
Project: 76060
Buggy source:
/** 
 * If there are at least <i>count</i> tokens on the input port, invoke <i>count</i> iterations of this actor. Otherwise, do nothing, and return a value of COMPLETED. One token is read from each channel in an iteration.  The audio output is either a sound file and/or the speaker, depending on the current  mode, which is controlled by the value of the <i>pathName</i>  parameter.
 * @return COMPLETED if the actor was successfully iterated thespecified number of times. Otherwise, throw an exception.
 * @exception IllegalActionException If the <i>count</i> samplescannot be written to the audio output device.
 */
public int iterate(int count) throws IllegalActionException {
  if (_debugging)   _debug("String_Node_Str" + count);
  for (int j=0; j < _channels; j++) {
    if (input.hasToken(j,count)) {
      _inArray[j]=input.get(j,count);
    }
 else {
      return COMPLETED;
    }
  }
  for (int k=0; k < count; k++) {
    for (int m=0; m < _channels; m++) {
      double deleteMePlease=((DoubleToken)_inArray[m][k]).doubleValue();
      _audioPutArray[m][_curElement]=((DoubleToken)_inArray[m][k]).doubleValue();
    }
    _curElement++;
    if (_curElement == _putSampleSize) {
      try {
        _soundPlayback.putSamples(_audioPutArray);
      }
 catch (      Exception ex) {
        throw new IllegalActionException("String_Node_Str" + ex.getMessage());
      }
      _curElement=0;
    }
  }
  return COMPLETED;
}

Fixed version (ground truth):
/** 
 * If there are at least <i>count</i> tokens on the input port, invoke <i>count</i> iterations of this actor. Otherwise, do nothing, and return a value of COMPLETED. One token is read from each channel in an iteration.  The audio output is either a sound file and/or the speaker, depending on the current  mode, which is controlled by the value of the <i>pathName</i>  parameter.
 * @return COMPLETED if the actor was successfully iterated thespecified number of times. Otherwise, throw an exception.
 * @exception IllegalActionException If the <i>count</i> samplescannot be written to the audio output device.
 */
public int iterate(int count) throws IllegalActionException {
  if (_debugging)   _debug("String_Node_Str" + count);
  for (int j=0; j < _channels; j++) {
    if (input.hasToken(j,count)) {
      _inArray[j]=input.get(j,count);
    }
 else {
      return COMPLETED;
    }
  }
  for (int k=0; k < count; k++) {
    for (int m=0; m < _channels; m++) {
      _audioPutArray[m][_curElement]=((DoubleToken)_inArray[m][k]).doubleValue();
    }
    _curElement++;
    if (_curElement == _putSampleSize) {
      try {
        _soundPlayback.putSamples(_audioPutArray);
      }
 catch (      Exception ex) {
        throw new IllegalActionException("String_Node_Str" + ex.getMessage());
      }
      _curElement=0;
    }
  }
  return COMPLETED;
}
Program: 76064
Project: 76064
Buggy source:
/** 
 * Set current time to zero, invoke the preinitialize() methods of all actors deeply contained by the container, and calculate priorities for simultaneous events. To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their preinitialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException If there is a delay-free loop, orif the preinitialize() method of the container or one of the deeply contained actors throws it.
 */
public void preinitialize() throws IllegalActionException {
  _eventQueue=new DECQEventQueue(((IntToken)minBinCount.getToken()).intValue(),((IntToken)binCountFactor.getToken()).intValue(),((BooleanToken)isCQAdaptive.getToken()).booleanValue());
  Iterator listeners=_debugListeners.iterator();
  while (listeners.hasNext()) {
    DebugListener listener=(DebugListener)listeners.next();
    _eventQueue.addDebugListener(listener);
  }
  _deadActors=null;
  _currentTime=0.0;
  _noMoreActorsToFire=false;
  _microstep=0;
  _startTime=Double.MAX_VALUE;
  super.preinitialize();
}

Fixed version (ground truth):
/** 
 * Set current time to zero, invoke the preinitialize() methods of all actors deeply contained by the container, and calculate priorities for simultaneous events. To be able to calculate the priorities, it is essential that the graph not have a delay-free loop.  If it does, then this can be corrected by inserting a DEDelay actor with a zero-valued delay.  This has the effect of breaking the loop for the purposes of calculating priorities, without introducing a time delay. <p> This method should be invoked once per execution, before any iteration. Actors may produce output data in their preinitialize() methods, or more commonly, they may schedule pure events. This method is <i>not</i> synchronized on the workspace, so the caller should be.
 * @exception IllegalActionException If there is a delay-free loop, orif the preinitialize() method of the container or one of the deeply contained actors throws it.
 */
public void preinitialize() throws IllegalActionException {
  _eventQueue=new DECQEventQueue(((IntToken)minBinCount.getToken()).intValue(),((IntToken)binCountFactor.getToken()).intValue(),((BooleanToken)isCQAdaptive.getToken()).booleanValue());
  if (_debugListeners != null) {
    Iterator listeners=_debugListeners.iterator();
    while (listeners.hasNext()) {
      DebugListener listener=(DebugListener)listeners.next();
      _eventQueue.addDebugListener(listener);
    }
  }
  _deadActors=null;
  _currentTime=0.0;
  _noMoreActorsToFire=false;
  _microstep=0;
  _startTime=Double.MAX_VALUE;
  super.preinitialize();
}
Program: 76065
Project: 76065
Buggy source:
/** 
 * Return true if put() will succeed in accepting a token.
 * @return A boolean indicating whether a token can be put in thisreceiver.
 * @exception IllegalActionException If the number of tokens is lessthan one.
 */
public boolean hasRoom(int tokens) throws IllegalActionException {
  if (tokens < 1)   throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  return (_queue.size() + tokens) < _queue.getCapacity();
}

Fixed version (ground truth):
/** 
 * Return true if put() will succeed in accepting the specified number of tokesn.
 * @param tokens The number of tokens.
 * @return A boolean indicating whether a token can be put in thisreceiver.
 * @exception IllegalActionException If the number of tokens is lessthan one.
 */
public boolean hasRoom(int tokens) throws IllegalActionException {
  if (_queue.getCapacity() == INFINITE_CAPACITY) {
    return true;
  }
  if (tokens < 1)   throw new IllegalActionException("String_Node_Str" + "String_Node_Str");
  return (_queue.size() + tokens) < _queue.getCapacity();
}
Program: 76066
Project: 76066
Buggy source:
/** 
 * Delete a node from its parent graph and notify graph listeners with a NODE_REMOVED event.
 */
public void removeNode(final Vertex vertex){
  final ComponentRelation relation=(ComponentRelation)vertex.getContainer();
  _doChangeRequest(new RemoveRelation(vertex,relation));
}

Fixed version (ground truth):
/** 
 * Delete a node from its parent graph and notify graph listeners with a NODE_REMOVED event.
 */
public void removeNode(Object eventSource,final Vertex vertex){
  final ComponentRelation relation=(ComponentRelation)vertex.getContainer();
  _doChangeRequest(new RemoveRelation(vertex,relation));
}