|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface QueryBuilderVisitor<T>
A visitor for a composite query.
Instances of this class are builder visitors, that is, visitors that during their visit build a complex object (of course, it is possible not building an object at all).
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.
The most typical usage of this class is that of building document iterators following the structure of the query. By writing different builder visitors for different families of document iterators, parsing and document-iterator construction are completely decoupled.
Note that this visitor interface and that defined in DocumentIteratorVisitor
are based on different principles: see the comments therein.
Method Summary | |
---|---|
QueryBuilderVisitor<T> |
copy()
|
T[] |
newArray(int len)
Builds an array of given length of type T . |
QueryBuilderVisitor<T> |
prepare()
Prepares the internal state of this visitor for a(nother) visit. |
T |
visit(False node)
Visits False . |
T |
visit(Prefix node)
Visits a Prefix . |
T |
visit(Range node)
Visits a Range . |
T |
visit(Term node)
Visits a Term . |
T |
visit(True node)
Visits True . |
T |
visitPost(Align node,
T[] subNodeResult)
Visits an Align node after recursing into the corresponding subtree. |
T |
visitPost(And node,
T[] subNodeResult)
Visits an And node after recursing into the corresponding subtree. |
T |
visitPost(Consecutive node,
T[] subNodeResult)
Visits a Consecutive node after recursing into the corresponding subtree. |
T |
visitPost(Difference node,
T[] subNodeResult)
Visits an Difference node after recursing into the corresponding subtree. |
T |
visitPost(LowPass node,
T subNodeResult)
Visits a LowPass node after recursing into the corresponding subtree. |
T |
visitPost(MultiTerm node,
T[] subNodeResult)
Visits a MultiTerm node after recursing into the corresponding subtree. |
T |
visitPost(Not node,
T subNodeResult)
Visits a Not node after recursing into the corresponding subtree. |
T |
visitPost(OrderedAnd node,
T[] subNodeResult)
Visits an OrderedAnd node after recursing into the corresponding subtree. |
T |
visitPost(Or node,
T[] subNodeResult)
Visits an Or node after recursing into the corresponding subtree. |
T |
visitPost(Remap node,
T subNodeResult)
Visits a Remap node after recursing into the corresponding subtree. |
T |
visitPost(Select node,
T subNodeResult)
Visits a Select node after recursing into the corresponding subtree. |
T |
visitPost(Weight node,
T subNodeResult)
Visits a Weight node after recursing into the corresponding subtree. |
boolean |
visitPre(Align node)
Visits an Align node before recursing into the corresponding subtree. |
boolean |
visitPre(And node)
Visits an And node before recursing into the corresponding subtree. |
boolean |
visitPre(Consecutive node)
Visits a Consecutive node before recursing into the corresponding subtree. |
boolean |
visitPre(Difference node)
Visits an Difference node before recursing into the corresponding subtree. |
boolean |
visitPre(LowPass node)
Visits a LowPass node before recursing into the corresponding subtree. |
boolean |
visitPre(MultiTerm node)
Visits a MultiTerm node before recursing into the corresponding subtree. |
boolean |
visitPre(Not node)
Visits a Not node before recursing into the corresponding subtree. |
boolean |
visitPre(Or node)
Visits an Or node before recursing into the corresponding subtree. |
boolean |
visitPre(OrderedAnd node)
Visits an OrderedAnd node before recursing into the corresponding subtree. |
boolean |
visitPre(Remap node)
Visits a Remap node before recursing into the corresponding subtree. |
boolean |
visitPre(Select node)
Visits a Select node before recursing into the corresponding subtree. |
boolean |
visitPre(Weight node)
Visits a Weight node before recursing into the corresponding subtree. |
Method Detail |
---|
QueryBuilderVisitor<T> prepare()
By specification, it must be safe to call this method any number of times.
T[] newArray(int len)
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
.
len
- the required array length.
T
of length len
.boolean visitPre(And node) throws QueryBuilderVisitorException
And
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(And node, T[] subNodeResult) throws QueryBuilderVisitorException
And
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the array of results returned by subnodes.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Consecutive node) throws QueryBuilderVisitorException
Consecutive
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Consecutive node, T[] subNodeResult) throws QueryBuilderVisitorException
Consecutive
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the array of results returned by subnodes.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(LowPass node) throws QueryBuilderVisitorException
LowPass
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(LowPass node, T subNodeResult) throws QueryBuilderVisitorException
LowPass
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the of result returned by the sole subnode.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Not node) throws QueryBuilderVisitorException
Not
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Not node, T subNodeResult) throws QueryBuilderVisitorException
Not
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the of result returned by the sole subnode.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Or node) throws QueryBuilderVisitorException
Or
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Or node, T[] subNodeResult) throws QueryBuilderVisitorException
Or
node after recursing into the corresponding subtree.
node
- the internal node to be visited.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(OrderedAnd node) throws QueryBuilderVisitorException
OrderedAnd
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(OrderedAnd node, T[] subNodeResult) throws QueryBuilderVisitorException
OrderedAnd
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the array of results returned by subnodes.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Align node) throws QueryBuilderVisitorException
Align
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Align node, T[] subNodeResult) throws QueryBuilderVisitorException
Align
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the array of results returned by subnodes.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Difference node) throws QueryBuilderVisitorException
Difference
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Difference node, T[] subNodeResult) throws QueryBuilderVisitorException
Difference
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the array of results returned by subnodes.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(MultiTerm node) throws QueryBuilderVisitorException
MultiTerm
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(MultiTerm node, T[] subNodeResult) throws QueryBuilderVisitorException
MultiTerm
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the of result returned by the sole subnode.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Select node) throws QueryBuilderVisitorException
Select
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Select node, T subNodeResult) throws QueryBuilderVisitorException
Select
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the of result returned by the sole subnode.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Remap node) throws QueryBuilderVisitorException
Remap
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Remap node, T subNodeResult) throws QueryBuilderVisitorException
Remap
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the of result returned by the sole subnode.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
boolean visitPre(Weight node) throws QueryBuilderVisitorException
Weight
node before recursing into the corresponding subtree.
node
- the node to be visited.
QueryBuilderVisitorException
T visitPost(Weight node, T subNodeResult) throws QueryBuilderVisitorException
Weight
node after recursing into the corresponding subtree.
node
- the internal node to be visited.subNodeResult
- the of result returned by the sole subnode.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
T visit(Term node) throws QueryBuilderVisitorException
Term
.
node
- the leaf to be visited.
QueryBuilderVisitorException
T visit(Prefix node) throws QueryBuilderVisitorException
Prefix
.
node
- the leaf to be visited.
subNodeResult
) if the visit should continue, or null
.
QueryBuilderVisitorException
T visit(Range node) throws QueryBuilderVisitorException
Range
.
node
- the leaf to be visited.
QueryBuilderVisitorException
T visit(True node) throws QueryBuilderVisitorException
True
.
node
- the leaf to be visited.
QueryBuilderVisitorException
T visit(False node) throws QueryBuilderVisitorException
False
.
node
- the leaf to be visited.
QueryBuilderVisitorException
QueryBuilderVisitor<T> copy()
copy
in interface FlyweightPrototype<QueryBuilderVisitor<T>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |