Package com._1c.g5.v8.dt.common.search
Class Flattener<E>
java.lang.Object
com._1c.g5.v8.dt.common.search.Flattener<E>
- Direct Known Subclasses:
NodeFlattener
Represents an abstract generic flattener of hierarchical structured objects.
Based on sequentially call of methods:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Uses for acceptance of object. Override this method to customize behaviour.flattenAll
(Iterable<E> input) Flattens all hierarchical structured objects to the list by strategy "depth-first search" non-recursive. The initial capacity of the result list has designed for 100 objects.flattenAll
(Iterable<E> input, int maxDepth) Flattens all hierarchical structured objects to the list by strategy "depth-first search" non-recursive. The initial capacity of the result list has designed for 100 objects.protected abstract Collection<E>
getChildren
(E origin) Gets a collection of children.protected abstract boolean
hasChildren
(E origin) Gets a value indicating whether the specified origin is a container of objects. Override this method to indicate that we are interact with the container.
-
Constructor Details
-
Flattener
public Flattener()
-
-
Method Details
-
flattenAll
Flattens all hierarchical structured objects to the list by strategy "depth-first search" non-recursive. The initial capacity of the result list has designed for 100 objects.- Parameters:
input
- the iterable container of hierarchical structured objects.- Returns:
- the flat list of objects.
-
flattenAll
Flattens all hierarchical structured objects to the list by strategy "depth-first search" non-recursive. The initial capacity of the result list has designed for 100 objects.- Parameters:
input
- the iterable container of hierarchical structured objects.maxDepth
- the maximum depth of hierarchy expanding. Zero or negative value is no limit.- Returns:
- the flat list of objects.
-
accept
Uses for acceptance of object. Override this method to customize behaviour.- Parameters:
origin
- the origin object.- Returns:
- true if can accept the specified origin; otherwise, false.
-
hasChildren
Gets a value indicating whether the specified origin is a container of objects. Override this method to indicate that we are interact with the container.- Parameters:
origin
- the origin object.- Returns:
- true if the specified origin is a container of objects.
-
getChildren
Gets a collection of children. This method will be called ifhasChildren(Object)
returnstrue
. Override this method to provide children.- Parameters:
origin
- the origin object.- Returns:
- a collection of children, never
null
. - See Also:
-