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.
  • Method Details

    • addChild

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

      public 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(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
    • toString

      public String toString()
      Overrides:
      toString in class Object