Class QueryTreeContext<T extends QueryTreeContext<T>>
- java.lang.Object
-
- 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 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
Nested Classes Modifier and Type Class Description static classQueryTreeContext.KindEnumeration of the kind of the term that has a given return type.static classQueryTreeContext.RewriteModeEnumeration of text terms rewrite mode.static classQueryTreeContext.TypeEnumeration of supported return types.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaddChild()voidaddReturnType(QueryTreeContext.Type type)Iterable<T>children()TgetChild(int index)intgetChildCount()Set<QueryTreeContext.Type>getCommonReturnTypes(T other)Set<QueryTreeContext.Type>getReturnTypes()StringgetText()booleaninDisjunction()booleanisCompatibleWith(QueryTreeContext.Type returnType)booleanisField()booleanisFunction()booleanisFuzzy()booleanisLiteral()booleanisPhrase()booleanisStrict()voidsetInDisjunction(boolean inDisjunction)voidsetKind(QueryTreeContext.Kind kind)voidsetReturnType(QueryTreeContext.Type type)voidsetReturnTypes(Set<QueryTreeContext.Type> type)voidsetRewriteMode(QueryTreeContext.RewriteMode mode)voidsetText(String text)StringtoString()
-
-
-
Method Detail
-
addChild
public T addChild()
- Returns:
- a child context for this context
-
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(Set<QueryTreeContext.Type> type)
- Parameters:
type- a set of types to be set as the only return types
-
setInDisjunction
public void setInDisjunction(boolean inDisjunction)
-
getReturnTypes
public Set<QueryTreeContext.Type> getReturnTypes()
- Returns:
- the set of return types
-
getCommonReturnTypes
public 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
-
isLiteral
public boolean isLiteral()
- Returns:
- if this context represents a literal constant
-
isField
public boolean isField()
- Returns:
- returns if this context represents a field of a document
-
inDisjunction
public boolean inDisjunction()
- Returns:
- true if this context's lowest ancester compounding operator (AND, OR) is a disjunction.
-
getText
public String getText()
- Returns:
- sets the text associated with this context
-
setText
public void setText(String text)
- Parameters:
text- returns the text associated with this context
-
-