org.apache.lucene.search
Class DocIdSetIterator

java.lang.Object
  extended by org.apache.lucene.search.DocIdSetIterator
Direct Known Subclasses:
OpenBitSetIterator, Scorer

public abstract class DocIdSetIterator
extends Object

This abstract class defines methods to iterate over a set of non-decreasing doc ids.


Constructor Summary
DocIdSetIterator()
           
 
Method Summary
abstract  int doc()
          Returns the current document number.
abstract  boolean next()
          Moves to the next docId in the set.
abstract  boolean skipTo(int target)
          Skips entries to the first beyond the current whose document number is greater than or equal to target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocIdSetIterator

public DocIdSetIterator()
Method Detail

doc

public abstract int doc()
Returns the current document number.

This is invalid until next() is called for the first time.


next

public abstract boolean next()
                      throws IOException
Moves to the next docId in the set. Returns true, iff there is such a docId.

Throws:
IOException

skipTo

public abstract boolean skipTo(int target)
                        throws IOException
Skips entries to the first beyond the current whose document number is greater than or equal to target.

Returns true iff there is such an entry.

Behaves as if written:

   boolean skipTo(int target) {
     do {
       if (!next())
         return false;
     } while (target > doc());
     return true;
   }
 
Some implementations are considerably more efficient than that.

Throws:
IOException


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.