Class TreeVisit.TreePathFragment<Node>

  • Type Parameters:
    Node - Type of the tree nodes.
    Enclosing class:
    TreeVisit

    public static final class TreeVisit.TreePathFragment<Node>
    extends Object
    Represents a fragment or part of the path of a node in a tree data structure.

    Assume the following tree:

    • a1
      • b
        • c1
        • c2
    • a2
    Then the path of c2 consist of the following 2 fragments:
         (a1, 0), (b, 0), (c2, 1)
     
    That is, to access c1, start at the root, access the first child (which is a1), then access the first child (which is b), then access the second child (which is c2).
    • Method Detail

      • getIndex

        public int getIndex()
        Gets the index of the node, i.e. the index of getNode() in the children list of its parent.
        Returns:
        The node's index.
      • getNode

        public Node getNode()
        Gets the node representing this path fragment.
        Returns:
        The tree node.