Package it.unimi.di.big.mg4j.query.nodes
Class AbstractTermExpander.ExpanderVisitor
- java.lang.Object
-
- it.unimi.di.big.mg4j.query.nodes.AbstractQueryBuilderVisitor<Query>
-
- it.unimi.di.big.mg4j.query.nodes.AbstractTermExpander.ExpanderVisitor
-
- All Implemented Interfaces:
QueryBuilderVisitor<Query>
,FlyweightPrototype<QueryBuilderVisitor<Query>>
- Direct Known Subclasses:
MultiIndexTermExpander.ExpanderVisitor
- Enclosing class:
- AbstractTermExpander
protected class AbstractTermExpander.ExpanderVisitor extends AbstractQueryBuilderVisitor<Query>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExpanderVisitor()
-
Method Summary
Modifier and Type Method Description AbstractTermExpander.ExpanderVisitor
copy()
Query[]
newArray(int len)
Builds an array of given length of typeT
.QueryBuilderVisitor<Query>
prepare()
No-op.Query
visit(False node)
VisitsFalse
.Query
visit(Prefix node)
Visits aPrefix
.Query
visit(Range node)
Visits aRange
.Query
visit(Term node)
Visits aTerm
.Query
visit(True node)
VisitsTrue
.Query
visitPost(Align node, Query[] subNode)
Visits anAlign
node after recursing into the corresponding subtree.Query
visitPost(And node, Query[] subNode)
Visits anAnd
node after recursing into the corresponding subtree.Query
visitPost(Annotation node, Query subNode)
Visits aAnnotation
node after recursing into the corresponding subtree.Query
visitPost(Consecutive node, Query[] subNode)
Visits aConsecutive
node after recursing into the corresponding subtree.Query
visitPost(Containment node, Query[] subNode)
Visits anContainment
node after recursing into the corresponding subtree.Query
visitPost(Difference node, Query[] subNode)
Visits aDifference
node after recursing into the corresponding subtree.Query
visitPost(Inclusion node, Query[] subNode)
Visits anInclusion
node after recursing into the corresponding subtree.Query
visitPost(LowPass node, Query subNode)
Visits aLowPass
node after recursing into the corresponding subtree.Query
visitPost(MultiTerm node, Query[] subNode)
Visits aMultiTerm
node after recursing into the corresponding subtree.Query
visitPost(Not node, Query subNode)
Visits aNot
node after recursing into the corresponding subtree.Query
visitPost(OrderedAnd node, Query[] subNode)
Visits anOrderedAnd
node after recursing into the corresponding subtree.Query
visitPost(Or node, Query[] subNode)
Visits anOr
node after recursing into the corresponding subtree.Query
visitPost(Remap node, Query subNode)
Visits aRemap
node after recursing into the corresponding subtree.Query
visitPost(Select node, Query subNode)
Visits aSelect
node after recursing into the corresponding subtree.Query
visitPost(Weight node, Query subNode)
Visits aWeight
node after recursing into the corresponding subtree.
-
-
-
Method Detail
-
copy
public AbstractTermExpander.ExpanderVisitor copy()
-
newArray
public Query[] newArray(int len)
Description copied from interface:QueryBuilderVisitor
Builds an array of given length of typeT
.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 typeT
. This method must provide an array of given length that is an acceptable input for allvisitPost()
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 inArray
.- Parameters:
len
- the required array length.- Returns:
- an array of type
T
of lengthlen
.
-
prepare
public QueryBuilderVisitor<Query> prepare()
Description copied from class:AbstractQueryBuilderVisitor
No-op.- Specified by:
prepare
in interfaceQueryBuilderVisitor<Query>
- Overrides:
prepare
in classAbstractQueryBuilderVisitor<Query>
- Returns:
- this visitor.
-
visit
public Query visit(Term node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aTerm
.- Parameters:
node
- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visit
public Query visit(Prefix node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aPrefix
.- Parameters:
node
- the leaf to be visited.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visit
public Query visit(Range node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aRange
.- Parameters:
node
- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(And node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits anAnd
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the array of results returned by subnodes.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Consecutive node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aConsecutive
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the array of results returned by subnodes.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(OrderedAnd node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits anOrderedAnd
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the array of results returned by subnodes.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Difference node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aDifference
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the array of results returned by subnodes.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Inclusion node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits anInclusion
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the array of results returned by subnodes.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Containment node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits anContainment
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the array of results returned by subnodes.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(LowPass node, Query subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aLowPass
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the of result returned by the sole subnode.- Returns:
- an appropriate return value (usually, the object built using
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Annotation node, Query subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aAnnotation
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the of result returned by the sole subnode.- Returns:
- an appropriate return value (usually, the object built using
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Not node, Query subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aNot
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the of result returned by the sole subnode.- Returns:
- an appropriate return value (usually, the object built using
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Or node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits anOr
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Align node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits anAlign
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the array of results returned by subnodes.- Returns:
- an appropriate return value (usually, the object built using the elements in
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(MultiTerm node, Query[] subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aMultiTerm
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the of result returned by the sole subnode.- Returns:
- an appropriate return value (usually, the object built using
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Select node, Query subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aSelect
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the of result returned by the sole subnode.- Returns:
- an appropriate return value (usually, the object built using
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Remap node, Query subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aRemap
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the of result returned by the sole subnode.- Returns:
- an appropriate return value (usually, the object built using
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visitPost
public Query visitPost(Weight node, Query subNode) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
Visits aWeight
node after recursing into the corresponding subtree.- Parameters:
node
- the internal node to be visited.subNode
- the of result returned by the sole subnode.- Returns:
- an appropriate return value (usually, the object built using
subNodeResult
) if the visit should continue, ornull
. - Throws:
QueryBuilderVisitorException
-
visit
public Query visit(True node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
VisitsTrue
.- Parameters:
node
- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visit
public Query visit(False node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitor
VisitsFalse
.- Parameters:
node
- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
-