nus-yam/ex-repair huggingface dataset:
Program: 32536
Project: 32536
Buggy source:
/** 
 * {@inheritDoc} 
 */
public boolean matches(E item){
  filterComparables.clear();
  if (filterator == null)   filterComparables.add((D)item);
 else   filterator.getFilterValues(filterComparables,item);
  for (int c=0; c < filterComparables.size(); c++) {
    D filterComparable=filterComparables.get(c);
    if (filterComparable != null) {
      if (start != null && start.compareTo(filterComparable) == 1)       continue;
      if (end != null && end.compareTo(filterComparable) == -1)       continue;
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public boolean matches(E item){
  filterComparables.clear();
  if (filterator == null)   filterComparables.add((D)item);
 else   filterator.getFilterValues(filterComparables,item);
  for (int c=0; c < filterComparables.size(); c++) {
    D filterComparable=filterComparables.get(c);
    if (filterComparable != null) {
      if (start != null && start.compareTo(filterComparable) > 0)       continue;
      if (end != null && end.compareTo(filterComparable) < 0)       continue;
    }
    return true;
  }
  return false;
}
Program: 32537
Project: 32537
Buggy source:
/** 
 * Respond to requests for values to fill Virtual rows.
 */
public void handleEvent(Event e){
  TableItem item=(TableItem)e.item;
  int whiteIndex=requested.getWhiteIndex(table.getTopIndex(),false);
  int index=requested.getIndex(whiteIndex,Barcode.WHITE);
  requested.setBlack(index,1);
  renderTableItem(item,source.get(index),index);
}

Fixed version (ground truth):
/** 
 * Respond to requests for values to fill Virtual rows.
 */
public void handleEvent(Event e){
  TableItem item=(TableItem)e.item;
  int whiteIndex=requested.getWhiteIndex(table.indexOf(item),false);
  int index=requested.getIndex(whiteIndex,Barcode.WHITE);
  requested.setBlack(index,1);
  renderTableItem(item,source.get(index),index);
}
Program: 32538
Project: 32538
Buggy source:
/** 
 * Responds to a single click or arrow key based selection.
 */
public void widgetSelected(SelectionEvent event){
  if (!selectionInProgress) {
    selectionInProgress=true;
    selection.setSelection(selectable.getSelectionIndices());
    selectionInProgress=false;
  }
}

Fixed version (ground truth):
/** 
 * Responds to a single click or arrow key based selection.
 */
public void widgetSelected(SelectionEvent event){
  if (!selectionInProgress) {
    selectionInProgress=true;
    selection.getSource().getReadWriteLock().writeLock().lock();
    try {
      selection.setSelection(selectable.getSelectionIndices());
    }
  finally {
      selection.getSource().getReadWriteLock().writeLock().unlock();
    }
    selectionInProgress=false;
  }
}
Program: 32539
Project: 32539
Buggy source:
private Table formatIssuesTable(Table issuesTable){
  issuesTable.getVerticalBar().setEnabled(true);
  issuesTable.getColumn(0).setWidth(30);
  issuesTable.getColumn(0).setResizable(false);
  issuesTable.getColumn(1).setWidth(50);
  issuesTable.getColumn(2).setWidth(46);
  issuesTable.getColumn(2).setResizable(false);
  issuesTable.getColumn(3).setWidth(50);
  issuesTable.getColumn(4).setWidth(60);
  issuesTable.getColumn(5).setWidth(250);
  return issuesTable;
}

Fixed version (ground truth):
private Table formatIssuesTable(Table issuesTable){
  issuesTable.getVerticalBar().setEnabled(true);
  return issuesTable;
}
Program: 32541
Project: 32541
Buggy source:
/** 
 * Updates a row with the given value.
 */
public void updateRow(int row,E value){
  if (!isVirtual(row)) {
    requested.setBlack(row,1);
    TableItem item=table.getItem(row);
    setItemText(item,value);
  }
}

Fixed version (ground truth):
/** 
 * Updates a row with the given value.
 */
public void updateRow(int row,E value){
  if (!isVirtual(row)) {
    requested.setBlack(row,1);
    TableItem item=table.getItem(row);
    renderTableItem(item,value);
  }
}
Program: 32542
Project: 32542
Buggy source:
/** 
 * Respond to requests for values to fill Virtual rows.
 */
public void handleEvent(Event e){
  TableItem item=(TableItem)e.item;
  int whiteIndex=requested.getWhiteIndex(table.getTopIndex(),false);
  int index=requested.getIndex(whiteIndex,Barcode.WHITE);
  requested.setBlack(index,1);
  setItemText(item,swtThreadSource.get(index));
}

Fixed version (ground truth):
/** 
 * Respond to requests for values to fill Virtual rows.
 */
public void handleEvent(Event e){
  TableItem item=(TableItem)e.item;
  int whiteIndex=requested.getWhiteIndex(table.getTopIndex(),false);
  int index=requested.getIndex(whiteIndex,Barcode.WHITE);
  requested.setBlack(index,1);
  renderTableItem(item,swtThreadSource.get(index));
}
Program: 32543
Project: 32543
Buggy source:
/** 
 * Adds a row with the given value.
 */
public void addRow(int row,E value){
  if (row <= getLastIndex()) {
    requested.addBlack(row,1);
    TableItem item=new TableItem(table,0,row);
    setItemText(item,value);
  }
 else {
    requested.addWhite(requested.size(),1);
    table.setItemCount(table.getItemCount() + 1);
  }
}

Fixed version (ground truth):
/** 
 * Adds a row with the given value.
 */
public void addRow(int row,E value){
  if (row <= getLastIndex()) {
    requested.addBlack(row,1);
    TableItem item=new TableItem(table,0,row);
    renderTableItem(item,value);
  }
 else {
    requested.addWhite(requested.size(),1);
    table.setItemCount(table.getItemCount() + 1);
  }
}
Program: 32544
Project: 32544
Buggy source:
/** 
 * Builds the columns and headers for the   {@link Table}
 */
private void initTable(){
  table.setHeaderVisible(true);
  for (int c=0; c < tableFormat.getColumnCount(); c++) {
    TableColumn column=new TableColumn(table,SWT.LEFT,c);
    column.setText(tableFormat.getColumnName(c));
    column.setWidth(80);
  }
}

Fixed version (ground truth):
/** 
 * Builds the columns and headers for the   {@link Table}
 */
private void initTable(){
  table.setHeaderVisible(true);
  final TableColumnConfigurer configurer=getTableColumnConfigurer();
  for (int c=0; c < tableFormat.getColumnCount(); c++) {
    TableColumn column=new TableColumn(table,SWT.LEFT,c);
    column.setText(tableFormat.getColumnName(c));
    column.setWidth(80);
    if (configurer != null) {
      configurer.configure(column,c);
    }
  }
}
Program: 32545
Project: 32545
Buggy source:
/** 
 * Creates a new viewer for the given   {@link Table} that updates the tablecontents in response to changes on the specified  {@link EventList}. The  {@link Table} is formatted with the specified {@link TableFormat}.
 * @param source the EventList that provides the row objects
 * @param table the Table viewing the source objects
 * @param tableFormat the object responsible for extracting column datafrom the row objects
 */
public EventTableViewer(EventList<E> source,Table table,TableFormat<? super E> tableFormat){
  source.getReadWriteLock().readLock().lock();
  try {
    this.source=swtThreadSource=GlazedListsSWT.swtThreadProxyList(source,table.getDisplay());
    if ((table.getStyle() & SWT.CHECK) == SWT.CHECK)     this.source=checkFilterList=new TableCheckFilterList<E,E>(swtThreadSource,table,tableFormat);
    this.table=table;
    this.tableFormat=tableFormat;
    selection=new SelectionManager<E>(this.source,new SelectableTable());
    if ((table.getStyle() & SWT.VIRTUAL) == SWT.VIRTUAL) {
      tableHandler=new VirtualTableHandler();
    }
 else {
      tableHandler=new DefaultTableHandler();
    }
    initTable();
    tableHandler.populateTable();
    this.source.addListEventListener(this);
  }
  finally {
    source.getReadWriteLock().readLock().unlock();
  }
}

Fixed version (ground truth):
/** 
 * Creates a new viewer for the given   {@link Table} that updates the tablecontents in response to changes on the specified  {@link EventList}. The  {@link Table} is formatted with the specified {@link TableFormat}.  The table items, e.g. the cell values, are formatted with the specified   {@link TableItemRenderer}.
 * @param source the EventList that provides the row objects
 * @param table the Table viewing the source objects
 * @param tableFormat the object responsible for extracting column datafrom the row objects
 * @param tableItemRenderer the renderer responsible to configure TableItems for display
 */
public EventTableViewer(EventList<E> source,Table table,TableFormat<? super E> tableFormat,TableItemRenderer tableItemRenderer){
  source.getReadWriteLock().writeLock().lock();
  try {
    this.source=swtThreadSource=GlazedListsSWT.swtThreadProxyList(source,table.getDisplay());
    if ((table.getStyle() & SWT.CHECK) == SWT.CHECK)     this.source=checkFilterList=new TableCheckFilterList<E,E>(swtThreadSource,table,tableFormat);
    this.table=table;
    this.tableFormat=tableFormat;
    this.tableItemRenderer=tableItemRenderer;
    selection=new SelectionManager<E>(this.source,new SelectableTable());
    if ((table.getStyle() & SWT.VIRTUAL) == SWT.VIRTUAL) {
      tableHandler=new VirtualTableHandler();
    }
 else {
      tableHandler=new DefaultTableHandler();
    }
    initTable();
    tableHandler.populateTable();
    this.source.addListEventListener(this);
  }
  finally {
    source.getReadWriteLock().writeLock().unlock();
  }
}
Program: 32546
Project: 32546
Buggy source:
/** 
 * Returns a new empty   {@link DebugList} which shares the same{@link ListEventListener} and {@link ReadWriteLock} with this DebugList.This method is particularly useful when debugging a  {@link CompositeList}where some member lists are DebugLists and thus must share an identical publisher and locks in order to participate in the CompositeList.
 */
public DebugList<E> createNewDebugList(){
  return new DebugList<E>(getPublisher(),debugReadWriteLock);
}

Fixed version (ground truth):
/** 
 * Returns a new empty   {@link DebugList} which shares the same{@link ListEventListener} and {@link ReadWriteLock} with this DebugList.This method is particularly useful when debugging a  {@link CompositeList}where some member lists are DebugLists and thus must share an identical publisher and locks in order to participate in the CompositeList.
 */
public <E>DebugList<E> createNewDebugList(){
  return new DebugList<E>(getPublisher(),debugReadWriteLock);
}
Program: 32547
Project: 32547
Buggy source:
public void testCreateNewDebugList(){
  DebugList<String> list1=new DebugList<String>();
  DebugList<String> list2=list1.createNewDebugList();
  assertSame(list1.getPublisher(),list2.getPublisher());
  assertSame(list1.getReadWriteLock(),list2.getReadWriteLock());
  assertSame(list1.getReadWriteLock().readLock(),list2.getReadWriteLock().readLock());
  assertSame(list1.getReadWriteLock().writeLock(),list2.getReadWriteLock().writeLock());
  list1.add("String_Node_Str");
  assertEquals(1,list1.size());
  assertEquals(0,list2.size());
}

Fixed version (ground truth):
public void testCreateNewDebugList(){
  DebugList<String> list1=new DebugList<String>();
  DebugList<Integer> list2=list1.createNewDebugList();
  assertSame(list1.getPublisher(),list2.getPublisher());
  assertSame(list1.getReadWriteLock(),list2.getReadWriteLock());
  assertSame(list1.getReadWriteLock().readLock(),list2.getReadWriteLock().readLock());
  assertSame(list1.getReadWriteLock().writeLock(),list2.getReadWriteLock().writeLock());
  list1.add("String_Node_Str");
  assertEquals(1,list1.size());
  assertEquals(0,list2.size());
}
Program: 32548
Project: 32548
Buggy source:
public int compare(String a,String b){
  boolean aIsUpperCase=Character.isUpperCase(a.charAt(0));
  boolean bIsUpperCase=Character.isUpperCase(b.charAt(0));
  return Boolean.valueOf(aIsUpperCase).compareTo(Boolean.valueOf(bIsUpperCase));
}

Fixed version (ground truth):
public int compare(String a,String b){
  boolean aIsUpperCase=Character.isUpperCase(a.charAt(0));
  boolean bIsUpperCase=Character.isUpperCase(b.charAt(0));
  return (bIsUpperCase == aIsUpperCase ? 0 : (aIsUpperCase ? 1 : -1));
}
Program: 32549
Project: 32549
Buggy source:
public int compareTo(final AFirstLetterComparable o){
  return Character.valueOf(contained.getName().charAt(0)).compareTo(new Character(o.contained.getName().charAt(0)));
}

Fixed version (ground truth):
public int compareTo(final AFirstLetterComparable o){
  return new Character(contained.getName().charAt(0)).compareTo(new Character(o.contained.getName().charAt(0)));
}
Program: 32550
Project: 32550
Buggy source:
public void listChanged(ListEvent<E> listChanges){
  count++;
}

Fixed version (ground truth):
public void listChanged(ListEvent listChanges){
  lastSource=listChanges.getSourceList();
}
Program: 32551
Project: 32551
Buggy source:
/** 
 * Construct a new node.
 * @param virtual <code>true</code> if this node is initially virtual
 * @param path the tree path from root to value that this node represents. Itis an error to mutate this path once it has been provided to a node.
 */
private Node(boolean virtual,List<E> path){
  reset();
  this.virtual=virtual;
  this.path=path;
}

Fixed version (ground truth):
/** 
 * Construct a new node.
 * @param virtual <code>true</code> if this node is initially virtual
 * @param path the tree path from root to value that this node represents. Itis an error to mutate this path once it has been provided to a node.
 */
private Node(boolean virtual,List<E> path){
  this.virtual=virtual;
  this.path=path;
}
Program: 32552
Project: 32552
Buggy source:
private void incrementPredecessor(){
  if (predecessor.siblingAfter != null && predecessor.siblingAfter != current) {
    nodesToAttach.addInOrder(predecessor.siblingAfter);
    predecessor.siblingAfter.siblingBefore=null;
    predecessor.siblingAfter=null;
  }
  predecessorAtOurHeight=predecessor;
  predecessor=predecessor.parent;
}

Fixed version (ground truth):
private void incrementPredecessor(){
  if (predecessor.siblingAfter != null && predecessor.siblingAfter != current) {
    nodesToAttach.queueOutOfOrderNodeForAttaching(predecessor.siblingAfter);
    predecessor.siblingAfter.siblingBefore=null;
    predecessor.siblingAfter=null;
  }
  predecessorAtOurHeight=predecessor;
  predecessor=predecessor.parent;
}
Program: 32553
Project: 32553
Buggy source:
/** 
 * Attach the default parent for the specified node, using the node's ability to describe a prototype for its parent object.
 */
private void createAndAttachParent(){
  Node<E> parent=current.describeParent();
  if (parent != null) {
    addNode(parent,HIDDEN_VIRTUAL,expansionModel,index);
  }
  attachParent(parent,null);
}

Fixed version (ground truth):
/** 
 * Attach the default parent for the specified node, using the node's ability to describe a prototype for its parent object.
 */
private void createAndAttachParent(){
  Node<E> parent=current.describeParent();
  if (parent != null) {
    parent.expanded=expansionModel.isExpanded(parent.getElement(),parent.path);
    addNode(parent,HIDDEN_VIRTUAL,index);
  }
  attachParent(parent,null);
}
Program: 32554
Project: 32554
Buggy source:
public InitializationData(EventList<E> sourceElements,Format<E> format,Comparator<E> comparator,ExpansionModel<E> expansionModel){
  this.format=format;
  this.expansionModel=expansionModel;
  this.sourceElements=sourceElements;
  this.sourceNodes=new FunctionList<E,Node<E>>(sourceElements,new ElementToTreeNodeFunction<E>(format),NO_OP_FUNCTION);
  if (comparator != null) {
    this.nodeComparator=comparatorToNodeComparator(comparator,format);
    this.sortedList=new SortedList<Node<E>>(sourceNodes,nodeComparator);
  }
 else {
    this.nodeComparator=comparatorToNodeComparator((Comparator)GlazedLists.comparableComparator(),format);
    this.sortedList=null;
  }
}

Fixed version (ground truth):
public InitializationData(EventList<E> sourceElements,Format<E> format,Comparator<E> comparator,ExpansionModel<E> expansionModel){
  this.format=format;
  this.expansionModel=expansionModel;
  this.sourceElements=sourceElements;
  this.sourceNodes=new FunctionList<E,Node<E>>(sourceElements,new ElementToTreeNodeFunction<E>(format,expansionModel),NO_OP_FUNCTION);
  if (comparator != null) {
    this.nodeComparator=comparatorToNodeComparator(comparator,format);
    this.sortedList=new SortedList<Node<E>>(sourceNodes,nodeComparator);
  }
 else {
    this.nodeComparator=comparatorToNodeComparator((Comparator)GlazedLists.comparableComparator(),format);
    this.sortedList=null;
  }
}
Program: 32555
Project: 32555
Buggy source:
/** 
 * Prepare the state of the node and insert it into the datastore. It will still be necessary to attach parent and sibling nodes.
 */
private void addNode(Node<E> node,byte nodeColor,ExpansionModel<E> expansionModel,int realIndex){
  node.expanded=expansionModel.isExpanded(node.getElement(),node.path);
  node.element=data.add(realIndex,ALL_NODES,nodeColor,node,1);
}

Fixed version (ground truth):
/** 
 * Prepare the state of the node and insert it into the datastore. It will still be necessary to attach parent and sibling nodes.
 */
private void addNode(Node<E> node,byte nodeColor,int realIndex){
  node.element=data.add(realIndex,ALL_NODES,nodeColor,node,1);
}
Program: 32557
Project: 32557
Buggy source:
/** 
 * Walk up the tree, fixing parents and siblings of the specified changed node. Performing this fix may require: <li>attaching parents <li>attaching siblings <li>firing an 'insert' event for such parents and siblings
 * @param changed the node to attach parents and siblings to
 * @param newlyInserted <code>true</code> if this node is a brand-newnode in the tree, or <code>false</code> if we're reattaching an existing node. This has significant consequences for the logic that manages expanded state and repairing siblings.
 * @return <code>true</code> if changes were made to the tree
 */
private void attach(Node<E> changed,boolean newlyInserted){
  current=changed;
  if (newlyInserted) {
    expansionModel=TreeList.this.expansionModel;
  }
 else {
    expansionModel=new CloneStateNewNodeStateModel<E>(current);
  }
  index=data.indexOfNode(current.element,ALL_NODES);
  predecessor=current.previous();
  predecessorAtOurHeight=null;
  if (newlyInserted) {
    Node<E> follower=current.next();
    if (follower != null) {
      nodesToAttach.prependPotentiallySplit(follower);
    }
  }
  attachParentsAndSiblings();
  fixVisibilityAndFireEvents();
  pathToRoot.clear();
}

Fixed version (ground truth):
/** 
 * Walk up the tree, fixing parents and siblings of the specified changed node. Performing this fix may require: <li>attaching parents <li>attaching siblings <li>firing an 'insert' event for such parents and siblings
 * @param changed the node to attach parents and siblings to
 * @param newlyInserted <code>true</code> if this node is a brand-newnode in the tree, or <code>false</code> if we're reattaching an existing node. This has significant consequences for the logic that manages expanded state and repairing siblings.
 * @return <code>true</code> if changes were made to the tree
 */
private void attach(Node<E> changed,boolean newlyInserted){
  current=changed;
  if (newlyInserted) {
    expansionModel=TreeList.this.expansionModel;
  }
 else {
    expansionModel=new CloneStateNewNodeStateModel<E>(current);
  }
  index=data.indexOfNode(current.element,ALL_NODES);
  predecessor=current.previous();
  predecessorAtOurHeight=null;
  if (newlyInserted) {
    Node<E> follower=current.next();
    if (follower != null) {
      nodesToAttach.queuePrefixForAttaching(follower);
    }
  }
  attachParentsAndSiblings();
  fixVisibilityAndFireEvents();
  pathToRoot.clear();
}
Program: 32558
Project: 32558
Buggy source:
public ElementToTreeNodeFunction(Format<E> format){
  this.format=format;
}

Fixed version (ground truth):
public ElementToTreeNodeFunction(Format<E> format,ExpansionModel<E> expansionModel){
  this.format=format;
  this.expansionModel=expansionModel;
}
Program: 32559
Project: 32559
Buggy source:
DelegateLockFactory(){
  try {
    Class.forName("String_Node_Str");
    this.delegate=(LockFactory)Class.forName("String_Node_Str").newInstance();
  }
 catch (  Exception e) {
    this.delegate=new J2SE14LockFactory();
  }
}

Fixed version (ground truth):
DelegateLockFactory(){
  try {
    Class.forName("String_Node_Str");
    delegate=(LockFactory)Class.forName("String_Node_Str").newInstance();
  }
 catch (  Throwable t) {
    delegate=new J2SE14LockFactory();
  }
}
Program: 32560
Project: 32560
Buggy source:
public ReadWriteLock createReadWriteLock(){
  return this.delegate.createReadWriteLock();
}

Fixed version (ground truth):
public ReadWriteLock createReadWriteLock(){
  return delegate.createReadWriteLock();
}
Program: 32561
Project: 32561
Buggy source:
public Lock createLock(){
  return this.delegate.createLock();
}

Fixed version (ground truth):
public Lock createLock(){
  return delegate.createLock();
}
Program: 32562
Project: 32562
Buggy source:
public Node<E> reevaluate(E sourceValue,Node<E> transformedValue){
  transformedValue.path.clear();
  format.getPath(transformedValue.path,sourceValue);
  return transformedValue;
}

Fixed version (ground truth):
public Node<E> reevaluate(E sourceValue,Node<E> transformedValue){
  assert(!transformedValue.virtual);
  Node<E> result=evaluate(sourceValue);
  result.expanded=transformedValue.expanded;
  return result;
}
Program: 32563
Project: 32563
Buggy source:
public void testUpdatingElementsRetainExpandCollapseState(){
  EventList<String> source=new BasicEventList<String>();
  TreeList<String> treeList=new TreeList<String>(source,new CharacterTreeFormat(),TreeList.NODES_START_EXPANDED,String.CASE_INSENSITIVE_ORDER);
  ListConsistencyListener<String> listConsistencyListener=ListConsistencyListener.install(treeList);
  listConsistencyListener.setPreviousElementTracked(false);
  source.add(0,"String_Node_Str");
  source.add(1,"String_Node_Str");
  source.add(2,"String_Node_Str");
  source.add(3,"String_Node_Str");
  treeList.setExpanded(1,false);
  source.set(0,"String_Node_Str");
  assertTreeStructure(treeList,new String[]{"String_Node_Str","String_Node_Str"});
}

Fixed version (ground truth):
public void testUpdatingElementsRetainExpandCollapseState(){
  EventList<String> source=new BasicEventList<String>();
  TreeList<String> treeList=new TreeList<String>(source,new CharacterTreeFormat(),TreeList.NODES_START_EXPANDED,String.CASE_INSENSITIVE_ORDER);
  ListConsistencyListener<String> listConsistencyListener=ListConsistencyListener.install(treeList);
  listConsistencyListener.setPreviousElementTracked(false);
  source.add(0,"String_Node_Str");
  source.add(1,"String_Node_Str");
  source.add(2,"String_Node_Str");
  source.add(3,"String_Node_Str");
  treeList.setExpanded(2,false);
  treeList.setExpanded(1,false);
  source.set(0,"String_Node_Str");
  source.set(1,"String_Node_Str");
  assertTreeStructure(treeList,new String[]{"String_Node_Str","String_Node_Str"});
  treeList.setExpanded(1,true);
  assertTreeStructure(treeList,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"});
  assertFalse(treeList.isExpanded(2));
}
Program: 32564
Project: 32564
Buggy source:
/** 
 * This factory method creates and returns a   {@link DefaultCellEditor}which adapts an autocompleting   {@link JComboBox} for use as a TableCell Editor. The values within the <code>source</code> are used as autocompletion terms within the  {@link ComboBoxModel}. <p>If the appearance or function of the autocompleting   {@link JComboBox}is to be customized, it can be retrieved using  {@link DefaultCellEditor#getComponent()}.
 * @param source the source of data for the JComboBox within the table cell editor
 * @return a {@link DefaultCellEditor} which contains an autocompletingcombobox whose model contents are determined by the given <code>source</code>
 */
public static <E>DefaultCellEditor createTableCellEditor(EventList<E> source){
  final DefaultCellEditor cellEditor=new DefaultCellEditor(new TableCellComboBox());
  cellEditor.setClickCountToStart(2);
  AutoCompleteSupport autoCompleteSupport=AutoCompleteSupport.install((JComboBox)cellEditor.getComponent(),source);
  autoCompleteSupport.setSelectsTextOnFocusGain(false);
  return cellEditor;
}

Fixed version (ground truth):
/** 
 * This factory method creates and returns a   {@link AutoCompleteCellEditor}which adapts an autocompleting   {@link JComboBox} for use as a TableCell Editor. The values within the <code>source</code> are used as autocompletion terms within the  {@link ComboBoxModel}. <p>If the appearance or function of the autocompleting   {@link JComboBox}is to be customized, it can be retrieved using  {@link AutoCompleteCellEditor#getComponent()}.
 * @param source the source of data for the JComboBox within the table cell editor
 * @return a {@link AutoCompleteCellEditor} which contains an autocompletingcombobox whose model contents are determined by the given <code>source</code>
 */
public static <E>AutoCompleteCellEditor<E> createTableCellEditor(EventList<E> source){
  final JComboBox comboBox=new TableCellComboBox();
  comboBox.putClientProperty("String_Node_Str",Boolean.TRUE);
  final AutoCompleteSupport<E> autoCompleteSupport=AutoCompleteSupport.install(comboBox,source);
  autoCompleteSupport.setSelectsTextOnFocusGain(false);
  final AutoCompleteCellEditor<E> cellEditor=new AutoCompleteCellEditor<E>(autoCompleteSupport);
  cellEditor.setClickCountToStart(2);
  return cellEditor;
}
Program: 32565
Project: 32565
Buggy source:
public void guiTestCreateTableCellEditor(){
  final EventList<Integer> ints=new BasicEventList<Integer>();
  ints.add(new Integer(0));
  ints.add(new Integer(10));
  ints.add(new Integer(199));
  ints.add(new Integer(199));
  ints.add(new Integer(10));
  ints.add(new Integer(0));
  DefaultCellEditor editor=AutoCompleteSupport.createTableCellEditor(new IntegerTableFormat(),ints,0);
  JComboBox comboBox=(JComboBox)editor.getComponent();
  assertSame(ints.get(0),comboBox.getItemAt(0));
  assertSame(ints.get(1),comboBox.getItemAt(1));
  assertSame(ints.get(2),comboBox.getItemAt(2));
  editor=AutoCompleteSupport.createTableCellEditor(GlazedLists.reverseComparator(),new IntegerTableFormat(),ints,0);
  comboBox=(JComboBox)editor.getComponent();
  assertSame(ints.get(2),comboBox.getItemAt(0));
  assertSame(ints.get(1),comboBox.getItemAt(1));
  assertSame(ints.get(0),comboBox.getItemAt(2));
}

Fixed version (ground truth):
public void guiTestCreateTableCellEditor(){
  final EventList<Integer> ints=new BasicEventList<Integer>();
  ints.add(new Integer(0));
  ints.add(new Integer(10));
  ints.add(new Integer(199));
  ints.add(new Integer(199));
  ints.add(new Integer(10));
  ints.add(new Integer(0));
  AutoCompleteSupport.AutoCompleteCellEditor editor=AutoCompleteSupport.createTableCellEditor(new IntegerTableFormat(),ints,0);
  JComboBox comboBox=(JComboBox)editor.getComponent();
  assertSame(comboBox,editor.getAutoCompleteSupport().getComboBox());
  assertSame(ints.get(0),comboBox.getItemAt(0));
  assertSame(ints.get(1),comboBox.getItemAt(1));
  assertSame(ints.get(2),comboBox.getItemAt(2));
  editor=AutoCompleteSupport.createTableCellEditor(GlazedLists.reverseComparator(),new IntegerTableFormat(),ints,0);
  comboBox=(JComboBox)editor.getComponent();
  assertSame(comboBox,editor.getAutoCompleteSupport().getComboBox());
  assertSame(ints.get(2),comboBox.getItemAt(0));
  assertSame(ints.get(1),comboBox.getItemAt(1));
  assertSame(ints.get(0),comboBox.getItemAt(2));
}
Program: 32566
Project: 32566
Buggy source:
/** 
 * Create a new Connector for the   {@link ObservableElementList} that works withJavaBeans'  {@link java.beans.PropertyChangeListener}. The methods to add and remove listeners are specified by name. Such methods must take a single  {@link java.beans.PropertyChangeListener} argument.
 * @param beanClass a class with both methods as specified.
 * @param addListener a method name such as "addPropertyChangeListener"
 * @param removeListener a method name such as "removePropertyChangeListener"
 * @return an ObservableElementList.Connector for the specified class
 */
public static <E>ObservableElementList.Connector<E> beanConnector(Class<E> beanClass,String addListener,String removeListener){
  return new JavaBeanEventListConnector<E>(beanClass,addListener,removeListener);
}

Fixed version (ground truth):
/** 
 * Create a new Connector for the   {@link ObservableElementList} that works withJavaBeans'  {@link java.beans.PropertyChangeListener}. The methods to add and remove listeners are specified by name. Such methods must take a single  {@link java.beans.PropertyChangeListener} argument.<p> The event matcher allows filtering of  {@link java.beans.PropertyChangeEvent}s.  Only matching events are delivered to the ObservableElementList. To create a matcher that matches PropertyChangeEvents by property names, you can use  {@link Matchers#propertyEventNameMatcher(boolean,String[])}
 * @param beanClass a class with both methods as specified.
 * @param addListener a method name such as "addPropertyChangeListener"
 * @param removeListener a method name such as "removePropertyChangeListener"
 * @param eventMatcher for matching PropertyChangeEvents that will be delivered to theObservableElementList
 * @return an ObservableElementList.Connector for the specified class
 */
public static <E>ObservableElementList.Connector<E> beanConnector(Class<E> beanClass,String addListener,String removeListener,Matcher<PropertyChangeEvent> eventMatcher){
  final JavaBeanEventListConnector<E> result=new JavaBeanEventListConnector<E>(beanClass,addListener,removeListener);
  result.setEventMatcher(eventMatcher);
  return result;
}
Program: 32567
Project: 32567
Buggy source:
/** 
 * Start listening for PropertyChangeEvents from the specified <code>element</code>. The PropertyChangeListener is installed using reflection.
 * @param element the element to be observed
 * @param listener the listener that was installed on the <code>element</code>in  {@link #installListener(Object)}
 * @throws RuntimeException if the reflection call fails to successfullyuninstall the PropertyChangeListener
 */
public void uninstallListener(E element,EventListener listener){
  try {
    this.removeListenerMethod.invoke(element,this.reflectionParameters);
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
catch (  InvocationTargetException e) {
    throw new RuntimeException(e.getCause());
  }
}

Fixed version (ground truth):
/** 
 * Stop listening for PropertyChangeEvents from the specified <code>element</code>. The PropertyChangeListener is uninstalled using reflection.
 * @param element the observed element
 * @param listener the listener that was installed on the <code>element</code>in  {@link #installListener(Object)}
 * @throws RuntimeException if the reflection call fails to successfullyuninstall the PropertyChangeListener
 */
public void uninstallListener(E element,EventListener listener){
  try {
    this.removeListenerMethod.invoke(element,this.reflectionParameters);
  }
 catch (  IllegalAccessException e) {
    throw new RuntimeException(e);
  }
catch (  InvocationTargetException e) {
    throw new RuntimeException(e.getCause());
  }
}
Program: 32568
Project: 32568
Buggy source:
public void propertyChange(PropertyChangeEvent event){
  ((ObservableElementList)list).elementChanged(event.getSource());
}

Fixed version (ground truth):
public void propertyChange(PropertyChangeEvent event){
  if (getEventMatcher().matches(event))   ((ObservableElementList)list).elementChanged(event.getSource());
}
Program: 32569
Project: 32569
Buggy source:
/** 
 * Attach the specified parent to the specified node.
 * @param parent the parent node, may be <code>null</code>
 * @param siblingBeforeNode the node immediately before the node of interestwho is a child of the same parent. This will be linked in as the new node's sibling. If <code>null</code>, no linking/unlinking will be performed.
 */
private void attachParent(Node<E> parent,Node<E> siblingBeforeNode){
  assert(current != null);
  assert((current.pathLength() == 1 && parent == null) || (current.pathLength() == parent.pathLength() + 1));
  if (siblingBeforeNode != null && siblingBeforeNode.siblingAfter != current) {
    if (siblingBeforeNode.pathLength() != current.pathLength()) {
      throw new IllegalStateException();
    }
    assert(siblingBeforeNode.parent == parent);
    if (siblingBeforeNode.siblingAfter != null) {
      assert(current.siblingAfter == null);
      current.siblingAfter=siblingBeforeNode.siblingAfter;
      siblingBeforeNode.siblingAfter.siblingBefore=current;
    }
    current.siblingBefore=siblingBeforeNode;
    siblingBeforeNode.siblingAfter=current;
    assert(current.siblingBefore != current);
    assert(current.siblingAfter != current);
  }
  for (Node<E> currentSibling=current; currentSibling != null; currentSibling=currentSibling.siblingAfter) {
    currentSibling.parent=parent;
  }
  incrementCurrent();
}

Fixed version (ground truth):
/** 
 * Attach the specified parent to the specified node.
 * @param parent the parent node, may be <code>null</code>
 * @param siblingBeforeNode the node immediately before the node of interestwho is a child of the same parent. This will be linked in as the new node's sibling. If <code>null</code>, no linking/unlinking will be performed.
 */
private void attachParent(Node<E> parent,Node<E> siblingBeforeNode){
  assert(current != null);
  assert((current.pathLength() == 1 && parent == null) || (current.pathLength() == parent.pathLength() + 1));
  if (siblingBeforeNode != null && siblingBeforeNode.siblingAfter != current) {
    if (siblingBeforeNode.pathLength() != current.pathLength()) {
      throw new IllegalStateException();
    }
    assert(siblingBeforeNode.parent == parent);
    if (siblingBeforeNode.siblingAfter != null) {
      assert(current.siblingAfter == null);
      current.siblingAfter=siblingBeforeNode.siblingAfter;
      siblingBeforeNode.siblingAfter.siblingBefore=current;
    }
    current.siblingBefore=siblingBeforeNode;
    siblingBeforeNode.siblingAfter=current;
    assert(current.siblingBefore != current);
    assert(current.siblingAfter != current);
  }
  for (Node<E> currentSibling=current; currentSibling != null; currentSibling=currentSibling.siblingAfter) {
    currentSibling.parent=parent;
  }
  if (parent != null && !parent.expanded && current.isVisible()) {
    parent.expanded=true;
  }
  incrementCurrent();
}
Program: 32570
Project: 32570
Buggy source:
/** 
 * The number of nodes including the node itself in its subtree.
 */
public int subtreeSize(int visibleIndex,boolean includeCollapsed){
  byte colorsOut=includeCollapsed ? ALL_NODES : VISIBLE_NODES;
  Node<E> node=data.get(visibleIndex,colorsOut).get();
  Node<E> nextNodeNotInSubtree=nextNodeThatsNotAChildOfByStructure(node);
  if (nextNodeNotInSubtree == null) {
    return data.size(colorsOut) - visibleIndex;
  }
  return data.indexOfNode(nextNodeNotInSubtree.element,colorsOut) - visibleIndex;
}

Fixed version (ground truth):
/** 
 * The number of nodes including the node itself in its subtree.
 */
public int subtreeSize(int visibleIndex,boolean includeCollapsed){
  byte colorsOut=includeCollapsed ? ALL_NODES : VISIBLE_NODES;
  Node<E> node=data.get(visibleIndex,VISIBLE_NODES).get();
  Node<E> nextNodeNotInSubtree=nextNodeThatsNotAChildOfByStructure(node);
  if (nextNodeNotInSubtree == null) {
    return data.size(colorsOut) - visibleIndex;
  }
  return data.indexOfNode(nextNodeNotInSubtree.element,colorsOut) - visibleIndex;
}
Program: 32571
Project: 32571
Buggy source:
public StartUIRunnable(EventList<Tag> eventList){
  this.eventList=eventList;
}

Fixed version (ground truth):
public StartUIRunnable(EventList<Tag> eventList){
  this.eventList=GlazedListsSwing.swingThreadProxyList(eventList);
}
Program: 32573
Project: 32573
Buggy source:
public int getColumnCount(){
  return 4;
}

Fixed version (ground truth):
public int getColumnCount(){
  return 2;
}
Program: 32574
Project: 32574
Buggy source:
/** 
 * @return <code>true</code> if the node at the specified index haschildren, regardless of whether such children are visible.
 */
public boolean hasChildren(int visibleIndex){
  boolean hasChildren=subtreeSize(visibleIndex,true) > 1;
  boolean isLeaf=getTreeNode(visibleIndex).isLeaf();
  if (isLeaf == hasChildren) {
    subtreeSize(visibleIndex,true);
  }
  return hasChildren;
}

Fixed version (ground truth):
/** 
 * @return <code>true</code> if the node at the specified index haschildren, regardless of whether such children are visible.
 */
public boolean hasChildren(int visibleIndex){
  boolean hasChildren=subtreeSize(visibleIndex,true) > 1;
  boolean isLeaf=getTreeNode(visibleIndex).isLeaf();
  if (isLeaf == hasChildren) {
    subtreeSize(visibleIndex,true,true);
  }
  return hasChildren;
}
Program: 32575
Project: 32575
Buggy source:
private void validateSubtree(Node<E> node){
  int index=data.indexOfNode(node.element,ALL_NODES);
  int size=subtreeSize(index,true);
  Node<E> lastChildSeen=null;
  for (int i=1; i < size; i++) {
    Node<E> descendent=data.get(index + i,ALL_NODES).get();
    if (descendent.pathLength() == node.pathLength() + 1) {
      if (descendent.parent != node) {
        throw new IllegalStateException();
      }
      assert(descendent.parent == node);
      if (lastChildSeen != descendent.siblingBefore) {
        throw new IllegalStateException();
      }
      if (lastChildSeen != null) {
        if (lastChildSeen.siblingAfter != descendent) {
          throw new IllegalStateException();
        }
        if (lastChildSeen.pathLength() != descendent.pathLength()) {
          throw new IllegalStateException();
        }
      }
 else {
        if (descendent.siblingBefore != null) {
          throw new IllegalStateException();
        }
      }
      lastChildSeen=descendent;
      validateSubtree(descendent);
    }
 else     if (descendent.pathLength() > node.pathLength() + 1) {
    }
 else {
      throw new IllegalStateException();
    }
  }
  assert(lastChildSeen == null || lastChildSeen.siblingAfter == null);
}

Fixed version (ground truth):
private void validateSubtree(Node<E> node){
  int index=data.indexOfNode(node.element,ALL_NODES);
  int size=subtreeSize(index,false,true);
  Node<E> lastChildSeen=null;
  for (int i=1; i < size; i++) {
    Node<E> descendent=data.get(index + i,ALL_NODES).get();
    if (descendent.pathLength() == node.pathLength() + 1) {
      if (descendent.parent != node) {
        throw new IllegalStateException();
      }
      assert(descendent.parent == node);
      if (lastChildSeen != descendent.siblingBefore) {
        throw new IllegalStateException();
      }
      if (lastChildSeen != null) {
        if (lastChildSeen.siblingAfter != descendent) {
          throw new IllegalStateException();
        }
        if (lastChildSeen.pathLength() != descendent.pathLength()) {
          throw new IllegalStateException();
        }
      }
 else {
        if (descendent.siblingBefore != null) {
          throw new IllegalStateException();
        }
      }
      lastChildSeen=descendent;
      validateSubtree(descendent);
    }
 else     if (descendent.pathLength() > node.pathLength() + 1) {
    }
 else {
      throw new IllegalStateException();
    }
  }
  assert(lastChildSeen == null || lastChildSeen.siblingAfter == null);
}
Program: 32576
Project: 32576
Buggy source:
/** 
 * The number of nodes including the node itself in its subtree.
 */
public int subtreeSize(int index,boolean includeCollapsed){
  byte colorsOut=includeCollapsed ? ALL_NODES : VISIBLE_NODES;
  Node<E> node=data.get(index,colorsOut).get();
  Node<E> nextNodeNotInSubtree=nextNodeThatsNotAChildOfByStructure(node);
  if (nextNodeNotInSubtree == null) {
    return data.size(colorsOut) - index;
  }
  return data.indexOfNode(nextNodeNotInSubtree.element,colorsOut) - index;
}

Fixed version (ground truth):
/** 
 * The number of nodes including the node itself in its subtree.
 */
public int subtreeSize(int visibleIndex,boolean includeCollapsed){
  return subtreeSize(visibleIndex,true,includeCollapsed);
}
Program: 32577
Project: 32577
Buggy source:
/** 
 * @return <code>true</code> if the node at the specified index haschildren, regardless of whether such children are visible.
 */
public boolean hasChildren(int visibleIndex){
  return subtreeSize(visibleIndex,true) > 1;
}

Fixed version (ground truth):
/** 
 * @return <code>true</code> if the node at the specified index haschildren, regardless of whether such children are visible.
 */
public boolean hasChildren(int visibleIndex){
  boolean hasChildren=subtreeSize(visibleIndex,true) > 1;
  boolean isLeaf=getTreeNode(visibleIndex).isLeaf();
  if (isLeaf == hasChildren) {
    subtreeSize(visibleIndex,true);
  }
  return hasChildren;
}
Program: 32578
Project: 32578
Buggy source:
/** 
 * The number of nodes including the node itself in its subtree.
 */
public int subtreeSize(int visibleIndex,boolean includeCollapsed){
  byte colorsOut=includeCollapsed ? ALL_NODES : VISIBLE_NODES;
  Node<E> node=data.get(visibleIndex,VISIBLE_NODES).get();
  Node<E> nextNodeNotInSubtree=nextNodeThatsNotAChildOfByStructure(node);
  if (nextNodeNotInSubtree == null) {
    return data.size(colorsOut) - visibleIndex;
  }
  return data.indexOfNode(nextNodeNotInSubtree.element,colorsOut) - visibleIndex;
}

Fixed version (ground truth):
/** 
 * The number of nodes including the node itself in its subtree.
 */
public int subtreeSize(int index,boolean includeCollapsed){
  byte colorsOut=includeCollapsed ? ALL_NODES : VISIBLE_NODES;
  Node<E> node=data.get(index,colorsOut).get();
  Node<E> nextNodeNotInSubtree=nextNodeThatsNotAChildOfByStructure(node);
  if (nextNodeNotInSubtree == null) {
    return data.size(colorsOut) - index;
  }
  return data.indexOfNode(nextNodeNotInSubtree.element,colorsOut) - index;
}
Program: 32579
Project: 32579
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void listChanged(ListEvent<S> listChanges){
  updates.beginEvent(true);
  if (listChanges.isReordering()) {
    final int[] reorderMap=listChanges.getReorderMap();
    final List<E> originalMappedElements=new ArrayList<E>(mappedElements);
    for (int i=0; i < reorderMap.length; i++) {
      final int sourceIndex=reorderMap[i];
      final E replaced=mappedElements.set(i,originalMappedElements.get(sourceIndex));
      updates.elementUpdated(i,replaced);
    }
  }
 else {
    while (listChanges.next()) {
      final int changeIndex=listChanges.getIndex();
      final int changeType=listChanges.getType();
      if (changeType == ListEvent.INSERT) {
        final S inserted=source.get(changeIndex);
        sourceElements.add(changeIndex,inserted);
        mappedElements.add(changeIndex,forward(inserted));
        updates.addInsert(changeIndex);
      }
 else       if (changeType == ListEvent.UPDATE) {
        final E replaced=get(changeIndex);
        final S updated=source.get(changeIndex);
        sourceElements.set(changeIndex,updated);
        mappedElements.set(changeIndex,forward(replaced,updated));
        updates.elementUpdated(changeIndex,replaced);
      }
 else       if (changeType == ListEvent.DELETE) {
        final S deletedSource=sourceElements.remove(changeIndex);
        final E deletedTransform=mappedElements.remove(changeIndex);
        forward.dispose(deletedSource,deletedTransform);
        updates.elementDeleted(changeIndex,deletedTransform);
      }
    }
  }
  updates.commitEvent();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void listChanged(ListEvent<S> listChanges){
  updates.beginEvent(true);
  if (listChanges.isReordering()) {
    final int[] reorderMap=listChanges.getReorderMap();
    final List<E> originalMappedElements=new ArrayList<E>(mappedElements);
    for (int i=0; i < reorderMap.length; i++) {
      final int sourceIndex=reorderMap[i];
      mappedElements.set(i,originalMappedElements.get(sourceIndex));
    }
    updates.reorder(reorderMap);
  }
 else {
    while (listChanges.next()) {
      final int changeIndex=listChanges.getIndex();
      final int changeType=listChanges.getType();
      if (changeType == ListEvent.INSERT) {
        final S inserted=source.get(changeIndex);
        sourceElements.add(changeIndex,inserted);
        mappedElements.add(changeIndex,forward(inserted));
        updates.addInsert(changeIndex);
      }
 else       if (changeType == ListEvent.UPDATE) {
        final E replaced=get(changeIndex);
        final S updated=source.get(changeIndex);
        sourceElements.set(changeIndex,updated);
        mappedElements.set(changeIndex,forward(replaced,updated));
        updates.elementUpdated(changeIndex,replaced);
      }
 else       if (changeType == ListEvent.DELETE) {
        final S deletedSource=sourceElements.remove(changeIndex);
        final E deletedTransform=mappedElements.remove(changeIndex);
        forward.dispose(deletedSource,deletedTransform);
        updates.elementDeleted(changeIndex,deletedTransform);
      }
    }
  }
  updates.commitEvent();
}
Program: 32580
Project: 32580
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void listChanged(ListEvent<S> listChanges){
  while (listChanges.next()) {
    final int changeIndex=listChanges.getIndex();
    final int changeType=listChanges.getType();
    if (changeType == ListEvent.INSERT) {
      final S inserted=source.get(changeIndex);
      this.sourceElements.add(changeIndex,inserted);
      this.mappedElements.add(changeIndex,this.forward(inserted));
    }
 else     if (changeType == ListEvent.UPDATE) {
      final S updated=source.get(changeIndex);
      this.sourceElements.set(changeIndex,updated);
      this.mappedElements.set(changeIndex,this.forward(this.get(changeIndex),updated));
    }
 else     if (changeType == ListEvent.DELETE) {
      final S deletedSource=this.sourceElements.remove(changeIndex);
      final E deletedTransform=this.mappedElements.remove(changeIndex);
      this.forward.dispose(deletedSource,deletedTransform);
    }
  }
  listChanges.reset();
  updates.forwardEvent(listChanges);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void listChanged(ListEvent<S> listChanges){
  if (listChanges.isReordering()) {
    int[] reorderMap=listChanges.getReorderMap();
    List<E> originalMappedElements=new ArrayList(mappedElements);
    for (int i=0; i < reorderMap.length; i++) {
      mappedElements.set(i,originalMappedElements.get(reorderMap[i]));
    }
  }
 else {
    while (listChanges.next()) {
      final int changeIndex=listChanges.getIndex();
      final int changeType=listChanges.getType();
      if (changeType == ListEvent.INSERT) {
        final S inserted=source.get(changeIndex);
        this.sourceElements.add(changeIndex,inserted);
        this.mappedElements.add(changeIndex,this.forward(inserted));
      }
 else       if (changeType == ListEvent.UPDATE) {
        final S updated=source.get(changeIndex);
        this.sourceElements.set(changeIndex,updated);
        this.mappedElements.set(changeIndex,this.forward(this.get(changeIndex),updated));
      }
 else       if (changeType == ListEvent.DELETE) {
        final S deletedSource=this.sourceElements.remove(changeIndex);
        final E deletedTransform=this.mappedElements.remove(changeIndex);
        this.forward.dispose(deletedSource,deletedTransform);
      }
    }
  }
  listChanges.reset();
  updates.forwardEvent(listChanges);
}
Program: 32582
Project: 32582
Buggy source:
public Node<E> reevaluate(E sourceValue,Node<E> transformedValue){
  format.getPath(workingPath,sourceValue);
  transformedValue.path=new ArrayList<E>(workingPath);
  workingPath.clear();
  return transformedValue;
}

Fixed version (ground truth):
public Node<E> reevaluate(E sourceValue,Node<E> transformedValue){
  transformedValue.path.clear();
  format.getPath(transformedValue.path,sourceValue);
  return transformedValue;
}