Class AbstractQueryNode<Q extends AbstractQueryNode<Q,​T,​V>,​T extends AbstractQueryNode.AbstractQueryNodeType,​V extends AbstractQueryNode.AbstractQueryVisitor>

    • Constructor Detail

      • AbstractQueryNode

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

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

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

      • getNodeType

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

        public boolean hasNodeType​(T 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 Q getParent()
        Get the parent node of this node.
        Returns:
        the parent node or null if this is the root node
      • setParent

        protected final void setParent​(Q parent)
      • getChildren

        public List<Q> 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 Q 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 Q getFirstChild()
        Get this first child node.
        Returns:
        the first child node of this node or null if none
      • getLastChild

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

        public <X extends Q> X getChild​(Class<X> clazz,
                                        int idx)
        Get a child node of specified type by index. Only child nodes of the requested type are counted.
        Type Parameters:
        X - 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 <X extends Q> X getFirstChild​(Class<X> clazz)
        Get a first child node of specified type.
        Type Parameters:
        X - 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
      • getLocation

        public AbstractQueryNode.SourceLocation getLocation()
        Get source location information about start/stop offsets for this query node in the query text content.
        Returns:
        the location information with the span convering the query node in the query
      • setLocation

        public final void setLocation​(AbstractQueryNode.SourceLocation location)
        Set source location information.
        Parameters:
        location - the location information with the span convering the query node in the query
      • accept

        public abstract void accept​(V visitor)