Class DependencyGraph<X>

java.lang.Object
com.evolveum.midpoint.util.DependencyGraph<X>

public class DependencyGraph<X> extends Object
Represents the dependencies between items. Provides getSortedItems() and getTopologicalSort() methods to sort the items topologically. Can be created right from the dependency map (ofMap(Map)) or from individual items (ofItems(Collection)). The dependencies themselves must reference only known items.
  • Method Details

    • ofMap

      public static <X> DependencyGraph<X> ofMap(Map<X,Collection<X>> dependencyMap)
      Creates the dependency graph from the given dependency map.
    • ofItems

      public static <I extends DependencyGraph.Item<I>> DependencyGraph<I> ofItems(@NotNull @NotNull Collection<I> items)
      Creates the dependency graph from items that can tell us about their dependencies.
    • getSortedItems

      public List<X> getSortedItems()
      Returns the items sorted topologically: if A is before B, then A does not depend on B, or throws an exception if no such ordering exists.
    • getTopologicalSort

      @NotNull public @NotNull DependencyGraph.TopologicalSort<X> getTopologicalSort()
      Returns items topologically sorted (as much as possible).