AbstractDocIdSetIterator (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.search, class: AbstractDocIdSetIterator

Package org.apache.lucene.search

# Class AbstractDocIdSetIterator

java.lang.Object
org.apache.lucene.search.DocIdSetIterator
org.apache.lucene.search.AbstractDocIdSetIterator

Direct Known Subclasses:
  `BitSetIterator`, `DisjunctionDISIApproximation`, `DocBaseBitSetIterator`, `FilteredDocIdSetIterator`, `IndexedDISI`, `SkipBlockRangeIterator`

public abstract class AbstractDocIdSetIterator extends DocIdSetIterator
Abstract implementation of a `DocIdSetIterator` that tracks the current doc ID. Implementing `DocIdSetIterator` by extending either this class or `FilterDocIdSetIterator` is a good idea in order to reduce polymorphism of call sites to `DocIdSetIterator.docID()`.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `doc`
  The current doc ID, initialized at -1.

  ### Fields inherited from class org.apache.lucene.search.DocIdSetIterator

  `NO_MORE_DOCS`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  `protected`
  `AbstractDocIdSetIterator()`
  Sole constructor, invoked by sub-classes.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final int`
  `docID()`
  Returns the following: `-1` if `DocIdSetIterator.nextDoc()` or `DocIdSetIterator.advance(int)` were not called yet.

  ### Methods inherited from class org.apache.lucene.search.DocIdSetIterator

  `advance, all, cost, docIDRunEnd, empty, intoBitSet, nextDoc, range, slowAdvance`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### doc

    protected int doc
    The current doc ID, initialized at -1.

- ## Constructor Details

  - ### AbstractDocIdSetIterator

    protected AbstractDocIdSetIterator()
    Sole constructor, invoked by sub-classes.

- ## Method Details

  - ### docID

    public final int docID()
    Description copied from class: `DocIdSetIterator`
    Returns the following:
    - `-1` if `DocIdSetIterator.nextDoc()` or `DocIdSetIterator.advance(int)` were not called yet.
    - `DocIdSetIterator.NO_MORE_DOCS` if the iterator has exhausted.
    - Otherwise it should return the doc ID it is currently on.
    Specified by:
      `docID` in class `DocIdSetIterator`