|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DocumentIteratorVisitor
A visitor for the tree defined by a DocumentIterator
.
Implementations of this interface must be reusable. The user must
invoke prepare()
before a visit so that the internal state
of the visitor can be suitably set up.
For maximum flexibility, there is just one visit method for leaves, but two visits methods for internal nodes, which should be used for preorder and postorder visits, respectively.
Note that this visitor interface and that defined in QueryBuilderVisitor
are based on different principles: in the latter case, the action of the visitor will likely
be different for each type of internal node, so we have specific visit methods for each type of such nodes.
In our case, the visit will most likely behave differently just for internal nodes and leaves, so we
prefer a simpler interface thatalso let us implement more easily visitor acceptance methods
(DocumentIterator.accept(DocumentIteratorVisitor)
and DocumentIterator.acceptOnTruePaths(DocumentIteratorVisitor)
).
Method Summary | |
---|---|
DocumentIteratorVisitor |
prepare()
Prepares the internal state of this visitor for a(nother) visit. |
boolean |
visit(IndexIterator indexIterator)
Visits a leaf. |
boolean |
visitPost(DocumentIterator documentIterator)
Visits an internal node after recursing into the corresponding subtree. |
boolean |
visitPre(DocumentIterator documentIterator)
Visits an internal node before recursing into the corresponding subtree. |
Method Detail |
---|
DocumentIteratorVisitor prepare()
By specification, it must be safe to call this method any number of times.
boolean visitPre(DocumentIterator documentIterator)
documentIterator
- the internal node to be visited.
boolean visitPost(DocumentIterator documentIterator)
documentIterator
- the internal node to be visited.
boolean visit(IndexIterator indexIterator) throws IOException
indexIterator
- the leaf to be visited.
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |