|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.ints.AbstractIntIterator
it.unimi.dsi.mg4j.index.AbstractIndexIterator
public abstract class AbstractIndexIterator
A very basic abstract implementation of an index interator,
providing an obvious implementation of term()
, id()
,
and of the visiting methods.
Field Summary | |
---|---|
protected int |
id
|
protected String |
term
|
Constructor Summary | |
---|---|
AbstractIndexIterator()
|
Method Summary | |
---|---|
boolean |
accept(DocumentIteratorVisitor visitor)
Accepts a visitor. |
boolean |
acceptOnTruePaths(DocumentIteratorVisitor visitor)
Accepts a visitor after a call to DocumentIterator.nextDocument() ,
limiting recursion to true paths. |
int |
id()
Returns the id of this index iterator. |
void |
id(int id)
Sets the id of this index iterator. |
IntervalIterator |
iterator()
Deprecated. |
String |
term()
Returns the term whose inverted list is returned by this index iterator. |
void |
term(CharSequence term)
Sets the term whose inverted list is returned by this index iterator. |
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntIterator |
---|
next, nextInt, remove, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface it.unimi.dsi.mg4j.index.IndexIterator |
---|
count, frequency, index, payload, positionArray, positions, positions, termNumber |
Methods inherited from interface it.unimi.dsi.mg4j.search.DocumentIterator |
---|
dispose, document, indices, intervalIterator, intervalIterator, intervalIterators, nextDocument, nextInt, skipTo |
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterator |
---|
skip |
Methods inherited from interface java.util.Iterator |
---|
hasNext, next, remove |
Field Detail |
---|
protected String term
protected int id
Constructor Detail |
---|
public AbstractIndexIterator()
Method Detail |
---|
public void term(CharSequence term)
IndexIterator
Usually, the term is automatically set by Index.documents(CharSequence)
or by IndexReader.documents(CharSequence)
, but you can
use this method to ensure that IndexIterator.term()
doesn't throw
an exception.
Instances of Index.EmptyIndexIterator
are allowed to ignore
silently calls to this method.
term
in interface IndexIterator
term
- a character sequence (that will be defensively copied)
that will be assumed to be the term whose inverted list is returned by this index iterator.public String term()
IndexIterator
Usually, the term is automatically set by IndexReader.documents(CharSequence)
or IndexReader.documents(int)
, but you can
supply your own term with IndexIterator.term(CharSequence)
.
Instances of Index.EmptyIndexIterator
can return null
.
term
in interface IndexIterator
IndexIterator.termNumber()
public void id(int id)
IndexIterator
The id is an integer associated to each index iterator. It has no specific semantics, and can be used differently in different contexts. A typical usage pattern, for instance, is using it to assign a unique number to the index iterators contained in a composited document iterator (say, numbering consecutively the leaves of the composite).
Instances of Index.EmptyIndexIterator
are allowed to ignore
silently calls to this method.
id
in interface IndexIterator
id
- the new id for this index iterator.public int id()
IndexIterator
Instances of Index.EmptyIndexIterator
are allowed to return -1.
id
in interface IndexIterator
IndexIterator.id(int)
public boolean accept(DocumentIteratorVisitor visitor) throws IOException
DocumentIterator
A document iterator is usually structured as composite,
with operators as internal nodes and IndexIterator
s
as leaves. This method implements the visitor pattern.
accept
in interface DocumentIterator
visitor
- the visitor.
IOException
public boolean acceptOnTruePaths(DocumentIteratorVisitor visitor) throws IOException
DocumentIterator
DocumentIterator.nextDocument()
,
limiting recursion to true paths.
After a call to DocumentIterator.nextDocument()
, a document iterator
is positioned over a document. This call is equivalent to DocumentIterator.accept(DocumentIteratorVisitor)
,
but visits only along true paths.
We define a true path as a path from the root of the composite that passes only through
nodes whose associated subtree is positioned on the same document of the root. Note that OrDocumentIterator
s
detach exhausted iterators from the composite tree, so true paths define the subtree that is causing
the current document to satisfy the query represented by this document iterator.
For more elaboration, and the main application of this method, see CounterCollectionVisitor
.
acceptOnTruePaths
in interface DocumentIterator
visitor
- the visitor.
IOException
DocumentIterator.accept(DocumentIteratorVisitor)
,
CounterCollectionVisitor
@Deprecated public IntervalIterator iterator()
DocumentIterator
DocumentIterator.intervalIterator()
, that has the same limitations (i.e., it will work only if
there is just one index), and that catches IOException
s.
iterator
in interface DocumentIterator
iterator
in interface Iterable<Interval>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |