Package it.unimi.di.big.mg4j.search
Class AbstractDocumentIterator
- java.lang.Object
-
- it.unimi.di.big.mg4j.search.AbstractDocumentIterator
-
- All Implemented Interfaces:
DocumentIterator
- Direct Known Subclasses:
AbstractIntervalDocumentIterator,DocumentalConcatenatedClusterDocumentIterator,DocumentalMergedClusterDocumentIterator,FalseDocumentIterator,NotDocumentIterator,PayloadPredicateDocumentIterator,TrueDocumentIterator
public abstract class AbstractDocumentIterator extends Object implements DocumentIterator
An abstract iterator on documents that and provides support for theDocumentIterator.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_LISTdenotes an iterator that has been exhausted.Methods performing actions depending on the last document returned should throw an
IllegalStateExceptionif called whencurris -1 orDocumentIterator.END_OF_LIST. You just need to callensureOnADocument().
-
-
Field Summary
Fields Modifier and Type Field Description protected longcurrThe current document of the iterator.protected doubleweightThe weight of this iterator.-
Fields inherited from interface it.unimi.di.big.mg4j.search.DocumentIterator
END_OF_LIST
-
-
Constructor Summary
Constructors Constructor Description AbstractDocumentIterator()
-
Method Summary
Modifier and Type Method Description longdocument()Returns the current document.protected voidensureOnADocument()booleanmayHaveNext()Returns whether there may be a next document, possibly with false positives.doubleweight()Returns the weight associated with this iterator.DocumentIteratorweight(double weight)Sets the weight of this index iterator.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unimi.di.big.mg4j.search.DocumentIterator
accept, acceptOnTruePaths, dispose, indices, intervalIterator, intervalIterator, intervalIterators, nextDocument, skipTo
-
-
-
-
Field Detail
-
curr
protected long curr
The current document of the iterator.- See Also:
AbstractDocumentIterator
-
weight
protected double weight
The weight of this iterator.
-
-
Method Detail
-
mayHaveNext
public boolean mayHaveNext()
Description copied from interface:DocumentIteratorReturns whether there may be a next document, possibly with false positives.- Specified by:
mayHaveNextin interfaceDocumentIterator- Returns:
- true there may be a next document; false if certainly there is no next document.
-
weight
public double weight()
Description copied from interface:DocumentIteratorReturns the weight associated with this iterator.The number returned by this method has no fixed semantics: different scorers might choose different interpretations, or even ignore it.
- Specified by:
weightin interfaceDocumentIterator- Returns:
- the weight associated with this iterator.
-
weight
public DocumentIterator weight(double weight)
Description copied from interface:DocumentIteratorSets the weight of this index iterator.- Specified by:
weightin interfaceDocumentIterator- Parameters:
weight- the weight of this index iterator.- Returns:
- this document iterator.
-
ensureOnADocument
protected final void ensureOnADocument()
-
document
public long document()
Returns the current document.- Specified by:
documentin interfaceDocumentIterator- Returns:
curr.
-
-