|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectit.unimi.dsi.fastutil.objects.AbstractObjectIterator<Interval>
it.unimi.dsi.mg4j.search.IntervalIterators.FakeIterator
protected static class IntervalIterators.FakeIterator
An iterator that throws an exception on all advancing method calls, except for hasNext(),
which has a settable value. The extent is 0.
The only purpose of this class is to instantiate singleton 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()
|
void |
intervalTerms(IntSet terms)
Provides the set of terms that span the current interval. |
Interval |
next()
Returns the next interval. |
Interval |
nextInterval()
Returns the next interval provided by this interval iterator, or null if no more intervals are available. |
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 |
|---|
public boolean hasNext()
hasNext in interface Iterator<Interval>public void reset()
IntervalIteratorTo 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).
reset in interface IntervalIteratorpublic Interval next()
IntervalIterator
next in interface IntervalIteratornext in interface Iterator<Interval>IntervalIterator.nextInterval()public Interval nextInterval()
IntervalIteratornull if no more intervals are available.
This method has been reintroduced in MG4J 1.2 with a different semantics.
The special return value null is used to mark the end of iteration. The reason
for this change is providing fully lazy iteration over intervals. Fully lazy iteration
does not provide an hasNext() method—you have to actually ask for the next
element and check the return value. Fully lazy iteration is much lighter on method calls (half) and
in most (if not all) MG4J classes leads to a much simpler logic. Moreover, IntervalIterator.nextInterval()
can be specified as throwing an IOException, which avoids the pernicious proliferation
of try/catch blocks in very short, low-level methods (it was having a detectable impact on performance).
nextInterval in interface IntervalIteratornull if no more intervals are available.public int extent()
IntervalIterator
extent in interface IntervalIteratorpublic String toString()
toString in class Objectpublic void intervalTerms(IntSet terms)
IntervalIteratorFor each interval returned by MG4J, there is a set of terms that caused the interval to be returned. The terms appear inside the interval, and certainly at its extremes.
Note that the results of this method must be taken with a grain of salt: there might be different sets of terms causing the current interval, and only one will be returned.
intervalTerms in interface IntervalIteratorterms - a set of integers that will be filled with the terms spanning the current interval.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||