|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An iterator over documents and their intervals.
This class extends IntIterator
to a full-fledged document iterator. Each call to nextDocument()
(a synonym for IntIterator.nextInt()
) will return a document pointer. Just
after the call to nextDocument()
, intervalIterator(Index)
will return an interval iterator
enumerating intervals in the last returned document for the specified index. The latter method may return, as a special result, a
special TRUE
value: this means that even you should never care about the intervals this document
iterator returns (see TRUE
for some elaboration).
Warning: the interval enumeration can be carried out only just after a call
to nextDocument()
. Subsequent calls to nextDocument()
or even Iterator.hasNext()
will reset the internal state of the iterator. In particular, trying to enumerate intervals after a call
to Iterator.hasNext()
will throw an IllegalStateException
.
Method Summary | |
int |
document()
Returns the last document returned by IntIterator.nextInt() . |
Set |
indices()
Returns the set of indices over which this iterator is built. |
IntervalIterator |
intervalIterator()
Returns the interval iterator of this document iterator for single-index queries. |
IntervalIterator |
intervalIterator(Index index)
Returns the interval iterator of this document iterator for the given index. |
Map |
intervalIterators()
Returns an unmodifiable map from indices to interval iterators. |
int |
nextDocument()
A synonym for IntIterator.nextInt() . |
int |
skipTo(int n)
Skips all documents smaller than n . |
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator |
nextInt, skip |
Methods inherited from interface java.util.Iterator |
hasNext, next, remove |
Method Detail |
public IntervalIterator intervalIterator()
This is a commodity method that can be used only for queries built over a single index.
IllegalStateException
- if this document iterator is not built on a single index.intervalIterator(Index)
public IntervalIterator intervalIterator(Index index)
After a call to IntIterator.nextInt()
, this iterator
can be used to retrieve the intervals in the current document (the
one returned by IntIterator.nextInt()
) for
the index index
.
Note that it is guaranteed that at least one index will return an interval. However, for disjunctive queries it cannot be guaranteed that all indices will return an interval.
index
- an index (must be one over which the query was built).
index
.
UnsupportedOperationException
- if this index does not contain positions.public Map intervalIterators()
After a call to IntIterator.nextInt()
, this map
can be used to retrieve the intervals in the current document. An invocation of Map.get(java.lang.Object)
on this map with argument index
yields the same result as
intervalIterator(index)
.
UnsupportedOperationException
- if this index does not contain positions.intervalIterator(Index)
public Set indices()
public int nextDocument()
IntIterator.nextInt()
.
public int document()
IntIterator.nextInt()
.
IntIterator.nextInt()
, or -1 if no document has been returned yet.public int skipTo(int n)
n
.
Let k
be the last document returned by IntIterator.nextInt()
. If
k
is larger than or equal to n
, then
this method does nothing and returns k
. Otherwise, a
call to this method is equivalent to
while( hasNext() && ( k = nextInt() ) < n ); return hasNext() ? k : -1;
Beware that the first document larger than or equal to n
(which is returned
by this method) will not be returned by the next call to IntIterator.nextInt()
.
n
- a document index.
n
; otherwise,
an document larger than or equal to n
as described above.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |