Package com.uc4.api.objects
Class CycleDetector
java.lang.Object
com.uc4.api.objects.CycleDetector
Utility class for detecting cycles in workflow task dependencies using topological sort.
This provides a common implementation used by both the editor (WorkflowTasks) and
monitor (ModifyProcessFlowMonitor) to ensure consistent cycle detection behavior.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface to provide the LNR (line number) for a task.static interfaceFunctional interface to provide predecessors for a task. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> voidvalidateNoCycles(Iterable<T> tasks, CycleDetector.PredecessorProvider<T> predecessorProvider, CycleDetector.LnrProvider<T> lnrProvider) Validates that a collection of tasks with their dependencies does not contain cycles.
-
Method Details
-
validateNoCycles
public static <T> void validateNoCycles(Iterable<T> tasks, CycleDetector.PredecessorProvider<T> predecessorProvider, CycleDetector.LnrProvider<T> lnrProvider) Validates that a collection of tasks with their dependencies does not contain cycles. Uses Kahn's algorithm for topological sort.- Type Parameters:
T- The task type- Parameters:
tasks- Iterable of tasks to validatepredecessorProvider- Function to get predecessors for a tasklnrProvider- Function to get the LNR (line number) for a task- Throws:
CyclicException- if a cycle is detected
-