Package de.xima.fc.common.tree
Class TreeVisit.TreeVisitParams.Builder<Node,Id>
- java.lang.Object
-
- de.xima.fc.common.tree.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 forTreeVisit
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TreeVisit.TreeVisitParams<Node,Id>
build()
Creates a new tree visit params instance with the current settings.TreeVisit.TreeVisitParams.Builder<Node,Id>
checkForCycles(boolean checkForCycles)
Avoids endless loops caused by checking for already visited node.TreeVisit.TreeVisitParams.Builder<Node,Id>
includePath(boolean includePath)
Whether to include the path (i.e.
-
-
-
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 itslist of children
; or when multiple nodes include the same node in their list of children.Defaults to
true
, you can set this tofalse
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 tofalse
, the path passed to the callbacks inTreeVisit.ITreeVisitor
will always be an empty list.Defaults to
true
, you can set this tofalse
for increased performance when you do not need the path.Consider using
TreeVisit.ITreeVisitor.Pathless
when you set this totrue
.- Parameters:
includePath
- Whether to include the path of each node.- Returns:
- This builder instance for chaining method calls.
-
-