Class TreeParentIterable<Node,Id>
java.lang.Object
de.xima.fc.common.tree.TreeParentIterable<Node,Id>
- Type Parameters:
Node- Type of the items in the tree.Id- Type of the identifier that identifiers the items in the tree.
- All Implemented Interfaces:
Iterable<Node>
Deprecated.
An iterable that iterates over a tree-like graph, starting at a given node, and accessing each parent. Throws an
exception in case the graph is not a tree, thus also preventing endless cycles when the graph is cyclic.
- Since:
- 8.2.0
- Author:
- XIMA MEDIA GmbH
-
Constructor Summary
ConstructorsConstructorDescriptionTreeParentIterable(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, Id> treeAccessor) Deprecated.Returns a new iterable over the parents in the tree, starting at the given item.TreeParentIterable(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, Id> treeAccessor) Deprecated.TreeParentIterable(Node startItem, ITreeParentAccessor<Node, Id> treeAccessor) Deprecated.Returns a new iterable over the parents in the tree, starting at the given item.TreeParentIterable(Node startItem, ITreeParentAccessor<Node, Id> treeAccessor) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic <Node> NodeclosestParentExcludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) Deprecated.Finds the closest parent of the given item that matches the given filter.static <Node> NodeclosestParentExcludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) static <Node> NodeclosestParentIncludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) Deprecated.Finds the closest parent of the given item that matches the given filter.static <Node> NodeclosestParentIncludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) iterator()Deprecated.static <Node> List<Node> toList(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.Iterates over the node and its parents, and returns a list of all iterated nodes.static <Node> List<Node> toList(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.static <Node> Set<Node> toSet(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.Iterates over the node and its parents, and returns a set of all iterated nodes.static <Node> Set<Node> toSet(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
TreeParentIterable
public TreeParentIterable(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, Id> treeAccessor) Deprecated.Returns a new iterable over the parents in the tree, starting at the given item.- Parameters:
startItem- Child item where to start the traversal.includeStartItem- Whether to include the start item in the iteration.treeAccessor- Handler for accessing the parent of a node and its ID.
-
TreeParentIterable
@Deprecated public TreeParentIterable(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, Id> treeAccessor) Deprecated.Returns a new iterable over the parents in the tree, starting at the given item.- Parameters:
startItem- Child item where to start the traversal.includeStartItem- Whether to include the start item in the iteration.treeAccessor- Handler for accessing the parent of a node and its ID.
-
TreeParentIterable
Deprecated.Returns a new iterable over the parents in the tree, starting at the given item.- Parameters:
startItem- Child item where to start the traversal. This item is included in the traversal.treeAccessor- Handler for accessing the parent of a node and its ID.
-
TreeParentIterable
Deprecated.Returns a new iterable over the parents in the tree, starting at the given item.- Parameters:
startItem- Child item where to start the traversal. This item is included in the traversal.treeAccessor- Handler for accessing the parent of a node and its ID.
-
-
Method Details
-
iterator
-
closestParentExcludingStart
public static <Node> Node closestParentExcludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) Deprecated.Finds the closest parent of the given item that matches the given filter. Does not include the start node in the list of candidates. A null filter is treated as no filter, i.e. so this method returns the first parent.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal.treeAccessor- Handler for accessing the parent of a node, and its identifier.filter- Predicate to filter the nodes.- Returns:
- The closest parent of the given item that matches the given filter. null if no such parent exists.
-
closestParentExcludingStart
@Deprecated public static <Node> Node closestParentExcludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) Finds the closest parent of the given item that matches the given filter. Does not include the start node in the list of candidates. A null filter is treated as no filter, i.e. so this method returns the first parent.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal.treeAccessor- Handler for accessing the parent of a node, and its identifier.filter- Predicate to filter the nodes.- Returns:
- The closest parent of the given item that matches the given filter. null if no such parent exists.
-
closestParentIncludingStart
public static <Node> Node closestParentIncludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) Deprecated.Finds the closest parent of the given item that matches the given filter. Include the start node in the list of candidates. A null filter is treated as no filter, i.e. this method returns the start node itself.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal.treeAccessor- Handler for accessing the parent of a node, and its identifier.filter- Predicate to filter the nodes.- Returns:
- The closest parent of the given item that matches the given filter. null if no such parent exists.
-
closestParentIncludingStart
@Deprecated public static <Node> Node closestParentIncludingStart(Node startItem, ITreeParentAccessor<Node, ?> treeAccessor, Predicate<? super Node> filter) Finds the closest parent of the given item that matches the given filter. Include the start node in the list of candidates. A null filter is treated as no filter, i.e. this method returns the start node itself.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal.treeAccessor- Handler for accessing the parent of a node, and its identifier.filter- Predicate to filter the nodes.- Returns:
- The closest parent of the given item that matches the given filter. null if no such parent exists.
-
toList
public static <Node> List<Node> toList(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.Iterates over the node and its parents, and returns a list of all iterated nodes.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal. This item is included in the returned list.includeStartItem- Whether to include the start item in the iteration.treeAccessor- Handler for accessing the parent of a node, and its identifier.- Returns:
- A list with the given start item and all its parents.
-
toList
@Deprecated public static <Node> List<Node> toList(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.Iterates over the node and its parents, and returns a list of all iterated nodes.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal. This item is included in the returned list.includeStartItem- Whether to include the start item in the iteration.treeAccessor- Handler for accessing the parent of a node, and its identifier.- Returns:
- A list with the given start item and all its parents.
-
toSet
public static <Node> Set<Node> toSet(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.Iterates over the node and its parents, and returns a set of all iterated nodes.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal. This item is included in the returned list.includeStartItem- Whether to include the start item in the iteration.treeAccessor- Handler for accessing the parent of a node, and its identifier.- Returns:
- A set with the given start item and all its parents.
-
toSet
@Deprecated public static <Node> Set<Node> toSet(Node startItem, boolean includeStartItem, ITreeParentAccessor<Node, ?> treeAccessor) Deprecated.Iterates over the node and its parents, and returns a set of all iterated nodes.- Type Parameters:
Node- Type of the items in the tree.- Parameters:
startItem- Node where to start the traversal. This item is included in the returned list.includeStartItem- Whether to include the start item in the iteration.treeAccessor- Handler for accessing the parent of a node, and its identifier.- Returns:
- A set with the given start item and all its parents.
-
TreeParentIterableinstead.