Class GraphUtil

java.lang.Object
com.espertech.esper.common.internal.util.GraphUtil

public class GraphUtil extends Object
Utility for working with acyclic graph: determines cyclic dependency and dependency-satisfying processing order.
  • Constructor Details

    • GraphUtil

      public GraphUtil()
  • Method Details

    • mergeNestableMap

      public static Map<String,Object> mergeNestableMap(Map<String,Object> original, Map<String,Object> additional)
      Deep-merge a map into another map returning a result map.

      Copies all values present in the original map to a new map, adding additional value present in the second map passed in, ignoring same-key values in the second map that are present in the original.

      If the value is a Map itself, repeats the operation on the Map value.

      Parameters:
      original - nestable Map of entries to retain and not overwrite
      additional - nestable Map of entries to add to the original
      Returns:
      merge of original and additional nestable map
    • getTopDownOrder

      public static Set<String> getTopDownOrder(Map<String,Set<String>> graph) throws GraphCircularDependencyException
      Check cyclic dependency and determine processing order for the given graph.
      Parameters:
      graph - is represented as child nodes that have one or more parent nodes that they are dependent on
      Returns:
      set of parent and child nodes in order such that no node's dependency is not satisfied by a prior nodein the set
      Throws:
      GraphCircularDependencyException - if a dependency has been detected