public abstract class AbstractDocumentIterator extends Object implements DocumentIterator
DocumentIterator.weight()/DocumentIterator.weight(double) methods.
Instances of this class expect implementation to keep track of the current document
of the iterator. The special value -1 denotes an iterator that has not still been accessed,
and the special value DocumentIterator.END_OF_LIST denotes an iterator that has been exhausted.
Methods performing actions depending on the last document returned should throw an IllegalStateException
if called when curr is -1 or DocumentIterator.END_OF_LIST. You just need to call ensureOnADocument().
| Modifier and Type | Field and Description |
|---|---|
protected long |
curr
The current document of the iterator.
|
protected double |
weight
The weight of this iterator.
|
END_OF_LIST| Constructor and Description |
|---|
AbstractDocumentIterator() |
| Modifier and Type | Method and Description |
|---|---|
long |
document()
Returns the current document.
|
protected void |
ensureOnADocument() |
boolean |
mayHaveNext()
Returns whether there may be a next document, possibly with false positives.
|
double |
weight()
Returns the weight associated with this iterator.
|
DocumentIterator |
weight(double weight)
Sets the weight of this index iterator.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaccept, acceptOnTruePaths, dispose, indices, intervalIterator, intervalIterator, intervalIterators, nextDocument, skipToprotected long curr
AbstractDocumentIteratorprotected double weight
public boolean mayHaveNext()
DocumentIteratormayHaveNext in interface DocumentIteratorpublic double weight()
DocumentIteratorThe number returned by this method has no fixed semantics: different scorers might choose different interpretations, or even ignore it.
weight in interface DocumentIteratorpublic DocumentIterator weight(double weight)
DocumentIteratorweight in interface DocumentIteratorweight - the weight of this index iterator.protected final void ensureOnADocument()
public long document()
document in interface DocumentIteratorcurr.