it.unimi.dsi.mg4j.search
Class IntervalIterators.FakeIterator

java.lang.Object
  extended byit.unimi.dsi.fastutil.objects.AbstractObjectIterator
      extended byit.unimi.dsi.mg4j.search.IntervalIterators.FakeIterator
All Implemented Interfaces:
IntervalIterator, Iterator, ObjectIterator
Enclosing class:
IntervalIterators

public static class IntervalIterators.FakeIterator
extends AbstractObjectIterator
implements IntervalIterator

An iterator that throws an exception on all method calls, except for hasNext(), which has a settable value.

The only purpose of this class is to instantiate "absolute value" iterators such as IntervalIterators.TRUE and IntervalIterators.FALSE.


Method Summary
 int extent()
          Returns an approximation of a lower bound for the length of an interval returned by this iterator.
 boolean hasNext()
           
 Object next()
           
 Interval nextInterval()
          Returns the next interval in the sequence.
 void reset()
          Resets the internal state of this iterator for a new document.
 String toString()
           
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObjectIterator
remove, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Iterator
remove
 

Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

nextInterval

public Interval nextInterval()
Description copied from interface: IntervalIterator
Returns the next interval in the sequence.

A call to this method is equivalent to (Interval)next().

Specified by:
nextInterval in interface IntervalIterator
Returns:
the next interval in the sequence.

reset

public void reset()
Description copied from interface: IntervalIterator
Resets the internal state of this iterator for a new document.

To reduce object creation, interval iterators are usually created in a lazy fashion by document iterator when they are needed. However, this implies that every time the document iterator is moved, some internal state of the interval iterator must be reset (e.g., because on the new document some of the component interval iterators are now IntervalIterators.TRUE).

Specified by:
reset in interface IntervalIterator

next

public Object next()
Specified by:
next in interface Iterator

extent

public int extent()
Description copied from interface: IntervalIterator
Returns an approximation of a lower bound for the length of an interval returned by this iterator.

Specified by:
extent in interface IntervalIterator
Returns:
an approximation of a lower bound for the length of an interval.

toString

public String toString()