com.google.appengine.api.search.query
Class QueryTreeWalker<T>

java.lang.Object
  extended by com.google.appengine.api.search.query.QueryTreeWalker<T>

public class QueryTreeWalker<T>
extends java.lang.Object

A walker of the ANTLR Tree. The walker calls the supplied visitor with the context. The visitor's job is to execute an action specific to the given AST node type and the current context. Then the visitor needs to ask the walker to walk selected children the visitor is interested in traversing. The type of the context passed to the visitor.


Constructor Summary
QueryTreeWalker(QueryTreeVisitor<T> visitor)
           
 
Method Summary
static Tree simplify(Tree tree)
          Optimizes the tree representing a parsed user query by replacing disjunctions and conjunctions with a single term with just that term (e.g., (CONJUNCTION (MATCH foo)) becomes (MATCH foo)).
 void walk(Tree node, T context)
          Walks the given node of the tree with the given visitor and the given 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)
Method Detail

simplify

public static Tree simplify(Tree tree)
Optimizes the tree representing a parsed user query by replacing disjunctions and conjunctions with a single term with just that term (e.g., (CONJUNCTION (MATCH foo)) becomes (MATCH foo)).

Parameters:
tree - the tree to be simplified
Returns:
a simplified tree

walk

public void walk(Tree node,
                 T context)
Walks the given node of the tree with the given visitor and the given context.

Parameters:
node - the node to be walked
context - the current context for the node