it.unimi.di.mg4j.query.nodes
Interface Query

All Superinterfaces:
Serializable
All Known Implementing Classes:
Align, And, Composite, Consecutive, Difference, False, LowPass, MultiTerm, Not, Or, OrderedAnd, Prefix, Range, Remap, Select, Term, True, Weight

public interface Query
extends Serializable

A node of a composite representing a query.

A query is abstractly represented by a composite made of implementations of this interface. The syntax can be different from parser to parser, but the result of the parsing process is an instance of this class.

Queries support building visits: invoking accept(QueryBuilderVisitor) on a suitable QueryBuilderVisitor will return an object that has been built by the visitor.

To this purpose, the implementation of accept(QueryBuilderVisitor) on internal nodes must gather in an array (or in an element) the results returned by the recursive calls to accept(QueryBuilderVisitor) on subnodes and pass the array (or the element) to the suitable visitPost() method of QueryBuilderVisitor.

Since allocating a generic array is impossible, every visitor must provide an explicit QueryBuilderVisitor.newArray(int) method which returns an array of the correct type.

Author:
Sebastiano Vigna
See Also:
Query

Method Summary
<T> T
accept(QueryBuilderVisitor<T> visitor)
          Accepts a visitor.
 

Method Detail

accept

<T> T accept(QueryBuilderVisitor<T> visitor)
         throws QueryBuilderVisitorException
Accepts a visitor.

Parameters:
visitor - the visitor.
Returns:
the result of the visit, or null if the visit should stop.
Throws:
QueryBuilderVisitorException
See Also:
Query