com.google.appengine.api.search.query
Class QueryTreeContext<T extends QueryTreeContext<T>>

java.lang.Object
  extended by com.google.appengine.api.search.query.QueryTreeContext<T>
Type Parameters:
T - the actual class used by specific tree visitors

public abstract class QueryTreeContext<T extends QueryTreeContext<T>>
extends java.lang.Object

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.


Nested Class Summary
static class QueryTreeContext.Kind
          Enumeration of the kind of the term that has a given return type.
static class QueryTreeContext.RewriteMode
          Enumeration of text terms rewrite mode.
static class QueryTreeContext.Type
          Enumeration of supported return types.
 
Method Summary
 T addChild()
           
 void addReturnType(QueryTreeContext.Type type)
           
 java.lang.Iterable<T> children()
           
 T getChild(int index)
           
 int getChildCount()
           
 java.util.Set<QueryTreeContext.Type> getCommonReturnTypes(T other)
           
 java.lang.String getText()
           
 boolean isCompatibleWith(QueryTreeContext.Type returnType)
           
 boolean isField()
           
 boolean isFunction()
           
 boolean isFuzzy()
           
 boolean isPhrase()
           
 boolean isStrict()
           
 void setKind(QueryTreeContext.Kind kind)
           
 void setReturnType(QueryTreeContext.Type type)
           
 void setReturnTypes(java.util.Set<QueryTreeContext.Type> type)
           
 void setRewriteMode(QueryTreeContext.RewriteMode mode)
           
 void setText(java.lang.String text)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addChild

public T addChild()
Returns:
a child context for this context

children

public java.lang.Iterable<T> children()
Returns:
iterable over all children contexts

getChildCount

public int getChildCount()
Returns:
the number of children contexts

getChild

public T getChild(int index)
Parameters:
index - the index of the child to get
Returns:
the child context at the given index

addReturnType

public void addReturnType(QueryTreeContext.Type type)
Parameters:
type - additional type to be added to current return types

setReturnType

public void setReturnType(QueryTreeContext.Type type)
Parameters:
type - the unique return type for this context

setReturnTypes

public void setReturnTypes(java.util.Set<QueryTreeContext.Type> type)
Parameters:
type - a set of types to be set as the only return types

getCommonReturnTypes

public java.util.Set<QueryTreeContext.Type> getCommonReturnTypes(T other)
Parameters:
other - the other context whose types are to be inspected
Returns:
a set of types common to this and the other context

isCompatibleWith

public boolean isCompatibleWith(QueryTreeContext.Type returnType)
Parameters:
returnType - the type to be checked against types of this context
Returns:
whether or not it is compatible with at least one type

setRewriteMode

public void setRewriteMode(QueryTreeContext.RewriteMode mode)
Parameters:
mode - the rewrite mode for the value represented by this context

isFuzzy

public boolean isFuzzy()
Returns:
whether or not the value associated with this context is rewritable

isStrict

public boolean isStrict()
Returns:
whether or not the value associated with this context must not be rewritten

setKind

public void setKind(QueryTreeContext.Kind kind)
Parameters:
kind - the kind of the

isPhrase

public boolean isPhrase()
Returns:
whether or not this context represents a phrase (quoted text)

isFunction

public boolean isFunction()
Returns:
if this context represents a function

isField

public boolean isField()
Returns:
returns if this context represents a field of a document

getText

public java.lang.String getText()
Returns:
sets the text associated with this context

setText

public void setText(java.lang.String text)
Parameters:
text - returns the text associated with this context

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object