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

    public abstract class QueryTreeContext<T>

The base class for specific query tree context used by the walker.
This class is used to maintain additional information gathered while
walking the tree. On this level it is used to collect return type
information.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> QueryTreeContext\<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` |   |

## Constructors

### QueryTreeContext()

    protected QueryTreeContext()

## Methods

### addChild()

    public T addChild()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | a child context for this context |

### addReturnType(QueryTreeContext.Type type)

    public void addReturnType(QueryTreeContext.Type type)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.Type` additional type to be added to current return types |

### children()

    public Iterable<T> children()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<T>` | iterable over all children contexts |

### getChild(int index)

    public T getChild(int index)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` the index of the child to get |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | the child context at the given index |

### getChildCount()

    public int getChildCount()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | the number of children contexts |

### getCommonReturnTypes(T other)

    public Set<QueryTreeContext.Type> getCommonReturnTypes(T other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `T` the other context whose types are to be inspected |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Set.html<https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.Type>` | a set of types common to this and the other context |

### getReturnTypes()

    public Set<QueryTreeContext.Type> getReturnTypes()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Set.html<https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.Type>` | the set of return types |

### getText()

    public String getText()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | sets the text associated with this context |

### inDisjunction()

    public boolean inDisjunction()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | true if this context's lowest ancester compounding operator (AND, OR) is a disjunction. |

### isCompatibleWith(QueryTreeContext.Type returnType)

    public boolean isCompatibleWith(QueryTreeContext.Type returnType)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `returnType` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.Type` the type to be checked against types of this context |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | whether or not it is compatible with at least one type |

### isField()

    public boolean isField()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | returns if this context represents a field of a document |

### isFunction()

    public boolean isFunction()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | if this context represents a function |

### isFuzzy()

    public boolean isFuzzy()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | whether or not the value associated with this context is rewritable |

### isLiteral()

    public boolean isLiteral()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | if this context represents a literal constant |

### isPhrase()

    public boolean isPhrase()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | whether or not this context represents a phrase (quoted text) |

### isStrict()

    public boolean isStrict()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | whether or not the value associated with this context must not be rewritten |

### newChildContext()

    protected abstract T newChildContext()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | a new child of type T |

### setInDisjunction(boolean inDisjunction)

    public void setInDisjunction(boolean inDisjunction)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `inDisjunction` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

### setKind(QueryTreeContext.Kind kind)

    public void setKind(QueryTreeContext.Kind kind)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `kind` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.Kind` the kind of the |

### setReturnType(QueryTreeContext.Type type)

    public void setReturnType(QueryTreeContext.Type type)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.Type` the unique return type for this context |

### setReturnTypes(Set\<QueryTreeContext.Type\> type)

    public void setReturnTypes(Set<QueryTreeContext.Type> type)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `type` | `https://docs.oracle.com/javase/8/docs/api/java/util/Set.html<https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.Type>` a set of types to be set as the only return types |

### setRewriteMode(QueryTreeContext.RewriteMode mode)

    public void setRewriteMode(QueryTreeContext.RewriteMode mode)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `mode` | `https://docs.cloud.google.com/appengine/docs/standard/java-gen2/reference/services/bundled/latest/com.google.appengine.api.search.query.QueryTreeContext.RewriteMode` the rewrite mode for the value represented by this context |

### setText(String text)

    public void setText(String text)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `text` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` returns the text associated with this context |

### toString()

    public String toString()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

**Overrides** [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--)