|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.mg4j.search.IntervalIterators
public class IntervalIterators
A class providing static methods and objects that do useful things with interval iterators.
Nested Class Summary | |
---|---|
protected static class |
IntervalIterators.FakeIterator
An iterator that throws an exception on all advancing method calls, except for IntervalIterators.FakeIterator.hasNext() ,
which has a settable value. |
Field Summary | |
---|---|
static IntervalIterator |
FALSE
A singleton empty interval iterator. |
static IntervalIterator |
TRUE
A singleton iterator representing maximum truth. |
Method Summary |
---|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final IntervalIterator TRUE
This iterator is a placeholder for an iterator returning just Intervals.EMPTY_INTERVAL
.
The antichain formed by the empty interval is the top element of the lattice of antichains, and
thus represents the highest truth. Since, however, EMPTY_INTERVAL
is a singleton that slightly violates the Interval
invariants, an iterator actually
returning EMPTY_INTERVAL
would cause severe problems in all algorithms manipulating
intervals. Rather, TRUE
is treated separately and is never actually used in
an algorithm on interval antichains (also because, albeit it claims to have elements,
it will return null
on IntervalIterator.nextInterval()
).
A most natural appearance of TRUE
is due to negation: all documents satisfying
a negative query return TRUE
as interval iterator.
Finally, an IndexIterator
by convention returns TRUE
when DocumentIterator.intervalIterator(it.unimi.dsi.mg4j.index.Index)
is called with an argument that is not the key index.
The idea is that there is no witness to be returned, but the query is nonetheless true.
public static final IntervalIterator FALSE
The main usefulness of this iterator is as a singleton: in some circumstances you have
to return an empty iterator, and since it is by definition stateless, it is a pity
to create a new object (the same considerations led to Collections.emptySet()
).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |