Class QueryTreeWalker<T extends QueryTreeContext<T>>

  • Type Parameters:
    T - the context used by the visitor

    public class QueryTreeWalker<T extends QueryTreeContext<T>>
    extends Object
    The walking of the query tree. This class takes care of visiting a tree resulting from parsing a query. As it traverses the tree it calls appropriate methods of the visitor, set at the construction time. The class uses a depth-first search, visiting all children of a node, before visiting the node. The visit is done by calling an appropriate method of the visitor. Typical code should match the following pattern:
    {@code
     class MyVisitor implements QueryTreeVisitor {
       ...
     }
     class MyContext extends QueryTreeContext {
       ...
    • Constructor Detail

      • QueryTreeWalker

        public QueryTreeWalker​(QueryTreeVisitor<T> visitor)
        Creates a new query walker that calls the given visitor.
        Parameters:
        visitor - the visitor to be called by this walker
    • Method Detail

      • walk

        public void walk​(org.antlr.runtime.tree.Tree tree,
                         T context)
                  throws QueryTreeException
        Parameters:
        tree - the tree to be walked
        context - the context in which the tree is walked
        Throws:
        QueryTreeException
      • simplify

        public static org.antlr.runtime.tree.Tree simplify​(org.antlr.runtime.tree.Tree tree)