Interface TreeVisit.ITreeVisitor<Node>

  • Type Parameters:
    Node - Type of the tree nodes.
    All Known Implementing Classes:
    TreeVisit.ITreeVisitor.Pathless
    Enclosing class:
    TreeVisit

    public static interface TreeVisit.ITreeVisitor<Node>
    Visitor for a tree data structure.
    • Method Detail

      • enter

        default TreeVisit.ETreeVisitResult enter​(Node node,
                                                 List<TreeVisit.TreePathFragment<Node>> path)
        Enters a tree node. This is called when the node is first reached, before any visitor methods are called on child nodes. See TreeVisit for an example of the call order.
        Parameters:
        node - A tree node.
        path - The path of the node, i.e. all parents of the node. This is always an empty list when includePath is set to false
        Returns:
        How to proceed with the tree visit.
      • exit

        default boolean exit​(Node node,
                             List<TreeVisit.TreePathFragment<Node>> path)
        Exists a tree node. This is called at the end, after all children were visited. No more visitor methods will be called on any children of the node. See TreeVisit for an example of the call order.
        Parameters:
        node - A tree node.
        path - The path of the node, i.e. all parents of the node. This is always an empty list when includePath is set to false
        Returns:
        true to continue with the tree visit, false to exit the visit (see TreeVisit.ETreeVisitResult.QUIT).