Class QueryNode

    • Constructor Detail

      • QueryNode

        protected QueryNode​(QueryNodeType nodeType,
                            List<QueryNode> children)
        Constructor.
        Parameters:
        nodeType - the type of the node
        children - the children of this node or null if none
      • QueryNode

        protected QueryNode​(QueryNodeType nodeType,
                            QueryNode child)
        Constructor.
        Parameters:
        nodeType - the type of the node
        child - the child of this node or null if none
      • QueryNode

        protected QueryNode​(QueryNodeType nodeType)
        Constructor.
        Parameters:
        nodeType - the type of the node
    • Method Detail

      • getNodeType

        public QueryNodeType getNodeType()
        Get the node type of this node.
        Returns:
        the node type
      • hasNodeType

        public boolean hasNodeType​(QueryNodeType nodeType)
        Check, if node if of given type.
        Parameters:
        nodeType - type to check against
        Returns:
        true if node is of given type, false otherwise
      • getParent

        public QueryNode getParent()
        Get the parent node of this node.
        Returns:
        the parent node or null if this is the root node
      • getChildren

        public List<QueryNode> getChildren()
        The children of this node.
        Returns:
        the list of children of this node
      • getChildCount

        public int getChildCount()
        Get the number of children of this node.
        Returns:
        the number of children of this node
      • getChild

        public QueryNode getChild​(int idx)
        Get a child node by index.
        Parameters:
        idx - the index of the child node
        Returns:
        the child node of this node or null if index is out of bounds
      • getFirstChild

        public QueryNode getFirstChild()
        Get this first child node.
        Returns:
        the first child node of this node or null if none
      • getLastChild

        public QueryNode getLastChild()
        Get this last child node.
        Returns:
        the last child node of this node or null if none
      • getChild

        public <T extends QueryNode> T getChild​(Class<T> clazz,
                                                int idx)
        Get a child node of specified type by index. Only child nodes of the requested type are counted.
        Type Parameters:
        T - the class of the nodes to be considered
        Parameters:
        clazz - the type to nodes to be considered
        idx - the index of the child node
        Returns:
        the child node of this node or null if no child was found
      • getFirstChild

        public <T extends QueryNode> T getFirstChild​(Class<T> clazz)
        Get a first child node of specified type.
        Type Parameters:
        T - the class of the nodes to be considered
        Parameters:
        clazz - the type to nodes to be considered
        Returns:
        the child node of this node or null if no child was found
      • accept

        public abstract void accept​(QueryVisitor visitor)
      • setParent

        protected final void setParent​(QueryNode parent)