it.unimi.dsi.mg4j.search
Class OrDocumentIterator

java.lang.Object
  extended by it.unimi.dsi.fastutil.ints.AbstractIntIterator
      extended by it.unimi.dsi.mg4j.search.AbstractDocumentIterator
          extended by it.unimi.dsi.mg4j.search.AbstractCompositeDocumentIterator
              extended by it.unimi.dsi.mg4j.search.AbstractUnionDocumentIterator
                  extended by it.unimi.dsi.mg4j.search.OrDocumentIterator
All Implemented Interfaces:
IntIterator, DocumentIterator, Iterable<Interval>, Iterator<Integer>

public class OrDocumentIterator
extends AbstractUnionDocumentIterator
implements DocumentIterator

An iterator on documents that returns the OR of a number of document iterators.

This class adds to AbstractUnionDocumentIterator an interval iterator generating the OR of the intervals returned for each of the documents involved.


Nested Class Summary
protected  class OrDocumentIterator.OrIndexIntervalIterator
          An optimised interval iterator with the same semantics as that implemented by OrDocumentIterator, but using just IndexIterator.positionArray().
 
Nested classes/interfaces inherited from class it.unimi.dsi.mg4j.search.AbstractCompositeDocumentIterator
AbstractCompositeDocumentIterator.AbstractCompositeIndexIntervalIterator, AbstractCompositeDocumentIterator.AbstractCompositeIntervalIterator
 
Nested classes/interfaces inherited from class it.unimi.dsi.mg4j.search.AbstractDocumentIterator
AbstractDocumentIterator.AbstractIntervalIterator
 
Field Summary
 
Fields inherited from class it.unimi.dsi.mg4j.search.AbstractUnionDocumentIterator
curr, front, frontSize, queue
 
Fields inherited from class it.unimi.dsi.mg4j.search.AbstractCompositeDocumentIterator
documentIterator, indexIterator, indices, n, soleIndex
 
Fields inherited from class it.unimi.dsi.mg4j.search.AbstractDocumentIterator
last, next
 
Constructor Summary
protected OrDocumentIterator(DocumentIterator... documentIterator)
          Creates a new document iterator that computes the OR of the given array of iterators.
 
Method Summary
protected  IntervalIterator getComposedIntervalIterator(Index index)
           
static DocumentIterator getInstance(DocumentIterator... documentIterator)
          Returns a document iterator that computes the OR of the given array of iterators.
 
Methods inherited from class it.unimi.dsi.mg4j.search.AbstractUnionDocumentIterator
acceptOnTruePaths, computeFront, intervalIterator, intervalIterators, nextDocument, skipTo
 
Methods inherited from class it.unimi.dsi.mg4j.search.AbstractCompositeDocumentIterator
accept, dispose, indices, intervalIterator, toString
 
Methods inherited from class it.unimi.dsi.mg4j.search.AbstractDocumentIterator
document, hasNext, iterator, nextInt
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntIterator
next, remove, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.mg4j.search.DocumentIterator
accept, acceptOnTruePaths, dispose, document, indices, intervalIterator, intervalIterator, intervalIterators, iterator, nextDocument, nextInt, skipTo
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator
skip
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Constructor Detail

OrDocumentIterator

protected OrDocumentIterator(DocumentIterator... documentIterator)
                      throws IOException
Creates a new document iterator that computes the OR of the given array of iterators.

Parameters:
documentIterator - the iterators to be joined.
Throws:
IOException
Method Detail

getInstance

public static DocumentIterator getInstance(DocumentIterator... documentIterator)
                                    throws IOException
Returns a document iterator that computes the OR of the given array of iterators.

Note that the special case of the empty and of the singleton arrays are handled efficiently.

Parameters:
documentIterator - the iterators to be joined.
Returns:
a document iterator that computes the OR of it.
Throws:
IOException

getComposedIntervalIterator

protected IntervalIterator getComposedIntervalIterator(Index index)
Specified by:
getComposedIntervalIterator in class AbstractUnionDocumentIterator