Package com.storedobject.ui.util
Interface ChildVisitor<P extends T,T>
- Type Parameters:
P
- Type representing the parent objects in the structure.T
- Type representing all elements (both parents and children) in the structure.
- All Known Implementing Classes:
AbstractAssembly
,AbstractCheckListForestBrowser
,AbstractObjectForest
,Assembly
,AssemblyDataPickup
,AssemblyReceipt
,BaseObjectForest
,CheckListForestBrowser
,DefineAssembly
,FileManager
,FileViewer
,ObjectForest
,ObjectForestBrowser
,ObjectForestEditor
,ObjectForestProvider
,ObjectForestViewer
,ObjectTree
,ObjectTreeBrowser
,ObjectTreeEditor
,ObjectTreeProvider
,ObjectTreeViewer
,ViewAssembly
,ViewAssemblyDefinition
public interface ChildVisitor<P extends T,T>
The ChildVisitor interface allows for traversing and processing child elements
rooted in a hierarchical structure. It defines methods for obtaining root elements
and visiting child elements with specified operations.
-
Method Summary
Modifier and TypeMethodDescriptionlistChildren
(T parent) Retrieves a list of child elements directly associated with the specified parent in a hierarchical structure.Retrieves a list of root elements in the hierarchical structure.streamChildren
(T parent) Produces a stream of child elements for the given parent element.Streams the root elements of the hierarchical structure.default void
visitAll
(BiConsumer<T, int[]> consumer) Visits all elements in a hierarchical structure starting from the root elements, applying the specified action to each element encountered.default void
visitAll
(BiConsumer<T, int[]> consumer, Predicate<Void> canContinue) Traverses all elements in a hierarchical structure, starting from the root elements, and applies the specified action to each element encountered.default void
Visits all elements in the structure starting from the root elements, applying the specified action to each element encountered.default void
Visits all elements in the hierarchical structure starting from the root elements, applying the specified action to each element encountered.default void
visitChildren
(T parent, int[] parentPath, BiConsumer<T, int[]> consumer, boolean includeGrandChildren) Traverses through the children of the given parent element, applying the specified operation to each child along with the corresponding path in the hierarchy.default void
visitChildren
(T parent, int[] parentPath, BiConsumer<T, int[]> consumer, boolean includeGrandChildren, Predicate<Void> canContinue) Traverses the children of the given parent element, applying the specified operation to each child along with its corresponding path in the hierarchy.default void
visitChildren
(T parent, Consumer<T> consumer, boolean includeGrandChildren) Traverses through the children of the given parent element, applying the specified operation to each child.default void
visitChildren
(T parent, Consumer<T> consumer, boolean includeGrandChildren, Predicate<Void> canContinue) Traverses through the children of the given parent element, applying the specified operation to each child.
-
Method Details
-
streamRoots
-
streamChildren
Produces a stream of child elements for the given parent element. This allows traversal or processing of direct child elements in a hierarchical structure.- Parameters:
parent
- the parent element whose children are to be streamed- Returns:
- a stream of child elements directly associated with the specified parent
-
listRoots
-
listChildren
-
visitAll
Visits all elements in the structure starting from the root elements, applying the specified action to each element encountered. This method traverses the entire hierarchy of elements by visiting each parent node and recursively visiting its children.- Parameters:
consumer
- the action to be performed on each element encountered during the traversal
-
visitAll
Visits all elements in the hierarchical structure starting from the root elements, applying the specified action to each element encountered. The traversal continues only if the specifiedcanContinue
predicate evaluates totrue
. -
visitChildren
Traverses through the children of the given parent element, applying the specified operation to each child. Optionally, it also processes the grandchildren and later descendants recursively, if specified.- Parameters:
parent
- The parent element whose children are to be visited and processed.consumer
- AConsumer
that specifies the operation to be performed on each child element.includeGrandChildren
- A boolean flag indicating whether the operation should also be applied to grandchildren and subsequent descendants.
-
visitChildren
default void visitChildren(T parent, Consumer<T> consumer, boolean includeGrandChildren, Predicate<Void> canContinue) Traverses through the children of the given parent element, applying the specified operation to each child. Optionally, it also processes the grandchildren and later descendants recursively, if specified. The traversal continues only if the specifiedcanContinue
predicate evaluates totrue
.- Parameters:
parent
- The parent element whose children are to be visited and processed.consumer
- AConsumer
that specifies the operation to be performed on each child element.includeGrandChildren
- A boolean flag indicating whether the operation should also be applied to grandchildren and subsequent descendants.canContinue
- APredicate
that determines whether the traversal should continue. If the predicate evaluates tofalse
, the traversal stops.
-
visitAll
Visits all elements in a hierarchical structure starting from the root elements, applying the specified action to each element encountered. The method provides the element and its path in the structure (represented as an array of indices) to the specifiedBiConsumer
.- Parameters:
consumer
- aBiConsumer
that specifies the action to be performed on each element, taking the element of typeT
and its path (an array of integers) in the hierarchy as arguments
-
visitAll
Traverses all elements in a hierarchical structure, starting from the root elements, and applies the specified action to each element encountered. The method provides each element and its path (represented as an array of indices) to the givenBiConsumer
. The traversal continues only if the specifiedcanContinue
predicate evaluates totrue
.- Parameters:
consumer
- aBiConsumer
that defines the action to be performed on each element, taking the element of typeT
and its corresponding path in the hierarchy (as an array of integers) as argumentscanContinue
- aPredicate
that determines whether the traversal should continue. If the predicate evaluates tofalse
, the traversal stops
-
visitChildren
default void visitChildren(T parent, int[] parentPath, BiConsumer<T, int[]> consumer, boolean includeGrandChildren) Traverses through the children of the given parent element, applying the specified operation to each child along with the corresponding path in the hierarchy. Optionally, it also processes the grandchildren and later descendants recursively, if specified.- Parameters:
parent
- The parent element whose children are to be visited and processed.parentPath
- An array representing the path of indices leading to the current parent within the hierarchical structure.consumer
- ABiConsumer
that specifies the operation to be performed on each child element and their corresponding path.includeGrandChildren
- A boolean flag indicating whether the operation should also be applied to grandchildren and subsequent descendants.
-
visitChildren
default void visitChildren(T parent, int[] parentPath, BiConsumer<T, int[]> consumer, boolean includeGrandChildren, Predicate<Void> canContinue) Traverses the children of the given parent element, applying the specified operation to each child along with its corresponding path in the hierarchy. Optionally, it also processes the grandchildren and later descendants recursively, if specified. The traversal continues only if the specifiedcanContinue
predicate evaluates totrue
.- Parameters:
parent
- The parent element whose children are to be visited and processed.parentPath
- An array representing the path of indices leading to the current parent within the hierarchical structure.consumer
- ABiConsumer
that specifies the operation to be performed on each child element and their corresponding path.includeGrandChildren
- A boolean flag indicating whether the operation should also be applied to grandchildren and subsequent descendants.canContinue
- APredicate
that determines whether the traversal should continue. If the predicate evaluates tofalse
, the traversal stops.
-