- java.lang.Object
-
- io.github.astrapi69.gen.tree.handler.TreeNodeVisitorHandlerExtensions
-
public class TreeNodeVisitorHandlerExtensions extends java.lang.Object
The classTreeNodeVisitorHandlerExtensions
provides handler methods for the visit all field in the classITreeNode
-
-
Constructor Summary
Constructors Constructor Description TreeNodeVisitorHandlerExtensions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V,T extends ITreeNode<V,T>>
voidaccept(T treeNode, @NonNull io.github.astrapi69.design.pattern.visitor.Visitor<T> visitor)
Accepts the given visitor that provides a custom algorithm for processing all elementsstatic <V,T extends ITreeNode<V,T>>
voidaccept(T treeNode, @NonNull io.github.astrapi69.design.pattern.visitor.Visitor<T> visitor, boolean visitBefore)
Accepts the given visitor that provides a custom algorithm for processing all elementsstatic <V,T extends ITreeNode<V,T>>
java.util.Collection<T>traverse(T treeNode)
-
-
-
Method Detail
-
traverse
public static <V,T extends ITreeNode<V,T>> java.util.Collection<T> traverse(@NonNull T treeNode)
Traverse the givenITreeNode
object and add all descendants with the givenITreeNode
object included in to the returnedCollection
object- Type Parameters:
V
- the generic type of the valueT
- the generic type of the id of the node- Parameters:
treeNode
- the tree node- Returns:
- a
Collection
object with the givenITreeNode
object and add all descendants
-
accept
public static <V,T extends ITreeNode<V,T>> void accept(@NonNull T treeNode, @NonNull @NonNull io.github.astrapi69.design.pattern.visitor.Visitor<T> visitor)
Accepts the given visitor that provides a custom algorithm for processing all elements- Type Parameters:
V
- the generic type of the valueT
- the generic type of the id of the node- Parameters:
treeNode
- the tree nodevisitor
- the visitor
-
accept
public static <V,T extends ITreeNode<V,T>> void accept(@NonNull T treeNode, @NonNull @NonNull io.github.astrapi69.design.pattern.visitor.Visitor<T> visitor, boolean visitBefore)
Accepts the given visitor that provides a custom algorithm for processing all elements- Type Parameters:
V
- the generic type of the valueT
- the generic type of the id of the node- Parameters:
treeNode
- the tree nodevisitor
- the visitorvisitBefore
- the flag if this flag is true the visit of the givenITreeNode
object is before visit the children otherwise the visit is after visit the children
-
-