# Class QueryTreeWalker&lt;T&gt; (5.0.3)

    public class QueryTreeWalker<T>

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> {
       ...
       @Override
       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
     
## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> QueryTreeWalker\<T\>

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `T` |   |

## Static Methods

### simplify(Tree tree)

    public static Tree simplify(Tree tree)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `tree` | `org.antlr.runtime.tree.Tree` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `org.antlr.runtime.tree.Tree` |   |

## Constructors

### QueryTreeWalker(QueryTreeVisitor\<T\> visitor)

    public QueryTreeWalker(QueryTreeVisitor<T> visitor)

Creates a new query walker that calls the given `visitor`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `visitor` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeVisitor<T>` the visitor to be called by this walker |

## Methods

### postBooleanExpression(T context)

    protected void postBooleanExpression(T context)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `context` | `T` |

### walk(Tree tree, T context)

    public void walk(Tree tree, T context)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `tree` | `org.antlr.runtime.tree.Tree` the tree to be walked |
| `context` | `T` the context in which the tree is walked |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeException` |   |