nus-yam/ex-repair huggingface dataset:
Program: 24822
Project: 24822
Buggy source:
public boolean prev(boolean force){
  if (tokens == null)   return false;
 else   if (tokNum == 0) {
    if (chunk.chunkNum - 1 < chunkSource.firstChunk)     return false;
    Chunk prev=chunkSource.loadChunk(chunk.chunkNum - 1);
    if (!force && prev.tokens.length == 0)     return false;
    reseek(prev);
    while (wordPos < chunk.maxWordPos)     super.next(true);
    return true;
  }
  return super.prev(force);
}

Fixed version (ground truth):
public boolean prev(boolean force){
  if (tokens == null)   return false;
 else   if (tokNum == 0) {
    while (true) {
      if (chunk.chunkNum - 1 < chunkSource.firstChunk)       return false;
      Chunk prev=chunkSource.loadChunk(chunk.chunkNum - 1);
      if (prev.tokens.length == 0) {
        if (!force)         return false;
        chunk=prev;
        continue;
      }
      reseek(prev);
      while (wordPos < chunk.maxWordPos)       super.next(true);
      return true;
    }
  }
  return super.prev(force);
}
Program: 24823
Project: 24823
Buggy source:
/** 
 * This is the main entry point. Takes a query request and handles searching the index and forming the results.
 * @param queryReqDoc   The request to process, in XML format
 * @param baseDir       Directory to use for resolving relative paths(if any)
 * @return              Zero or more document hits
 */
public QueryResult processReq(QueryRequest req) throws IOException {
}

Fixed version (ground truth):
/** 
 * This is an alternate entry point. Takes a pre-parsed query request  and handles searching the index and forming the results.
 * @param queryReq      The pre-parsed request to process
 * @return              Zero or more document hits
 */
public QueryResult processReq(QueryRequest req) throws IOException {
}
Program: 24824
Project: 24824
Buggy source:
public boolean next() throws IOException {
  boolean more;
  do {
    while (bucketTable.first != null) {
      current=bucketTable.first;
      bucketTable.first=current.next;
      if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask) {
        return true;
      }
    }
    more=false;
    end+=BucketTable.SIZE;
    for (SubScorer sub=scorers; sub != null; sub=sub.next) {
      Scorer scorer=sub.scorer;
      while (!sub.done && scorer.doc() < end) {
        sub.collector.collect(scorer.doc(),scorer.score());
        sub.done=!scorer.next();
      }
      if (!sub.done) {
        more=true;
      }
    }
  }
 while (bucketTable.first != null | more);
  return false;
}

Fixed version (ground truth):
public boolean next() throws IOException {
  boolean more;
  do {
    while (bucketTable.first != null) {
      current=bucketTable.first;
      bucketTable.first=current.next;
      if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask) {
        return true;
      }
    }
    more=false;
    end+=BucketTable.SIZE;
    for (SubScorer sub=scorers; sub != null; sub=sub.next) {
      Scorer scorer=sub.scorer;
      while (!sub.done && scorer.doc() < end) {
        if (sub.skipRecording)         sub.collector.collect(scorer.doc(),scorer.score());
 else {
          FieldSpans fieldSpans=new FieldSpans();
          sub.scorer.recordSpans(fieldSpans);
          if (fieldSpans.isEmpty()) {
            sub.skipRecording=true;
            sub.collector.collect(scorer.doc(),scorer.score());
          }
 else           sub.collector.collect(scorer.doc(),scorer.score(),fieldSpans);
        }
        sub.done=!scorer.next();
      }
      if (!sub.done) {
        more=true;
      }
    }
  }
 while (bucketTable.first != null | more);
  return false;
}
Program: 24825
Project: 24825
Buggy source:
public HitCollector newCollector(int mask){
  return new Collector(mask,this);
}

Fixed version (ground truth):
public SpanHitCollector newCollector(int mask){
  return new Collector(mask,this);
}
Program: 24826
Project: 24826
Buggy source:
public SubScorer(Scorer scorer,boolean required,boolean prohibited,HitCollector collector,SubScorer next) throws IOException {
  this.scorer=scorer;
  this.done=!scorer.next();
  this.required=required;
  this.prohibited=prohibited;
  this.collector=collector;
  this.next=next;
}

Fixed version (ground truth):
public SubScorer(Scorer scorer,boolean required,boolean prohibited,SpanHitCollector collector,SubScorer next) throws IOException {
  this.scorer=scorer;
  this.done=!scorer.next();
  this.required=required;
  this.prohibited=prohibited;
  this.collector=collector;
  this.next=next;
}
Program: 24827
Project: 24827
Buggy source:
public final void collect(final int doc,final float score){
  final BucketTable table=bucketTable;
  final int i=doc & BucketTable.MASK;
  Bucket bucket=table.buckets[i];
  if (bucket == null)   table.buckets[i]=bucket=new Bucket();
  if (bucket.doc != doc) {
    bucket.doc=doc;
    bucket.score=score;
    bucket.bits=mask;
    bucket.coord=1;
    bucket.next=table.first;
    table.first=bucket;
  }
 else {
    bucket.score+=score;
    bucket.bits|=mask;
    bucket.coord++;
  }
}

Fixed version (ground truth):
public final void collect(final int doc,final float score,final FieldSpans spans){
  final BucketTable table=bucketTable;
  final int i=doc & BucketTable.MASK;
  Bucket bucket=table.buckets[i];
  if (bucket == null)   table.buckets[i]=bucket=new Bucket();
  if (bucket.doc != doc) {
    bucket.doc=doc;
    bucket.score=score;
    bucket.spans=spans;
    bucket.bits=mask;
    bucket.coord=1;
    bucket.next=table.first;
    table.first=bucket;
  }
 else {
    bucket.score+=score;
    bucket.spans.addSpans(spans);
    bucket.bits|=mask;
    bucket.coord++;
  }
}
Program: 24829
Project: 24829
Buggy source:
/** 
 * Creates a document containing tokenized and untokenized versions of each parameter.
 */
public static NodeInfo tokenizeParams(AttribList atts) throws QueryGenException {
  XMLFormatter fmt=new XMLFormatter();
  fmt.beginTag("String_Node_Str");
  for (Iterator iter=atts.iterator(); iter.hasNext(); ) {
    Attrib att=(Attrib)iter.next();
    if (att.key.equals("String_Node_Str"))     continue;
    addParam(fmt,att.key,att.value);
  }
  fmt.endTag();
  return fmt.toNode();
}

Fixed version (ground truth):
/** 
 * Creates a document containing tokenized and untokenized versions of each parameter.
 */
public static NodeInfo tokenizeParams(AttribList atts) throws QueryGenException {
  XMLFormatter fmt=new XMLFormatter();
  fmt.beginTag("String_Node_Str");
  for (Iterator iter=atts.iterator(); iter.hasNext(); ) {
    Attrib att=(Attrib)iter.next();
    if (att.key.equals("String_Node_Str"))     continue;
    if (att.key.equals("String_Node_Str"))     continue;
    if (att.key.startsWith("String_Node_Str"))     continue;
    if (att.key.equals("String_Node_Str"))     continue;
    addParam(fmt,att.key,att.value);
  }
  fmt.endTag();
  return fmt.toNode();
}
Program: 24830
Project: 24830
Buggy source:
public boolean skipTo(int target) throws IOException {
  if (doc == 0 || target > spans.doc())   more=spans.skipTo(target);
  return advance();
}

Fixed version (ground truth):
public boolean skipTo(int target) throws IOException {
  if (doc == 0 || (more && target > spans.doc()))   more=spans.skipTo(target);
  return advance();
}
Program: 24831
Project: 24831
Buggy source:
/** 
 * Run the search and save the results for annotating the tree.
 * @param processor     Processor used to run the query
 * @param req           Query to run
 * @throws IOException  If anything goes wrong reading from the Luceneindex or the lazy tree file.
 */
public void search(QueryProcessor processor,QueryRequest req) throws IOException {
}

Fixed version (ground truth):
/** 
 * Run the search and save the results for annotating the tree.
 * @param processor     Processor used to run the query
 * @param req           Query to run
 * @throws IOException  If anything goes wrong reading from the Luceneindex or the lazy tree file.
 */
public void search(QueryProcessor processor,QueryRequest origReq) throws IOException {
}
Program: 24832
Project: 24832
Buggy source:
/** 
 * Normalize a file name. <br><br> This function performs a number of "cleanup" operations to create  a standardized (or normalized) file name. <br><br>
 * @param path  The file name (optionally preceeded by a path)to normalize. <br><br>
 * @return A normalized version of the original file name string passed. 
 * @.notes This function does its work by calling the {@link Path#normalizePath(String) normalizePath() }function to normalize the filename and path (if any), and then  simply removes the trailing slash.
 */
public final static String normalizeFileName(String path){
  String filename=normalizePath(path);
  if (filename.charAt(filename.length() - 1) == '/')   filename=filename.substring(0,filename.length() - 1);
  return filename;
}

Fixed version (ground truth):
/** 
 * Normalize a file name. <br><br> This function performs a number of "cleanup" operations to create  a standardized (or normalized) file name. <br><br>
 * @param path  The file name (optionally preceeded by a path)to normalize. <br><br>
 * @return A normalized version of the original file name string passed. 
 * @.notes This function does its work by calling the {@link Path#normalizePath(String) normalizePath() }function to normalize the filename and path (if any), and then  simply removes the trailing slash.
 */
public final static String normalizeFileName(String path){
  String filename=normalizePath(path);
  if (filename.length() > 0 && filename.charAt(filename.length() - 1) == '/')   filename=filename.substring(0,filename.length() - 1);
  return filename;
}
Program: 24833
Project: 24833
Buggy source:
/** 
 * Construct an Attribute node for the n'th attribute of a given element
 * @param element The element containing the relevant attribute
 * @param index The index position of the attribute starting at zero
 */
public AttributeImpl(ElementImpl element,int index){
  super(element.document);
  this.index=index;
  parentNum=element.nodeNum;
  this.element=element;
}

Fixed version (ground truth):
/** 
 * Construct an Attribute node for the n'th attribute of a given element
 * @param element The element containing the relevant attribute
 * @param index The index position of the attribute starting at zero
 */
public AttributeImpl(ElementImpl element,int index){
  super(element.document);
  this.index=index;
  parentNum=element.nodeNum;
  this.element=element;
  nameCode=element.attrNames[index];
}
Program: 24834
Project: 24834
Buggy source:
/** 
 * If the given element has a 'field' attribute, return its value; otherwise return 'parentField'. Also checks that field cannot be specified if parentField has already been.
 */
private String parseField(EasyNode el,String parentField) throws QueryGenException {
  if (!el.hasAttr("String_Node_Str") && !el.hasAttr("String_Node_Str"))   return parentField;
  String attVal=el.attrValue("String_Node_Str");
  if (attVal == null || attVal.length() == 0)   attVal=el.attrValue("String_Node_Str");
  if (attVal.length() == 0)   error("String_Node_Str");
  if (attVal.equals("String_Node_Str"))   error("String_Node_Str");
  if (parentField != null && !parentField.equals(attVal))   error("String_Node_Str");
  return attVal;
}

Fixed version (ground truth):
/** 
 * If the given element has a 'field' attribute, return its value; otherwise return 'parentField'. Also checks that field cannot be specified if parentField has already been.
 */
private String parseField(EasyNode el,String parentField) throws QueryGenException {
  if (!el.hasAttr("String_Node_Str") && !el.hasAttr("String_Node_Str"))   return parentField;
  String attVal=el.attrValue("String_Node_Str");
  if (attVal == null || attVal.length() == 0)   attVal=el.attrValue("String_Node_Str");
  if (attVal.length() == 0)   error("String_Node_Str");
  if (attVal.equals("String_Node_Str") && !parentField.equals("String_Node_Str"))   error("String_Node_Str");
  if (parentField != null && !parentField.equals(attVal))   error("String_Node_Str");
  return attVal;
}
Program: 24835
Project: 24835
Buggy source:
/** 
 * Forces subsequent text to start at the beginning of a new chunk. <br><br> This method is used to ensure that source text marked with proximity  breaks or new section types does not overlap with any previously  accumulated source text.
 * @param sectionType  The section type to apply to the previouslyaccumulated chunk.
 * @param wordBoost    The word boost to apply to the previously accumulated chunk. <br><br>
 * @.notes This method writes out any accumulated text and resets the chunk tracking information to the start of a new chunk.
 */
private void forceNewChunk(String sectionType,float wordBoost){
  indexText(sectionType,wordBoost);
  chunkStartNode=nextChunkStartNode;
  chunkWordOffset=nextChunkWordOffset;
  chunkWordCount=nextChunkWordCount;
  accumText.delete(0,nextChunkStartIdx);
  trimAccumText(true);
  nextChunkStartIdx=0;
  nextChunkWordCount=0;
  indexText(sectionType,wordBoost);
  chunkWordOffset+=chunkWordCount;
  chunkWordCount=0;
  nextChunkWordCount=0;
  nextChunkWordOffset=0;
  accumText.setLength(0);
  forcedChunk=true;
}

Fixed version (ground truth):
/** 
 * Forces subsequent text to start at the beginning of a new chunk. <br><br> This method is used to ensure that source text marked with proximity  breaks or new section types does not overlap with any previously  accumulated source text.
 * @param sectionType  The section type to apply to the previouslyaccumulated chunk.
 * @param wordBoost    The word boost to apply to the previously accumulated chunk. <br><br>
 * @.notes This method writes out any accumulated text and resets the chunk tracking information to the start of a new chunk.
 */
private void forceNewChunk(String sectionType,float wordBoost){
  if (nextChunkStartIdx > 0) {
    indexText(sectionType,wordBoost);
    chunkStartNode=nextChunkStartNode;
    chunkWordOffset=nextChunkWordOffset;
    chunkWordCount=nextChunkWordCount;
    accumText.delete(0,nextChunkStartIdx);
    trimAccumText(true);
    nextChunkStartIdx=0;
    nextChunkWordCount=0;
  }
  indexText(sectionType,wordBoost);
  chunkWordOffset+=chunkWordCount;
  chunkWordCount=0;
  nextChunkWordCount=0;
  nextChunkWordOffset=0;
  accumText.setLength(0);
  chunkStartNode=-1;
  forcedChunk=true;
}
Program: 24836
Project: 24836
Buggy source:
/** 
 * Obtain a hash code so that ProfileCounts can be stored in a map 
 */
public int hashCode(){
  return lineNum ^ systemId.hashCode();
}

Fixed version (ground truth):
/** 
 * Obtain a hash code so that ProfileCounts can be stored in a map 
 */
public int hashCode(){
  if (systemId != null)   return lineNum ^ systemId.hashCode();
  return lineNum;
}
Program: 24837
Project: 24837
Buggy source:
private int totalSlop(){
  if (totalSlop >= 0)   return totalSlop;
  int matchSlop=0;
  int lastStart=-1;
  int lastEnd=-1;
  for (int i=0; i < ordered.size(); i++) {
    SpansCell cell=(SpansCell)ordered.get(i);
    int start=cell.start();
    int end=cell.end();
    if (i > 0) {
      if (end <= lastStart)       matchSlop+=(lastStart - end);
 else       if (start >= lastEnd)       matchSlop+=(start - lastEnd);
 else       ;
    }
    lastStart=start;
    lastEnd=end;
  }
  return totalSlop=matchSlop;
}

Fixed version (ground truth):
private int totalSlop(){
  if (totalSlop >= 0)   return totalSlop;
  int matchSlop=0;
  int lastStart=-1;
  int lastEnd=-1;
  for (int i=0; i < ordered.size(); i++) {
    SpansCell cell=(SpansCell)ordered.get(i);
    int start=cell.start();
    int end=cell.end();
    if (i > 0) {
      if (end <= lastStart)       matchSlop+=(lastStart - end) + 1;
 else       if (start >= lastEnd)       matchSlop+=(start - lastEnd);
 else       ;
    }
    lastStart=start;
    lastEnd=end;
  }
  return totalSlop=matchSlop;
}
Program: 24838
Project: 24838
Buggy source:
public boolean next() throws IOException {
  while (true) {
    boolean more=super.next();
    if (!more) {
      curTerm=null;
      return false;
    }
    curTerm=super.term();
    if (stopWords == null)     break;
    if (stopWords.contains(curTerm.text()))     continue;
    if (NgramQueryRewriter.isNgram(stopWords,curTerm.text()))     continue;
  }
  nTerms++;
  if (nTerms > termLimit) {
    throw new TermLimitException("String_Node_Str" + getTerm().field() + "String_Node_Str"+ termLimit+ "String_Node_Str");
  }
  termMap.put(curTerm);
  return true;
}

Fixed version (ground truth):
public boolean next() throws IOException {
  while (true) {
    if (first)     first=false;
 else {
      if (!super.next()) {
        curTerm=null;
        return false;
      }
    }
    curTerm=super.term();
    if (curTerm == null)     return false;
    if (stopWords == null)     break;
    if (stopWords.contains(curTerm.text()))     continue;
    if (NgramQueryRewriter.isNgram(stopWords,curTerm.text()))     continue;
  }
  nTerms++;
  if (nTerms > termLimit) {
    throw new TermLimitException("String_Node_Str" + getTerm().field() + "String_Node_Str"+ termLimit+ "String_Node_Str");
  }
  termMap.put(curTerm);
  System.out.println("String_Node_Str" + curTerm);
  return true;
}
Program: 24839
Project: 24839
Buggy source:
/** 
 * Open the active Lucene index database for writing. <br><br>
 * @throws IOException  Any exceptions generated during the creation of the Lucene database writer object.
 * @.notes This method attempts to open the Lucene database specified by the  {@link XMLTextProcessor#indexPath indexPath} member for writing.<br><br>
 */
private void openIdxForWriting() throws IOException {
  indexWriter=new IndexWriter(indexPath,new XTFTextAnalyzer(stopSet,indexInfo.getChunkSize(),compactedAccumText),false);
  indexWriter.minMergeDocs=100;
  indexWriter.setUseCompoundFile(false);
}

Fixed version (ground truth):
/** 
 * Open the active Lucene index database for writing. <br><br>
 * @throws IOException  Any exceptions generated during the creation of the Lucene database writer object.
 * @.notes This method attempts to open the Lucene database specified by the  {@link XMLTextProcessor#indexPath indexPath} member for writing.<br><br>
 */
private void openIdxForWriting() throws IOException {
  if (indexSearcher != null)   indexSearcher.close();
  if (indexReader != null)   indexReader.close();
  indexSearcher=null;
  indexReader=null;
  if (indexWriter != null)   return;
  indexWriter=new IndexWriter(indexPath,new XTFTextAnalyzer(stopSet,indexInfo.getChunkSize(),compactedAccumText),false);
  indexWriter.minMergeDocs=100;
  indexWriter.setUseCompoundFile(false);
}
Program: 24841
Project: 24841
Buggy source:
/** 
 * Remove a single document from the index.<br><br>
 * @param srcFile    The original XML source file, used to calculate thelocation of the corresponding *.lazy file to delete. If null, this step is skipped.
 * @param key        The key associated with the document in the index.
 * @return           true if a document was found and removed, false ifno match was found.
 */
public boolean removeSingleDoc(File srcFile,String key) throws ParserConfigurationException, SAXException, IOException {
  int nDeleted=indexReader.delete(new Term("String_Node_Str",key));
  if (srcFile != null) {
    lazyFile=IdxConfigUtil.calcLazyPath(new File(xtfHomePath),indexInfo,srcFile,false);
    Path.deletePath(lazyFile.toString());
  }
  return nDeleted > 0;
}

Fixed version (ground truth):
/** 
 * Remove a single document from the index.<br><br>
 * @param srcFile    The original XML source file, used to calculate thelocation of the corresponding *.lazy file to delete. If null, this step is skipped.
 * @param key        The key associated with the document in the index.
 * @return           true if a document was found and removed, false ifno match was found.
 */
public boolean removeSingleDoc(File srcFile,String key) throws ParserConfigurationException, SAXException, IOException {
  openIdxForReading();
  int nDeleted=indexReader.delete(new Term("String_Node_Str",key));
  if (srcFile != null) {
    lazyFile=IdxConfigUtil.calcLazyPath(new File(xtfHomePath),indexInfo,srcFile,false);
    Path.deletePath(lazyFile.toString());
  }
  return nDeleted > 0;
}
Program: 24843
Project: 24843
Buggy source:
public boolean skipTo(int target) throws IOException {
  more=spans.skipTo(target);
  return advance();
}

Fixed version (ground truth):
public boolean skipTo(int target) throws IOException {
  if (doc == 0 || target > spans.doc())   more=spans.skipTo(target);
  return advance();
}
Program: 24844
Project: 24844
Buggy source:
public boolean next() throws IOException {
  while (true) {
    if (first)     first=false;
 else {
      if (!super.next()) {
        curTerm=null;
        return false;
      }
    }
    curTerm=super.term();
    if (curTerm == null)     return false;
    if (stopWords == null)     break;
    if (stopWords.contains(curTerm.text()))     continue;
    if (NgramQueryRewriter.isNgram(stopWords,curTerm.text()))     continue;
  }
  nTerms++;
  if (nTerms > termLimit) {
    throw new TermLimitException("String_Node_Str" + getTerm().field() + "String_Node_Str"+ termLimit+ "String_Node_Str");
  }
  termMap.put(curTerm);
  System.out.println("String_Node_Str" + curTerm);
  return true;
}

Fixed version (ground truth):
public boolean next() throws IOException {
  while (true) {
    if (first)     first=false;
 else {
      if (!super.next()) {
        curTerm=null;
        return false;
      }
    }
    curTerm=super.term();
    if (curTerm == null)     return false;
    if (stopWords == null)     break;
    if (stopWords.contains(curTerm.text()))     continue;
    if (NgramQueryRewriter.isNgram(stopWords,curTerm.text()))     continue;
    break;
  }
  nTerms++;
  if (nTerms > termLimit) {
    throw new TermLimitException("String_Node_Str" + getTerm().field() + "String_Node_Str"+ termLimit+ "String_Node_Str");
  }
  termMap.put(curTerm);
  return true;
}
Program: 24845
Project: 24845
Buggy source:
/** 
 * Runs a full-text query (possibly constrained by a sectionType query), adding the results to one or more document hits.
 * @param textQuery             Text query to run
 * @param sectionTypeQuery      Optional sectionType query, or null
 * @param termMap               Map to add matched terms to
 * @param docHitMap             Map to add hits to
 * @param docHitQueue           Queue that maintains a ranked list of hits
 * @param maxSnippets           Max # snippets for any given document
 * @param maxContext            Target # characters for a snippet
 * @return                      A HashMap of all the text hits
 * @throws IOException          If something goes wrong reading the index
 */
private HashMap gatherTextHits(final Query textQuery,final Query sectionTypeQuery,final TermMap termMap,final HashMap docHitMap,final PriorityQueue docHitQueue,final int maxSnippets,final int maxContext) throws IOException {
}

Fixed version (ground truth):
/** 
 * Runs a full-text query (possibly constrained by a sectionType query), adding the results to one or more document hits.
 * @param textQuery             Text query to run
 * @param sectionTypeQuery      Optional sectionType query, or null
 * @param termMap               Map to add matched terms to
 * @param docHitMap             Map to add hits to
 * @param docHitQueue           Queue that maintains a ranked list of hits
 * @param maxSnippets           Max # snippets for any given document
 * @param maxContext            Target # characters for a snippet
 * @return                      A HashMap of all the text hits
 * @throws IOException          If something goes wrong reading the index
 */
private HashMap gatherTextHits(final Query textQuery,final SpanQuery sectionTypeQuery,final TermMap termMap,final HashMap docHitMap,final PriorityQueue docHitQueue,final int maxSnippets,final int maxContext) throws IOException {
}
Program: 24846
Project: 24846
Buggy source:
/** 
 * Parse a 'sectionType' query element.
 */
private Query parseSectionType(Element parent) throws QueryGenException {
  Element sectionType=null;
  for (ElementIter iter=new ElementIter(parent); iter.hasNext(); ) {
    Element el=iter.next();
    if (el.getNodeName().equals("String_Node_Str")) {
      if (sectionType != null)       error("String_Node_Str");
      sectionType=el;
    }
  }
  if (sectionType == null)   return null;
  int count=0;
  Element child=null;
  for (ElementIter iter=new ElementIter(sectionType); iter.hasNext(); ) {
    child=iter.next();
    count++;
  }
  if (count != 1)   error("String_Node_Str" + "String_Node_Str");
  return parseBoolean(child,"String_Node_Str",MODE_META,false);
}

Fixed version (ground truth):
/** 
 * Parse a 'sectionType' query element. Note that this query is parsed as a span query, because the query processing logic requires it to return documents in ascending ID order (something which the normal BooleanQuery does not do.)
 */
private SpanQuery parseSectionType(Element parent) throws QueryGenException {
  Element sectionType=null;
  for (ElementIter iter=new ElementIter(parent); iter.hasNext(); ) {
    Element el=iter.next();
    if (el.getNodeName().equals("String_Node_Str")) {
      if (sectionType != null)       error("String_Node_Str");
      sectionType=el;
    }
  }
  if (sectionType == null)   return null;
  int count=0;
  Element child=null;
  for (ElementIter iter=new ElementIter(sectionType); iter.hasNext(); ) {
    child=iter.next();
    count++;
  }
  if (count != 1)   error("String_Node_Str" + "String_Node_Str");
  return (SpanQuery)parseBoolean(child,"String_Node_Str",MODE_TEXT,false);
}
Program: 24847
Project: 24847
Buggy source:
public boolean next() throws IOException {
  if (moreText)   moreText=textSpans.next();
  if (firstTime) {
    moreType=typeScorer.next();
    firstTime=false;
  }
  return advance();
}

Fixed version (ground truth):
public boolean next() throws IOException {
  if (moreText)   moreText=textSpans.next();
  if (firstTime) {
    moreType=typeSpans.next();
    firstTime=false;
  }
  return advance();
}
Program: 24848
Project: 24848
Buggy source:
/** 
 * Construct a filtered query.
 * @param textQuery         Text query to filter
 * @param sectionTypeQuery  'sectionType' field query to filter with
 */
public SpanSectionTypeFilterQuery(SpanQuery textQuery,Query sectionTypeQuery){
  this.sectionTypeQuery=sectionTypeQuery;
  this.textQuery=textQuery;
}

Fixed version (ground truth):
/** 
 * Construct a filtered query.
 * @param textQuery         Text query to filter
 * @param sectionTypeQuery  'sectionType' field query to filter with
 */
public SpanSectionTypeFilterQuery(SpanQuery textQuery,SpanQuery sectionTypeQuery){
  this.typeQuery=sectionTypeQuery;
  this.textQuery=textQuery;
}
Program: 24849
Project: 24849
Buggy source:
public boolean skipTo(int target) throws IOException {
  moreText=textSpans.skipTo(target);
  skipType(target);
  return advance();
}

Fixed version (ground truth):
public boolean skipTo(int target) throws IOException {
  moreText=textSpans.skipTo(target);
  moreType=typeSpans.skipTo(target);
  return advance();
}
Program: 24850
Project: 24850
Buggy source:
private boolean advance() throws IOException {
  while (moreText && moreType) {
    final int textChunk=textSpans.doc();
    final int typeChunk=typeScorer.doc();
    if (textChunk < typeChunk)     moreText=textSpans.skipTo(typeChunk);
 else     if (textChunk > typeChunk)     skipType(textChunk);
 else     break;
  }
  return moreText && moreType;
}

Fixed version (ground truth):
private boolean advance() throws IOException {
  while (moreText && moreType) {
    final int textChunk=textSpans.doc();
    final int typeChunk=typeSpans.doc();
    if (textChunk < typeChunk)     moreText=textSpans.skipTo(typeChunk);
 else     if (textChunk > typeChunk)     moreType=typeSpans.skipTo(textChunk);
 else     break;
  }
  return moreText && moreType;
}
Program: 24852
Project: 24852
Buggy source:
private String inverseEventProvenancesToString(final EntityInverseEventArgumentAssertion assertion){
  final List<String> parts=new ArrayList<>();
  parts.add(spansToString(assertion.predicateJustification()));
  parts.add(spanToString(assertion.baseFiller()));
  parts.add(spansToString(assertion.predicateJustification()));
  return Joiner.on("String_Node_Str").join(parts);
}

Fixed version (ground truth):
private String inverseEventProvenancesToString(final EntityInverseEventArgumentAssertion assertion){
  final List<String> parts=new ArrayList<>();
  parts.add(spansToString(assertion.predicateJustification()));
  parts.add(spanToString(assertion.baseFiller()));
  if (!assertion.additionalJustifications().isEmpty()) {
    parts.add(spansToString(assertion.additionalJustifications()));
  }
 else {
    parts.add("String_Node_Str");
  }
  return Joiner.on("String_Node_Str").join(parts);
}
Program: 24853
Project: 24853
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24854
Project: 24854
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Value.Derived @Override public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24855
Project: 24855
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject(),argument().asNode());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject(),argument().asNode());
}
Program: 24856
Project: 24856
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24857
Project: 24857
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24858
Project: 24858
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24859
Project: 24859
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24860
Project: 24860
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24861
Project: 24861
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24862
Project: 24862
Buggy source:
public abstract EntityNode subject();

Fixed version (ground truth):
@Override public abstract EntityNode subject();
Program: 24863
Project: 24863
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject(),object().asNode());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject(),object().asNode());
}
Program: 24864
Project: 24864
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject(),object().asNode());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject(),object().asNode());
}
Program: 24865
Project: 24865
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject(),object());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject(),object());
}
Program: 24866
Project: 24866
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24867
Project: 24867
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.<Node>of(subject());
}
Program: 24868
Project: 24868
Buggy source:
@Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject());
}

Fixed version (ground truth):
@Override @Value.Derived public Set<Node> allNodes(){
  return ImmutableSet.of(subject());
}
Program: 24869
Project: 24869
Buggy source:
public abstract Symbol docID();

Fixed version (ground truth):
@Override public abstract Symbol docID();
Program: 24870
Project: 24870
Buggy source:
public abstract Symbol eventArgumentType();

Fixed version (ground truth):
@Override public abstract Symbol eventArgumentType();
Program: 24871
Project: 24871
Buggy source:
public abstract Symbol eventType();

Fixed version (ground truth):
@Override public abstract Symbol eventType();
Program: 24874
Project: 24874
Buggy source:
public void finish() throws IOException {
  final ImmutableList<AggregateLinkingScoreRecord> aggregateRecords=aggregateRecordsB.build();
  writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecords),new File(outputDir,"String_Node_Str"));
  final ImmutableListMultimap<Symbol,AggregateLinkingScoreRecord> aggregateRecordsPerEvent=aggregateRecordsPerEventTypeB.build();
  for (  Symbol eventType : aggregateRecordsPerEvent.keySet()) {
    final ImmutableList<AggregateLinkingScoreRecord> aggregateRecordsForEvent=aggregateRecordsPerEvent.get(eventType);
    writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecordsForEvent),new File(new File(outputDir,"String_Node_Str"),eventType.asString()));
  }
}

Fixed version (ground truth):
@Override public void finish() throws IOException {
  final ImmutableList<AggregateLinkingScoreRecord> aggregateRecords=aggregateRecordsB.build();
  writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecords),new File(outputDir,"String_Node_Str"));
  final ImmutableListMultimap<Symbol,AggregateLinkingScoreRecord> aggregateRecordsPerEvent=aggregateRecordsPerEventTypeB.build();
  for (  Symbol eventType : aggregateRecordsPerEvent.keySet()) {
    final ImmutableList<AggregateLinkingScoreRecord> aggregateRecordsForEvent=aggregateRecordsPerEvent.get(eventType);
    writer.writeBootstrapData("String_Node_Str",mapScoresForWriter(aggregateRecordsForEvent),new File(new File(outputDir,"String_Node_Str"),eventType.asString()));
  }
}
Program: 24877
Project: 24877
Buggy source:
public BootstrapInspector.ObservationSummarizer<Alignment<? extends T,? extends T>,SummaryConfusionMatrix> createObservationSummarizer(){
  return new BootstrapInspector.ObservationSummarizer<Alignment<? extends T,? extends T>,SummaryConfusionMatrix>(){
    public SummaryConfusionMatrix summarizeObservation(    Alignment<? extends T,? extends T> alignment){
      return LinearScoreBootstrapStrategy.this.confusionMatrixForAlignment(alignment);
    }
  }
;
}

Fixed version (ground truth):
@Override public BootstrapInspector.ObservationSummarizer<Alignment<? extends T,? extends T>,SummaryConfusionMatrix> createObservationSummarizer(){
  return new BootstrapInspector.ObservationSummarizer<Alignment<? extends T,? extends T>,SummaryConfusionMatrix>(){
    @Override public SummaryConfusionMatrix summarizeObservation(    Alignment<? extends T,? extends T> alignment){
      return LinearScoreBootstrapStrategy.this.confusionMatrixForAlignment(alignment);
    }
  }
;
}
Program: 24878
Project: 24878
Buggy source:
public Collection<BootstrapInspector.SummaryAggregator<SummaryConfusionMatrix>> createSummaryAggregators(){
  return ImmutableList.<BootstrapInspector.SummaryAggregator<SummaryConfusionMatrix>>of(new Aggregator());
}

Fixed version (ground truth):
@Override public Collection<BootstrapInspector.SummaryAggregator<SummaryConfusionMatrix>> createSummaryAggregators(){
  return ImmutableList.<BootstrapInspector.SummaryAggregator<SummaryConfusionMatrix>>of(new Aggregator());
}
Program: 24879
Project: 24879
Buggy source:
public SummaryConfusionMatrix summarizeObservation(Alignment<? extends T,? extends T> alignment){
  return LinearScoreBootstrapStrategy.this.confusionMatrixForAlignment(alignment);
}

Fixed version (ground truth):
@Override public SummaryConfusionMatrix summarizeObservation(Alignment<? extends T,? extends T> alignment){
  return LinearScoreBootstrapStrategy.this.confusionMatrixForAlignment(alignment);
}
Program: 24881
Project: 24881
Buggy source:
/** 
 * Copy current immutable object by setting value for   {@link Aggregate2015ScoringResult#argument() argument}. Shallow reference equality check is used to prevent copying of the same value by returning   {@code this}.
 * @param value new value for argument
 * @return modified copy of the {@code this} object
 */
public final ImmutableAggregate2015ScoringResult withArgument(ImmutableAggregate2015ArgScoringResult value){
  if (this.argument == value) {
    return this;
  }
  ImmutableAggregate2015ArgScoringResult newValue=Preconditions.checkNotNull(value);
  return validate(new ImmutableAggregate2015ScoringResult(newValue,this.linking,this.overall));
}

Fixed version (ground truth):
/** 
 * Copy current immutable object by setting value for   {@link Aggregate2015ScoringResult#argument() argument}. Shallow reference equality check is used to prevent copying of the same value by returning   {@code this}.
 * @param value new value for argument
 * @return modified copy of the {@code this} object
 */
@SuppressWarnings("String_Node_Str") public final ImmutableAggregate2015ScoringResult withArgument(ImmutableAggregate2015ArgScoringResult value){
  if (this.argument == value) {
    return this;
  }
  ImmutableAggregate2015ArgScoringResult newValue=Preconditions.checkNotNull(value);
  return validate(new ImmutableAggregate2015ScoringResult(newValue,this.linking,this.overall));
}
Program: 24882
Project: 24882
Buggy source:
/** 
 * Copy current immutable object by setting value for   {@link Aggregate2015ScoringResult#linking() linking}. Shallow reference equality check is used to prevent copying of the same value by returning   {@code this}.
 * @param value new value for linking
 * @return modified copy of the {@code this} object
 */
public final ImmutableAggregate2015ScoringResult withLinking(ImmutableAggregate2015LinkScoringResult value){
  if (this.linking == value) {
    return this;
  }
  ImmutableAggregate2015LinkScoringResult newValue=Preconditions.checkNotNull(value);
  return validate(new ImmutableAggregate2015ScoringResult(this.argument,newValue,this.overall));
}

Fixed version (ground truth):
/** 
 * Copy current immutable object by setting value for   {@link Aggregate2015ScoringResult#linking() linking}. Shallow reference equality check is used to prevent copying of the same value by returning   {@code this}.
 * @param value new value for linking
 * @return modified copy of the {@code this} object
 */
@SuppressWarnings("String_Node_Str") public final ImmutableAggregate2015ScoringResult withLinking(ImmutableAggregate2015LinkScoringResult value){
  if (this.linking == value) {
    return this;
  }
  ImmutableAggregate2015LinkScoringResult newValue=Preconditions.checkNotNull(value);
  return validate(new ImmutableAggregate2015ScoringResult(this.argument,newValue,this.overall));
}
Program: 24884
Project: 24884
Buggy source:
public void logStats(){
  log.info("String_Node_Str" + "String_Node_Str",passedThrough,swappedCASForSameBF,swappedCASDifferentBF,deleted);
}

Fixed version (ground truth):
@Override public void logStats(){
  log.info("String_Node_Str" + "String_Node_Str",passedThrough,swappedCASForSameBF,swappedCASDifferentBF,deleted);
}
Program: 24885
Project: 24885
Buggy source:
private static ResponseLinking linkAll(final ArgumentOutput bbnOutputDoc1){
  final ResponseSet responseSet=ResponseSet.of(bbnOutputDoc1.responses());
  return ResponseLinking.builder().docID(bbnOutputDoc1.docId()).addResponseSets(responseSet).responseSetIds(ImmutableBiMap.of(DUMMY_EVENT_FRAME_ID,responseSet)).build();
}

Fixed version (ground truth):
private static ResponseLinking linkAll(final ArgumentOutput bbnOutputDoc1){
  final ResponseSet responseSet=ResponseSet.from(bbnOutputDoc1.responses());
  return ResponseLinking.builder().docID(bbnOutputDoc1.docId()).addResponseSets(responseSet).responseSetIds(ImmutableBiMap.of(DUMMY_EVENT_FRAME_ID,responseSet)).build();
}
Program: 24886
Project: 24886
Buggy source:
public String toString(){
  return MoreObjects.toStringHelper(this).add("String_Node_Str",docid).add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(annotatedResponses()) + "String_Node_Str").add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(unannotatedResponses())).add("String_Node_Str",corefAnnotation()).toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return MoreObjects.toStringHelper(this).add("String_Node_Str",docid).add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(annotatedResponses()) + "String_Node_Str").add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(unannotatedResponses())).add("String_Node_Str",corefAnnotation()).toString();
}
Program: 24887
Project: 24887
Buggy source:
public String toString(){
  return MoreObjects.toStringHelper(this).add("String_Node_Str",docId).add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(CASesToIDs.entrySet()) + "String_Node_Str").add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(unannotatedCASes()) + "String_Node_Str").toString();
}

Fixed version (ground truth):
@Override public String toString(){
  return MoreObjects.toStringHelper(this).add("String_Node_Str",docId).add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(CASesToIDs.entrySet()) + "String_Node_Str").add("String_Node_Str","String_Node_Str" + StringUtils.unixNewlineJoiner().join(unannotatedCASes()) + "String_Node_Str").toString();
}
Program: 24888
Project: 24888
Buggy source:
@Override public void observeSample(final Collection<DocLevelLinkingScoring> collection){
{
    final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
    for (    final DocLevelLinkingScoring linkingScoring : collection) {
      docRecordsB.add(linkingScoring.linkingScoreDocRecord());
    }
    aggregateRecordB.from(aggregateScores(docRecordsB.build()));
  }
{
    final ImmutableSet.Builder<Symbol> eventTypesB=ImmutableSet.builder();
    for (    final DocLevelLinkingScoring linkingScoring : collection) {
      eventTypesB.addAll(linkingScoring.docRecordsPerEventType().keySet());
    }
    final ImmutableSet<Symbol> eventTypes=eventTypesB.build();
    for (    final Symbol eventType : eventTypes) {
      final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
      for (      final DocLevelLinkingScoring linkingScoring : collection) {
        if (linkingScoring.docRecordsPerEventType().containsKey(eventType)) {
          docRecordsB.add(linkingScoring.docRecordsPerEventType().get(eventType));
        }
      }
      aggregateRecordsPerEventTypeB.put(eventType,aggregateScores(docRecordsB.build()));
    }
  }
}

Fixed version (ground truth):
@Override public void observeSample(final Collection<DocLevelLinkingScoring> collection){
{
    final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
    for (    final DocLevelLinkingScoring linkingScoring : collection) {
      docRecordsB.add(linkingScoring.linkingScoreDocRecord());
    }
    aggregateRecordsB.add(aggregateScores(docRecordsB.build()));
  }
{
    final ImmutableSet.Builder<Symbol> eventTypesB=ImmutableSet.builder();
    for (    final DocLevelLinkingScoring linkingScoring : collection) {
      eventTypesB.addAll(linkingScoring.docRecordsPerEventType().keySet());
    }
    final ImmutableSet<Symbol> eventTypes=eventTypesB.build();
    for (    final Symbol eventType : eventTypes) {
      final ImmutableList.Builder<LinkingScoreDocRecord> docRecordsB=ImmutableList.builder();
      for (      final DocLevelLinkingScoring linkingScoring : collection) {
        if (linkingScoring.docRecordsPerEventType().containsKey(eventType)) {
          docRecordsB.add(linkingScoring.docRecordsPerEventType().get(eventType));
        }
      }
      aggregateRecordsPerEventTypeB.put(eventType,aggregateScores(docRecordsB.build()));
    }
  }
}
Program: 24889
Project: 24889
Buggy source:
private AggregateLinkingScoreRecord aggregateScores(ImmutableList<LinkingScoreDocRecord> docRecords){
  double precision=0.0;
  double recall=0.0;
  double f1=0.0;
  double linkNormalizerSum=0.0;
  final ImmutableListMultimap.Builder<String,Double> f1sB=ImmutableListMultimap.builder();
  final ImmutableListMultimap.Builder<String,Double> precisionsB=ImmutableListMultimap.builder();
  final ImmutableListMultimap.Builder<String,Double> recallsB=ImmutableListMultimap.builder();
  for (  final LinkingScoreDocRecord docRecord : docRecords) {
    precision+=docRecord.fMeasureInfo().precision() * docRecord.predictedCounts();
    recall+=docRecord.fMeasureInfo().recall() * docRecord.actualCounts();
    f1+=docRecord.fMeasureInfo().f1() * docRecord.actualCounts();
    linkNormalizerSum+=docRecord.linkingArgCounts();
  }
  f1sB.put("String_Node_Str",(linkNormalizerSum > 0.0) ? f1 / linkNormalizerSum : 0.0);
  precisionsB.put("String_Node_Str",(linkNormalizerSum > 0.0) ? precision / linkNormalizerSum : 0.0);
  recallsB.put("String_Node_Str",(linkNormalizerSum > 0.0) ? recall / linkNormalizerSum : 0.0);
  return new AggregateLinkingScoreRecord.Builder().f1s(f1sB.build()).precisions(precisionsB.build()).recalls(recallsB.build()).build();
}

Fixed version (ground truth):
private AggregateLinkingScoreRecord aggregateScores(ImmutableList<LinkingScoreDocRecord> docRecords){
  double precision=0.0;
  double recall=0.0;
  double f1=0.0;
  double linkNormalizerSum=0.0;
  for (  final LinkingScoreDocRecord docRecord : docRecords) {
    precision+=docRecord.fMeasureInfo().precision() * docRecord.predictedCounts();
    recall+=docRecord.fMeasureInfo().recall() * docRecord.actualCounts();
    f1+=docRecord.fMeasureInfo().f1() * docRecord.actualCounts();
    linkNormalizerSum+=docRecord.linkingArgCounts();
  }
  f1=(linkNormalizerSum > 0.0) ? f1 / linkNormalizerSum : 0.0;
  precision=(linkNormalizerSum > 0.0) ? precision / linkNormalizerSum : 0.0;
  recall=(linkNormalizerSum > 0.0) ? recall / linkNormalizerSum : 0.0;
  return new AggregateLinkingScoreRecord.Builder().f1(f1).precision(precision).recall(recall).build();
}