Package it.unimi.di.big.mg4j.query.nodes
Class CheckForSelectQueryVisitor
- java.lang.Object
-
- it.unimi.di.big.mg4j.query.nodes.CheckForSelectQueryVisitor
-
- All Implemented Interfaces:
QueryBuilderVisitor<Set<String>>,FlyweightPrototype<QueryBuilderVisitor<Set<String>>>
public class CheckForSelectQueryVisitor extends Object implements QueryBuilderVisitor<Set<String>>
AQueryBuilderVisitorthat returnsBoolean.FALSEonly if the visited query contains aSelectnode that does not lie in the aligner of anAlignquery (as in that case the index is not part of the answer).- Author:
- Sebastiano Vigna
-
-
Field Summary
Fields Modifier and Type Field Description StringerrorMessage
-
Constructor Summary
Constructors Constructor Description CheckForSelectQueryVisitor(String defaultIndex)
-
Method Summary
Modifier and Type Method Description QueryBuilderVisitor<Set<String>>copy()Set<String>[]newArray(int len)Builds an array of given length of typeT.QueryBuilderVisitor<Set<String>>prepare()Prepares the internal state of this visitor for a(nother) visit.Set<String>visit(False node)VisitsFalse.Set<String>visit(Prefix node)Visits aPrefix.Set<String>visit(Range node)Visits aRange.Set<String>visit(Term node)Visits aTerm.Set<String>visit(True node)VisitsTrue.Set<String>visitPost(Align node, Set<String>[] v)Visits anAlignnode after recursing into the corresponding subtree.Set<String>visitPost(And node, Set<String>[] v)Visits anAndnode after recursing into the corresponding subtree.Set<String>visitPost(Annotation node, Set<String> v)Visits aAnnotationnode after recursing into the corresponding subtree.Set<String>visitPost(Consecutive node, Set<String>[] v)Visits aConsecutivenode after recursing into the corresponding subtree.Set<String>visitPost(Containment node, Set<String>[] v)Visits anContainmentnode after recursing into the corresponding subtree.Set<String>visitPost(Difference node, Set<String>[] v)Visits aDifferencenode after recursing into the corresponding subtree.Set<String>visitPost(Inclusion node, Set<String>[] v)Visits anInclusionnode after recursing into the corresponding subtree.Set<String>visitPost(LowPass node, Set<String> v)Visits aLowPassnode after recursing into the corresponding subtree.Set<String>visitPost(MultiTerm node, Set<String>[] v)Visits aMultiTermnode after recursing into the corresponding subtree.Set<String>visitPost(Not node, Set<String> v)Visits aNotnode after recursing into the corresponding subtree.Set<String>visitPost(OrderedAnd node, Set<String>[] v)Visits anOrderedAndnode after recursing into the corresponding subtree.Set<String>visitPost(Or node, Set<String>[] v)Visits anOrnode after recursing into the corresponding subtree.Set<String>visitPost(Remap node, Set<String> v)Visits aRemapnode after recursing into the corresponding subtree.Set<String>visitPost(Select node, Set<String> v)Visits aSelectnode after recursing into the corresponding subtree.Set<String>visitPost(Weight node, Set<String> v)Visits aWeightnode after recursing into the corresponding subtree.booleanvisitPre(Align node)Visits anAlignnode before recursing into the corresponding subtree.booleanvisitPre(And node)Visits anAndnode before recursing into the corresponding subtree.booleanvisitPre(Annotation node)Visits aAnnotationnode before recursing into the corresponding subtree.booleanvisitPre(Consecutive node)Visits aConsecutivenode before recursing into the corresponding subtree.booleanvisitPre(Containment node)Visits anContainmentnode before recursing into the corresponding subtree.booleanvisitPre(Difference node)Visits aDifferencenode before recursing into the corresponding subtree.booleanvisitPre(Inclusion node)Visits anInclusionnode before recursing into the corresponding subtree.booleanvisitPre(LowPass node)Visits aLowPassnode before recursing into the corresponding subtree.booleanvisitPre(MultiTerm node)Visits aMultiTermnode before recursing into the corresponding subtree.booleanvisitPre(Not node)Visits aNotnode before recursing into the corresponding subtree.booleanvisitPre(Or node)Visits anOrnode before recursing into the corresponding subtree.booleanvisitPre(OrderedAnd node)Visits anOrderedAndnode before recursing into the corresponding subtree.booleanvisitPre(Remap node)Visits aRemapnode before recursing into the corresponding subtree.booleanvisitPre(Select node)Visits aSelectnode before recursing into the corresponding subtree.booleanvisitPre(Weight node)Visits aWeightnode before recursing into the corresponding subtree.
-
-
-
Field Detail
-
errorMessage
public String errorMessage
-
-
Constructor Detail
-
CheckForSelectQueryVisitor
public CheckForSelectQueryVisitor(String defaultIndex)
-
-
Method Detail
-
prepare
public QueryBuilderVisitor<Set<String>> prepare()
Description copied from interface:QueryBuilderVisitorPrepares the internal state of this visitor for a(nother) visit.By specification, it must be safe to call this method any number of times.
- Specified by:
preparein interfaceQueryBuilderVisitor<Set<String>>- Returns:
- this visitor.
-
newArray
public Set<String>[] newArray(int len)
Description copied from interface:QueryBuilderVisitorBuilds 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.- Specified by:
newArrayin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
len- the required array length.- Returns:
- an array of type
Tof lengthlen.
-
copy
public QueryBuilderVisitor<Set<String>> copy()
- Specified by:
copyin interfaceFlyweightPrototype<QueryBuilderVisitor<Set<String>>>- Specified by:
copyin interfaceQueryBuilderVisitor<Set<String>>
-
visitPre
public boolean visitPre(And node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anAndnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Consecutive node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aConsecutivenode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(LowPass node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aLowPassnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Annotation node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aAnnotationnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Not node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aNotnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Or node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anOrnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(OrderedAnd node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anOrderedAndnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Align node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anAlignnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(MultiTerm node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aMultiTermnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Select node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aSelectnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Remap node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aRemapnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Weight node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aWeightnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Difference node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aDifferencenode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Inclusion node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anInclusionnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPre
public boolean visitPre(Containment node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anContainmentnode before recursing into the corresponding subtree.- Specified by:
visitPrein interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the node to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visitPost
public Set<String> visitPost(And node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anAndnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Consecutive node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aConsecutivenode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(LowPass node, Set<String> v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aLowPassnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Annotation node, Set<String> v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aAnnotationnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Not node, Set<String> v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aNotnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Or node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anOrnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- 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 Set<String> visitPost(OrderedAnd node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anOrderedAndnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Align node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anAlignnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(MultiTerm node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aMultiTermnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Select node, Set<String> v)
Description copied from interface:QueryBuilderVisitorVisits aSelectnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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.
-
visitPost
public Set<String> visitPost(Remap node, Set<String> v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aRemapnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Weight node, Set<String> v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aWeightnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Difference node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aDifferencenode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Inclusion node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anInclusionnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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 Set<String> visitPost(Containment node, Set<String>[] v) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits anContainmentnode after recursing into the corresponding subtree.- Specified by:
visitPostin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the internal node to be visited.v- 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
-
visit
public Set<String> visit(Term node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aTerm.- Specified by:
visitin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visit
public Set<String> visit(Prefix node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aPrefix.- Specified by:
visitin interfaceQueryBuilderVisitor<Set<String>>- 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 Set<String> visit(Range node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisits aRange.- Specified by:
visitin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visit
public Set<String> visit(True node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisitsTrue.- Specified by:
visitin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
visit
public Set<String> visit(False node) throws QueryBuilderVisitorException
Description copied from interface:QueryBuilderVisitorVisitsFalse.- Specified by:
visitin interfaceQueryBuilderVisitor<Set<String>>- Parameters:
node- the leaf to be visited.- Returns:
- true if the visit should continue.
- Throws:
QueryBuilderVisitorException
-
-