Class TreeNodeVisitorHandlerExtensions
java.lang.Object
io.github.astrapi69.gen.tree.handler.TreeNodeVisitorHandlerExtensions
The class
TreeNodeVisitorHandlerExtensions provides handler methods for the visit all
field in the class ITreeNode-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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>>
Collection<T>traverse(T treeNode) Traverse the givenITreeNodeobject and add all descendants with the givenITreeNodeobject included in to the returnedCollectionobject
-
Constructor Details
-
TreeNodeVisitorHandlerExtensions
public TreeNodeVisitorHandlerExtensions()
-
-
Method Details
-
traverse
Traverse the givenITreeNodeobject and add all descendants with the givenITreeNodeobject included in to the returnedCollectionobject- Type Parameters:
V- the generic type of the valueT- the generic type of the concrete tree node- Parameters:
treeNode- the tree node- Returns:
- a
Collectionobject with the givenITreeNodeobject and add all descendants
-
accept
public static <V,T extends ITreeNode<V, void acceptT>> (@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 concrete tree node- Parameters:
treeNode- the tree nodevisitor- the visitor
-
accept
public static <V,T extends ITreeNode<V, void acceptT>> (@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 concrete tree node- Parameters:
treeNode- the tree nodevisitor- the visitorvisitBefore- the flag if this flag is true the visit of the givenITreeNodeobject is before visit the children otherwise the visit is after visit the children
-