Class DependencyGraph
java.lang.Object
com.espertech.esper.common.internal.util.DependencyGraph
Model of dependency of lookup, in which one stream supplies values for lookup in another stream.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDependency
(int target, int from) Adds a single dependency of target on a required streams.void
addDependency
(int target, SortedSet<Integer> requiredStreams) Adds dependencies that a target may have on required streams.Returns a map of stream number and the streams dependencies.getDependenciesForStream
(int stream) Returns the set of dependent streams for a given stream.Returns any circular dependency as a stack of stream numbers, or null if none exist.int
Returns the number of streams.Returns a set of stream numbers that are the root dependencies, i.e.getRootNodes
(Set<Integer> ignoreList) Return the root nodes ignoring the nodes provided.boolean
hasDependency
(int stream) Returns true if the stream asked for has a dependency.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.toString()
-
Constructor Details
-
DependencyGraph
public DependencyGraph(int numStreams, boolean allowDependencySame) Ctor.- Parameters:
numStreams
- - number of streamsallowDependencySame
- - allow same-dependency stream
-
-
Method Details
-
getNumStreams
public int getNumStreams()Returns the number of streams.- Returns:
- number of streams
-
toString
-
addDependency
Adds dependencies that a target may have on required streams.- Parameters:
target
- the stream having dependencies on one or more other streamsrequiredStreams
- 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 streamsfrom
- 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
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
Returns a map of stream number and the streams dependencies.- Returns:
- map of dependencies
-
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
Return the root nodes ignoring the nodes provided.- Parameters:
ignoreList
- nodes to be ignored- Returns:
- root nodes
-
getFirstCircularDependency
Returns any circular dependency as a stack of stream numbers, or null if none exist.- Returns:
- circular dependency stack
-
hasUnsatisfiedDependency
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 listnavigableStream
- to-stream- Returns:
- indicator whether there is an unsatisfied dependency
-