|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.unimi.di.mg4j.search.visitor.AbstractDocumentIteratorVisitor it.unimi.di.mg4j.search.visitor.CounterSetupVisitor
public class CounterSetupVisitor
A visitor using the information collected by a
TermCollectionVisitor
to set up term frequencies and counters.
Term frequencies and counts are stored
in publicly accessible parallel arrays of integers indexed by offsets,
as defined by a TermCollectionVisitor
provided at construction time.
Additionally, the index number (a position into the array returned by
TermCollectionVisitor.indices()
) and the
term for each offset are available.
When instances of this class perform a visit, they prepare the arrays and
fill those contaning frequencies and index numbers.
It is up to an instance of CounterCollectionVisitor
(which requires an instance of this class in its constructor) to fill
the counts with data related to
the current document.
For a more complete picture, see CounterCollectionVisitor
.
Field Summary | |
---|---|
int[] |
count
For each offset, its count. |
int[] |
frequency
For each offset, its frequency. |
int[] |
indexNumber
For each offset, the corresponding index as a position in TermCollectionVisitor.indices() . |
String[] |
offset2Term
For each offset, the corresponding term. |
int[] |
offset2TermId
For each offset, its term id. |
String[] |
termId2Term
For each term id, the corresponding term. |
Constructor Summary | |
---|---|
CounterSetupVisitor(TermCollectionVisitor termCollectionVisitor)
Creates a new counter-setup visitor based on a given term-collection visitor. |
Method Summary | |
---|---|
void |
clear()
Zeroes all counters, but not frequencies. |
CounterSetupVisitor |
prepare()
Prepares the internal state of this visitor using data from the associated TermCollectionVisitor . |
String |
toString()
|
void |
update(IndexIterator indexIterator)
Updates the count using the provided index iterator. |
Boolean |
visit(IndexIterator indexIterator)
Visits an IndexIterator leaf. |
Methods inherited from class it.unimi.di.mg4j.search.visitor.AbstractDocumentIteratorVisitor |
---|
newArray, visit, visit, visit, visitPost, visitPre |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int[] indexNumber
TermCollectionVisitor.indices()
.
public String[] offset2Term
public int[] count
public int[] frequency
public int[] offset2TermId
public String[] termId2Term
Constructor Detail |
---|
public CounterSetupVisitor(TermCollectionVisitor termCollectionVisitor)
termCollectionVisitor
- a term-collection visitor.Method Detail |
---|
public CounterSetupVisitor prepare()
TermCollectionVisitor
.
Note that because of this dependency, it is essential that you
first prepare and visit with the associated TermCollectionVisitor
,
and then prepare and visit with this visitor.
prepare
in interface DocumentIteratorVisitor<Boolean>
prepare
in class AbstractDocumentIteratorVisitor
public Boolean visit(IndexIterator indexIterator) throws IOException
DocumentIteratorVisitor
IndexIterator
leaf.
indexIterator
- the leaf to be visited.
null
.
IOException
public void update(IndexIterator indexIterator) throws IOException
count
using the provided index iterator.
This method is usually called back by a CounterCollectionVisitor
built upon
this counter-setup visitor. It simply retrieves the index iterator
id and use it as an index into
count
to store IndexIterator.count()
.
indexIterator
- an index iterator.
IOException
public void clear()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |