QueryTreeWalker (Google App Engine API for Java)


Class QueryTreeWalker<T extends QueryTreeContext<T>>

  • java.lang.Object
    • com.google.appengine.api.search.query.QueryTreeWalker<T>
  • Type Parameters:
    T - the context used by the visitor

    public class QueryTreeWalker<T extends QueryTreeContext<T>>
    extends java.lang.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:
     class MyVisitor implements QueryTreeVisitor {
     class MyContext extends QueryTreeContext<MyContext> {
       protected MyContext newChildContext() {
         return new MyContext();
     MyContext context = new MyContext();
     QueryTreeWalker<MyContext> walker = new QueryTreeWalker<MyContext>(new MyVisitor());
     Tree root = parser.query(queryStr);
     walker.walk(root, context);
     // retrieve whatever information you need from context
    • Constructor Summary

      Constructor and Description
      QueryTreeWalker(QueryTreeVisitor<T> visitor)
      Creates a new query walker that calls the given visitor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      static Tree simplify(Tree tree) 
      void walk(Tree tree, T context) 
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QueryTreeWalker

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

      • walk

        public void walk(Tree tree,
                         T context)
                  throws QueryTreeException
        tree - the tree to be walked
        context - the context in which the tree is walked
      • simplify

        public static Tree simplify(Tree tree)

Send feedback about...

App Engine standard environment for Java