|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.di.mg4j.search.visitor.AbstractDocumentIteratorVisitor
public abstract class AbstractDocumentIteratorVisitor
An abstract implementation of a DocumentIteratorVisitor
without
return values.
This implementation is hardwired to Boolean
,
returns always true on visitPre(DocumentIterator)
,
returns Boolean.TRUE
on all internal nodes if no subnode returns null
,
returns Boolean.TRUE
on true/false document iterators,
returns null
on calls to newArray(int)
,
and delegates visit(MultiTermIndexIterator)
to DocumentIteratorVisitor.visit(IndexIterator)
.
Constructor Summary | |
---|---|
AbstractDocumentIteratorVisitor()
|
Method Summary | |
---|---|
Boolean[] |
newArray(int len)
Builds an array of given length of type T . |
AbstractDocumentIteratorVisitor |
prepare()
Prepares the internal state of this visitor for a(nother) visit. |
Boolean |
visit(FalseDocumentIterator falseDocumentIterator)
Visits a FalseDocumentIterator leaf. |
Boolean |
visit(MultiTermIndexIterator indexIterator)
Visits a MultiTermIndexIterator leaf. |
Boolean |
visit(TrueDocumentIterator trueDocumentIterator)
Visits a TrueDocumentIterator leaf. |
Boolean |
visitPost(DocumentIterator documentIterator,
Boolean[] subNodeResult)
Visits an internal node after recursing into the corresponding subtree. |
boolean |
visitPre(DocumentIterator documentIterator)
Visits an internal node before recursing into the corresponding subtree. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface it.unimi.di.mg4j.search.visitor.DocumentIteratorVisitor |
---|
visit |
Constructor Detail |
---|
public AbstractDocumentIteratorVisitor()
Method Detail |
---|
public AbstractDocumentIteratorVisitor prepare()
DocumentIteratorVisitor
By specification, it must be safe to call this method any number of times.
prepare
in interface DocumentIteratorVisitor<Boolean>
public boolean visitPre(DocumentIterator documentIterator)
DocumentIteratorVisitor
visitPre
in interface DocumentIteratorVisitor<Boolean>
documentIterator
- the internal node to be visited.
public Boolean[] newArray(int len)
DocumentIteratorVisitor
T
.
Because of erasure, generic classes in Java cannot allocate arrays
of generic types. This impossibility can be a problem if for some reason
the visitPost()
methods expect an actual array of
type T
. This method must provide an array of given length
that is an acceptable input for all visitPost()
methods.
Note that by declaring an implementing class of this interface
that has a sole constructor accepting an argument of type Class<T>
,
you will force the user to provide the class of the generic type, opening
the way for the reflective methods in Array
.
newArray
in interface DocumentIteratorVisitor<Boolean>
len
- the required array length.
T
of length len
, or null
if
this document iterator visitor does not return values.public Boolean visitPost(DocumentIterator documentIterator, Boolean[] subNodeResult)
DocumentIteratorVisitor
visitPost
in interface DocumentIteratorVisitor<Boolean>
documentIterator
- the internal node to be visited.subNodeResult
- the array of results returned by subnodes.
subNode
) if the visit should continue, or null
.public Boolean visit(MultiTermIndexIterator indexIterator) throws IOException
DocumentIteratorVisitor
MultiTermIndexIterator
leaf.
visit
in interface DocumentIteratorVisitor<Boolean>
indexIterator
- the leaf to be visited.
null
.
IOException
public Boolean visit(TrueDocumentIterator trueDocumentIterator)
DocumentIteratorVisitor
TrueDocumentIterator
leaf.
visit
in interface DocumentIteratorVisitor<Boolean>
trueDocumentIterator
- the leaf to be visited.
null
.public Boolean visit(FalseDocumentIterator falseDocumentIterator)
DocumentIteratorVisitor
FalseDocumentIterator
leaf.
visit
in interface DocumentIteratorVisitor<Boolean>
falseDocumentIterator
- the leaf to be visited.
null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |