Module gen.tree
Class BaseTreeNodeVisitorHandlerExtensions
- java.lang.Object
-
- io.github.astrapi69.gen.tree.handler.BaseTreeNodeVisitorHandlerExtensions
-
public class BaseTreeNodeVisitorHandlerExtensions extends java.lang.ObjectThe classBaseTreeNodeVisitorHandlerExtensionsprovides handler methods for the visit all field in the classIBaseTreeNode
-
-
Constructor Summary
Constructors Constructor Description BaseTreeNodeVisitorHandlerExtensions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <V,K,T extends IBaseTreeNode<V,K,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,K,T extends IBaseTreeNode<V,K,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,K,T extends IBaseTreeNode<V,K,T>>
java.util.Collection<T>traverse(T treeNode)Traverse the givenIBaseTreeNodeobject and add all descendants with the givenIBaseTreeNodeobject included in to the returnedCollectionobject
-
-
-
Method Detail
-
traverse
public static <V,K,T extends IBaseTreeNode<V,K,T>> java.util.Collection<T> traverse(@NonNull T treeNode)
Traverse the givenIBaseTreeNodeobject and add all descendants with the givenIBaseTreeNodeobject included in to the returnedCollectionobject- Type Parameters:
V- the generic type of the valueK- the generic type of the id of the nodeT- the generic type of the concrete tree node- Parameters:
treeNode- the tree node- Returns:
- a
Collectionobject with the givenIBaseTreeNodeobject and add all descendants
-
accept
public static <V,K,T extends IBaseTreeNode<V,K,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 valueK- the generic type of the id of the nodeT- the generic type of the concrete tree node- Parameters:
treeNode- the tree nodevisitor- the visitor
-
accept
public static <V,K,T extends IBaseTreeNode<V,K,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 valueK- the generic type of the id of the nodeT- the generic type of the concrete tree node- Parameters:
treeNode- the tree nodevisitor- the visitorvisitBefore- the flag if this flag is true the visit of the givenIBaseTreeNodeobject is before visit the children otherwise the visit is after visit the children
-
-