DAGraph<DataT,NodeT> Class
- java.
lang. Object - com.
azure. resourcemanager. resources. fluentcore. dag. Graph<DataT,NodeT> - com.
azure. resourcemanager. resources. fluentcore. dag. DAGraph<DataT,NodeT>
- com.
- com.
Type Parameters
- DataT
the type of the data stored in the graph nodes
- NodeT
the type of the nodes in the graph
public class DAGraph<DataT,NodeT>
extends Graph<DataT,NodeT>
Type representing a DAG (directed acyclic graph).
each node in a DAG is represented by DAGNode<DataT,NodeT>
Field Summary
Modifier and Type | Field and Description |
---|---|
protected List<DAGraph<DataT,NodeT>> |
parentDAGs
the immediate parent graphs of this graph. |
protected
Concurrent |
queue
to perform topological sort on the graph. |
Constructor Summary
Constructor | Description |
---|---|
DAGraph(NodeT rootNode) |
Creates a new DAG. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
addDependencyGraph(DAGraph<DataT,NodeT> dependencyGraph)
Mark root of this DAG depends on given DAG's root. |
void |
addDependentGraph(DAGraph<DataT,NodeT> dependentGraph)
Mark root of the given DAG depends on this DAG's root. |
NodeT |
getNext()
Gets next node in the DAG which has no dependency or all of it's dependencies are resolved and ready to be consumed. |
NodeT |
getNode(String key)
Gets a node from the graph with the given key. |
boolean | hasParents() |
boolean | isPreparer() |
boolean |
isRootNode(NodeT node)
Checks whether the given node is root node of this DAG. |
void |
prepareForEnumeration()
Prepares this DAG for node enumeration using get |
void |
reportCompletion(NodeT completed)
Reports that a node is resolved hence other nodes depends on it can consume it. |
void |
reportError(NodeT faulted, Throwable throwable)
Reports that a node is faulted. |
protected NodeT | root() |
Methods inherited from Graph
Methods inherited from java.lang.Object
Field Details
parentDAGs
protected List
the immediate parent graphs of this graph. A parent graph is the one with it's root depends on this graph's root.
queue
protected ConcurrentLinkedQueue
to perform topological sort on the graph. During sorting queue contains the nodes which are ready to invoke.
Constructor Details
DAGraph
public DAGraph(NodeT rootNode)
Creates a new DAG.
Parameters:
Method Details
addDependencyGraph
public void addDependencyGraph(DAGraph
Mark root of this DAG depends on given DAG's root.
Parameters:
addDependentGraph
public void addDependentGraph(DAGraph
Mark root of the given DAG depends on this DAG's root.
Parameters:
getNext
public NodeT getNext()
Gets next node in the DAG which has no dependency or all of it's dependencies are resolved and ready to be consumed.
Returns:
getNode
public NodeT getNode(String key)
Gets a node from the graph with the given key.
Parameters:
Returns:
hasParents
public boolean hasParents()
Returns:
isPreparer
public boolean isPreparer()
Returns:
isRootNode
public boolean isRootNode(NodeT node)
Checks whether the given node is root node of this DAG.
Parameters:
Returns:
prepareForEnumeration
public void prepareForEnumeration()
Prepares this DAG for node enumeration using getNext method, each call to getNext returns next node in the DAG with no dependencies.
reportCompletion
public void reportCompletion(NodeT completed)
Reports that a node is resolved hence other nodes depends on it can consume it.
Parameters:
reportError
public void reportError(NodeT faulted, Throwable throwable)
Reports that a node is faulted.
Parameters:
root
protected NodeT root()
Returns:
Applies to
Azure SDK for Java