com.google.appengine.api.search.query
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 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
Nested Classes Modifier and Type Class and Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description 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.util.Set<QueryTreeContext.Type>
getReturnTypes()
java.lang.String
getText()
boolean
inDisjunction()
boolean
isCompatibleWith(QueryTreeContext.Type returnType)
boolean
isField()
boolean
isFunction()
boolean
isFuzzy()
boolean
isLiteral()
boolean
isPhrase()
boolean
isStrict()
void
setInDisjunction(boolean inDisjunction)
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()
-
-
-
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
-
setInDisjunction
public void setInDisjunction(boolean inDisjunction)
-
getReturnTypes
public java.util.Set<QueryTreeContext.Type> getReturnTypes()
- Returns:
- the set of 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
-
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 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 classjava.lang.Object
-
-