Send feedback
  
   
 
  
    
      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.
    
      
        Type Parameter  
      
        Name Description  
      
        T 
     
  
  Constructors
   
  QueryTreeContext() 
  
    
protected   QueryTreeContext ()  
  Methods
   
  addChild() 
  
  
    
      
        Returns  
      
        Type Description  
      
        T a child context for this context
 
     
  
  addReturnType(QueryTreeContext.Type type) 
  
    
public   void   addReturnType ( QueryTreeContext . Type   type )  
  
  children() 
  
    
public   Iterable<T>   children ()  
  
    
      
        Returns  
      
        Type Description  
      
        Iterable <T >iterable over all children contexts
 
     
  
  getChild(int index) 
  
    
public   T   getChild ( int   index )  
  
    
      
        Parameter  
      
        Name Description  
      
        indexint the index of the child to get
 
     
  
  
    
      
        Returns  
      
        Type Description  
      
        T the child context at the given index
 
     
  
  getChildCount() 
  
    
public   int   getChildCount ()  
  
    
      
        Returns  
      
        Type Description  
      
        int the number of children contexts
 
     
  
  getCommonReturnTypes(T other) 
  
    
public   Set<QueryTreeContext . Type >  getCommonReturnTypes ( T   other )  
  
    
      
        Parameter  
      
        Name Description  
      
        otherT the other context whose types are to be inspected
 
     
  
  
    
      
        Returns  
      
        Type Description  
      
        Set <Type >a set of types common to this and the other context
 
     
  
  getReturnTypes() 
  
    
public   Set<QueryTreeContext . Type >  getReturnTypes ()  
  
    
      
        Returns  
      
        Type Description  
      
        Set <Type >the set of return types
 
     
  
  getText() 
  
  
    
      
        Returns  
      
        Type Description  
      
        String sets the text associated with this context
 
     
  
  inDisjunction() 
  
    
public   boolean   inDisjunction ()  
  
    
      
        Returns  
      
        Type Description  
      
        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  
      
        Name Description  
      
        returnTypeQueryTreeContext.Type the type to be checked against types of this context
 
     
  
  
    
      
        Returns  
      
        Type Description  
      
        boolean whether or not it is compatible with at least one type
 
     
  
  isField() 
  
  
    
      
        Returns  
      
        Type Description  
      
        boolean returns if this context represents a field of a document
 
     
  
  isFunction() 
  
    
public   boolean   isFunction ()  
  
    
      
        Returns  
      
        Type Description  
      
        boolean if this context represents a function
 
     
  
  isFuzzy() 
  
  
    
      
        Returns  
      
        Type Description  
      
        boolean whether or not the value associated with this context is rewritable
 
     
  
  isLiteral() 
  
    
public   boolean   isLiteral ()  
  
    
      
        Returns  
      
        Type Description  
      
        boolean if this context represents a literal constant
 
     
  
  isPhrase() 
  
    
public   boolean   isPhrase ()  
  
    
      
        Returns  
      
        Type Description  
      
        boolean whether or not this context represents a phrase (quoted text)
 
     
  
  isStrict() 
  
    
public   boolean   isStrict ()  
  
    
      
        Returns  
      
        Type Description  
      
        boolean whether or not the value associated with this context must
 not be rewritten
 
     
  
  newChildContext() 
  
    
protected   abstract   T   newChildContext ()  
  
    
      
        Returns  
      
        Type Description  
      
        T a new child of type T
 
     
  
  setInDisjunction(boolean inDisjunction) 
  
    
public   void   setInDisjunction ( boolean   inDisjunction )  
  
    
      
        Parameter  
      
        Name Description  
      
        inDisjunctionboolean  
     
  
  setKind(QueryTreeContext.Kind kind) 
  
    
public   void   setKind ( QueryTreeContext . Kind   kind )  
  
  setReturnType(QueryTreeContext.Type type) 
  
    
public   void   setReturnType ( QueryTreeContext . Type   type )  
  
  setReturnTypes(Set<QueryTreeContext.Type> type) 
  
    
public   void   setReturnTypes ( Set<QueryTreeContext . Type >  type )  
  
    
      
        Parameter  
      
        Name Description  
      
        typeSet <Type >a set of types to be set as the only return types
 
     
  
  setRewriteMode(QueryTreeContext.RewriteMode mode) 
  
    
public   void   setRewriteMode ( QueryTreeContext . RewriteMode   mode )  
  
  setText(String text) 
  
    
public   void   setText ( String   text )  
  
    
      
        Parameter  
      
        Name Description  
      
        textString returns the text associated with this context
 
     
  
  toString() 
  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  Overrides 
  
 
     
    
  
  
  
     
  
    
    
      
       
         
  
  
    
    Send feedback
  
   
 
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-16 UTC.
 
 
  
  
    
    
    
      
  
  
    Need to tell us more?
  
   
 
     
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-16 UTC."],[],[]]