Package com.petrolpark.util
Class GraphHelper
java.lang.Object
com.petrolpark.util.GraphHelper
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Set<T> getAllDescendants(T parent, Function<T, ? extends Iterable<? extends T>> childGetter) static <T> Set<T> getAllDescendants(T parent, Function<T, ? extends Iterable<? extends T>> childGetter, Predicate<T> noChildren)
-
Constructor Details
-
GraphHelper
public GraphHelper()
-
-
Method Details
-
getAllDescendants
public static <T> Set<T> getAllDescendants(T parent, Function<T, ? extends Iterable<? extends T>> childGetter) throws GraphHelper.CircularReferenceException- Type Parameters:
T- Child and parent- Parameters:
parent-childGetter- Function that returns direct children of the parent- Returns:
- Set of all descendants (not just closest-generation)
- Throws:
GraphHelper.CircularReferenceException- If a parent includes itself as a descendant- See Also:
-
getAllDescendants
public static <T> Set<T> getAllDescendants(T parent, Function<T, ? extends Iterable<? extends T>> childGetter, Predicate<T> noChildren) throws GraphHelper.CircularReferenceException- Type Parameters:
T- Child and parent- Parameters:
parent-childGetter- Function that returns direct children of the parentnoChildren- Predicate of objects to not bother checking for further children- Returns:
- Set of all descendants (not just closest-generation)
- Throws:
GraphHelper.CircularReferenceException- If a parent includes itself as a descendant- See Also:
-