Class TreeVisit.TreeVisitParams.Builder<Node,​Id>

  • Type Parameters:
    Node - Type of the nodes in the tree.
    Id - Type of the identifier for a node.
    Enclosing class:
    TreeVisit.TreeVisitParams<Node,​Id>

    public static final class TreeVisit.TreeVisitParams.Builder<Node,​Id>
    extends Object
    A builder for configuring the parameters for TreeVisit.
    • Method Detail

      • build

        public TreeVisit.TreeVisitParams<Node,​Id> build()
        Creates a new tree visit params instance with the current settings.
        Returns:
        A new params instance.
      • checkForCycles

        public TreeVisit.TreeVisitParams.Builder<Node,​Id> checkForCycles​(boolean checkForCycles)
        Avoids endless loops caused by checking for already visited node. This may happen e.g. when a node has one of its parents in its list of children; or when multiple nodes include the same node in their list of children.

        Defaults to true, you can set this to false for increased performance when you are certain no such bad nodes exist.

        Parameters:
        checkForCycles - Whether to check for cycles in the tree data structure.
        Returns:
        This builder instance for chaining method calls.
      • includePath

        public TreeVisit.TreeVisitParams.Builder<Node,​Id> includePath​(boolean includePath)
        Whether to include the path (i.e. a node's parents) in the visitor methods. When set to false , the path passed to the callbacks in TreeVisit.ITreeVisitor will always be an empty list.

        Defaults to true, you can set this to false for increased performance when you do not need the path.

        Consider using TreeVisit.ITreeVisitor.Pathless when you set this to true.

        Parameters:
        includePath - Whether to include the path of each node.
        Returns:
        This builder instance for chaining method calls.