com.espertech.esper.util
Class GraphUtil

java.lang.Object
  extended by com.espertech.esper.util.GraphUtil

public class GraphUtil
extends java.lang.Object

Utility for working with acyclic graph: determines cyclic dependency and dependency-satisfying processing order.


Constructor Summary
GraphUtil()
           
 
Method Summary
static java.util.Set<java.lang.String> getTopDownOrder(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> graph)
          Check cyclic dependency and determine processing order for the given graph.
static java.util.Map<java.lang.String,java.lang.Object> mergeNestableMap(java.util.Map<java.lang.String,java.lang.Object> original, java.util.Map<java.lang.String,java.lang.Object> additional)
          Deep-merge a map into another map returning a result map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphUtil

public GraphUtil()
Method Detail

mergeNestableMap

public static java.util.Map<java.lang.String,java.lang.Object> mergeNestableMap(java.util.Map<java.lang.String,java.lang.Object> original,
                                                                                java.util.Map<java.lang.String,java.lang.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 java.util.Set<java.lang.String> getTopDownOrder(java.util.Map<java.lang.String,java.util.Set<java.lang.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

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com