Class QueryTreeContext<T> (2.0.0)

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 > QueryTreeContext<T>

Type Parameter

NameDescription
T

Constructors

QueryTreeContext()

protected QueryTreeContext()

Methods

addChild()

public T addChild()
Returns
TypeDescription
T

a child context for this context

addReturnType(QueryTreeContext.Type type)

public void addReturnType(QueryTreeContext.Type type)
Parameter
NameDescription
typeQueryTreeContext.Type

additional type to be added to current return types

children()

public Iterable<T> children()
Returns
TypeDescription
Iterable<T>

iterable over all children contexts

getChild(int index)

public T getChild(int index)
Parameter
NameDescription
indexint

the index of the child to get

Returns
TypeDescription
T

the child context at the given index

getChildCount()

public int getChildCount()
Returns
TypeDescription
int

the number of children contexts

getCommonReturnTypes(T other)

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

the other context whose types are to be inspected

Returns
TypeDescription
Set<Type>

a set of types common to this and the other context

getReturnTypes()

public Set<QueryTreeContext.Type> getReturnTypes()
Returns
TypeDescription
Set<Type>

the set of return types

getText()

public String getText()
Returns
TypeDescription
String

sets the text associated with this context

inDisjunction()

public boolean inDisjunction()
Returns
TypeDescription
boolean

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
NameDescription
returnTypeQueryTreeContext.Type

the type to be checked against types of this context

Returns
TypeDescription
boolean

whether or not it is compatible with at least one type

isField()

public boolean isField()
Returns
TypeDescription
boolean

returns if this context represents a field of a document

isFunction()

public boolean isFunction()
Returns
TypeDescription
boolean

if this context represents a function

isFuzzy()

public boolean isFuzzy()
Returns
TypeDescription
boolean

whether or not the value associated with this context is rewritable

isLiteral()

public boolean isLiteral()
Returns
TypeDescription
boolean

if this context represents a literal constant

isPhrase()

public boolean isPhrase()
Returns
TypeDescription
boolean

whether or not this context represents a phrase (quoted text)

isStrict()

public boolean isStrict()
Returns
TypeDescription
boolean

whether or not the value associated with this context must not be rewritten

newChildContext()

protected abstract T newChildContext()
Returns
TypeDescription
T

a new child of type T

setInDisjunction(boolean inDisjunction)

public void setInDisjunction(boolean inDisjunction)
Parameter
NameDescription
inDisjunctionboolean

setKind(QueryTreeContext.Kind kind)

public void setKind(QueryTreeContext.Kind kind)
Parameter
NameDescription
kindQueryTreeContext.Kind

the kind of the

setReturnType(QueryTreeContext.Type type)

public void setReturnType(QueryTreeContext.Type type)
Parameter
NameDescription
typeQueryTreeContext.Type

the unique return type for this context

setReturnTypes(Set<QueryTreeContext.Type> type)

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

a set of types to be set as the only return types

setRewriteMode(QueryTreeContext.RewriteMode mode)

public void setRewriteMode(QueryTreeContext.RewriteMode mode)
Parameter
NameDescription
modeQueryTreeContext.RewriteMode

the rewrite mode for the value represented by this context

setText(String text)

public void setText(String text)
Parameter
NameDescription
textString

returns the text associated with this context

toString()

public String toString()
Returns
TypeDescription
String
Overrides