Class DependencyGraph

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

public class DependencyGraph extends Object
Model of dependency of lookup, in which one stream supplies values for lookup in another stream.
  • Constructor Details

    • DependencyGraph

      public DependencyGraph(int numStreams, boolean allowDependencySame)
      Ctor.
      Parameters:
      numStreams - - number of streams
      allowDependencySame - - allow same-dependency stream
  • Method Details

    • getNumStreams

      public int getNumStreams()
      Returns the number of streams.
      Returns:
      number of streams
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • addDependency

      public void addDependency(int target, SortedSet<Integer> requiredStreams)
      Adds dependencies that a target may have on required streams.
      Parameters:
      target - the stream having dependencies on one or more other streams
      requiredStreams - the streams that the target stream has a dependency on
    • addDependency

      public void addDependency(int target, int from)
      Adds a single dependency of target on a required streams.
      Parameters:
      target - the stream having dependencies on one or more other streams
      from - a single required streams that the target stream has a dependency on
    • hasDependency

      public boolean hasDependency(int stream)
      Returns true if the stream asked for has a dependency.
      Parameters:
      stream - to check dependency for
      Returns:
      true if a dependency exist, false if not
    • getDependenciesForStream

      public Set<Integer> getDependenciesForStream(int stream)
      Returns the set of dependent streams for a given stream.
      Parameters:
      stream - to return dependent streams for
      Returns:
      set of stream numbers of stream providing properties
    • getDependencies

      public Map<Integer,SortedSet<Integer>> getDependencies()
      Returns a map of stream number and the streams dependencies.
      Returns:
      map of dependencies
    • getRootNodes

      public Set<Integer> getRootNodes()
      Returns a set of stream numbers that are the root dependencies, i.e. the dependencies with the deepest graph.
      Returns:
      set of stream number of streams
    • getRootNodes

      public Set<Integer> getRootNodes(Set<Integer> ignoreList)
      Return the root nodes ignoring the nodes provided.
      Parameters:
      ignoreList - nodes to be ignored
      Returns:
      root nodes
    • getFirstCircularDependency

      public Stack<Integer> getFirstCircularDependency()
      Returns any circular dependency as a stack of stream numbers, or null if none exist.
      Returns:
      circular dependency stack
    • hasUnsatisfiedDependency

      public boolean hasUnsatisfiedDependency(int navigableStream, Set<Integer> ignoreList)
      Check if the given stream has any dependencies, direct or indirect, to any of the streams that are not in the ignore list.
      Parameters:
      ignoreList - ignore list
      navigableStream - to-stream
      Returns:
      indicator whether there is an unsatisfied dependency