Class AbstractJjtreeNode<N extends Node>

  • All Implemented Interfaces:
    Node

    @Experimental
    public abstract class AbstractJjtreeNode<N extends Node>
    extends AbstractNode
    Base class for node produced by JJTree. JJTree specific functionality present on the API of Node and AbstractNode will be moved here for 7.0.0.

    This is experimental because it's expected to change for 7.0.0 in unforeseeable ways. Don't use it directly, use the node interfaces.

    • Constructor Detail

      • AbstractJjtreeNode

        public AbstractJjtreeNode​(int id)
      • AbstractJjtreeNode

        public AbstractJjtreeNode​(int id,
                                  int theBeginLine,
                                  int theEndLine,
                                  int theBeginColumn,
                                  int theEndColumn)
    • Method Detail

      • getChild

        public N getChild​(int index)
        Description copied from interface: Node
        Returns the child of this node at the given index.
        Specified by:
        getChild in interface Node
        Overrides:
        getChild in class AbstractNode
      • getParent

        public N getParent()
        Description copied from interface: Node
        Returns the parent of this node, or null if this is the root of the tree.

        This method should be preferred to Node.jjtGetParent().

        Specified by:
        getParent in interface Node
        Overrides:
        getParent in class AbstractNode
        Returns:
        The parent of this node
      • children

        public Iterable<? extends N> children()
        Description copied from interface: Node
        Returns an iterable enumerating the children of this node. Use it with a foreach loop:
        
              for (Node child : node.children()) {
                  // process child
              }
         

        This method's return type will be changed to NodeStream in PMD 7, which is a more powerful kind of iterable. The change will be source compatible.

        Specified by:
        children in interface Node
        Overrides:
        children in class AbstractNode
        Returns:
        A new iterable for the children of this node