it.unimi.di.mg4j.query.nodes
Class AbstractTermExpander.ExpanderVisitor

java.lang.Object
  extended by it.unimi.di.mg4j.query.nodes.AbstractQueryBuilderVisitor<Query>
      extended by it.unimi.di.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
protected AbstractTermExpander.ExpanderVisitor()
           
 
Method Summary
 AbstractTermExpander.ExpanderVisitor copy()
           
 Query[] newArray(int len)
          Builds an array of given length of type T.
 QueryBuilderVisitor<Query> prepare()
          No-op.
 Query visit(False node)
          Visits False.
 Query visit(Prefix node)
          Visits a Prefix.
 Query visit(Range node)
          Visits a Range.
 Query visit(Term node)
          Visits a Term.
 Query visit(True node)
          Visits True.
 Query visitPost(Align node, Query[] subNode)
          Visits an Align node after recursing into the corresponding subtree.
 Query visitPost(And node, Query[] subNode)
          Visits an And node after recursing into the corresponding subtree.
 Query visitPost(Consecutive node, Query[] subNode)
          Visits a Consecutive node after recursing into the corresponding subtree.
 Query visitPost(Difference node, Query[] subNode)
          Visits an Difference node after recursing into the corresponding subtree.
 Query visitPost(LowPass node, Query subNode)
          Visits a LowPass node after recursing into the corresponding subtree.
 Query visitPost(MultiTerm node, Query[] subNode)
          Visits a MultiTerm node after recursing into the corresponding subtree.
 Query visitPost(Not node, Query subNode)
          Visits a Not node after recursing into the corresponding subtree.
 Query visitPost(OrderedAnd node, Query[] subNode)
          Visits an OrderedAnd node after recursing into the corresponding subtree.
 Query visitPost(Or node, Query[] subNode)
          Visits an Or node after recursing into the corresponding subtree.
 Query visitPost(Remap node, Query subNode)
          Visits a Remap node after recursing into the corresponding subtree.
 Query visitPost(Select node, Query subNode)
          Visits a Select node after recursing into the corresponding subtree.
 Query visitPost(Weight node, Query subNode)
          Visits a Weight node after recursing into the corresponding subtree.
 
Methods inherited from class it.unimi.di.mg4j.query.nodes.AbstractQueryBuilderVisitor
visitPre, visitPre, visitPre, visitPre, visitPre, visitPre, visitPre, visitPre, visitPre, visitPre, visitPre, visitPre
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTermExpander.ExpanderVisitor

protected AbstractTermExpander.ExpanderVisitor()
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 type 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.

Parameters:
len - the required array length.
Returns:
an array of type T of length len.

prepare

public QueryBuilderVisitor<Query> prepare()
Description copied from class: AbstractQueryBuilderVisitor
No-op.

Specified by:
prepare in interface QueryBuilderVisitor<Query>
Overrides:
prepare in class AbstractQueryBuilderVisitor<Query>
Returns:
this visitor.

visit

public Query visit(Term node)
            throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a Term.

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 a Prefix.

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, or null.
Throws:
QueryBuilderVisitorException

visit

public Query visit(Range node)
            throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a Range.

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 an And 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Consecutive node,
                       Query[] subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a Consecutive 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(OrderedAnd node,
                       Query[] subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits an OrderedAnd 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Difference node,
                       Query[] subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits an Difference 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(LowPass node,
                       Query subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a LowPass 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Not node,
                       Query subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a Not 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Or node,
                       Query[] subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits an Or 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Align node,
                       Query[] subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits an Align 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(MultiTerm node,
                       Query[] subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a MultiTerm 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Select node,
                       Query subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a Select 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Remap node,
                       Query subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a Remap 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, or null.
Throws:
QueryBuilderVisitorException

visitPost

public Query visitPost(Weight node,
                       Query subNode)
                throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits a Weight 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, or null.
Throws:
QueryBuilderVisitorException

visit

public Query visit(True node)
            throws QueryBuilderVisitorException
Description copied from interface: QueryBuilderVisitor
Visits True.

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
Visits False.

Parameters:
node - the leaf to be visited.
Returns:
true if the visit should continue.
Throws:
QueryBuilderVisitorException