Class DAGraph<DataT,NodeT extends DAGNode<DataT,NodeT>>
java.lang.Object
com.microsoft.azure.management.resources.fluentcore.dag.Graph<DataT,NodeT>
com.microsoft.azure.management.resources.fluentcore.dag.DAGraph<DataT,NodeT>
- Type Parameters:
DataT
- the type of the data stored in the graph nodesNodeT
- the type of the nodes in the graph
- Direct Known Subclasses:
TaskGroup
Type representing a DAG (directed acyclic graph).
each node in a DAG is represented by DAGNode
-
Field Summary
Modifier and TypeFieldDescriptionthe immediate parent graphs of this graph.protected ConcurrentLinkedQueue<String>
to perform topological sort on the graph. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.getNext()
Gets next node in the DAG which has no dependency or all of it's dependencies are resolved and ready to be consumed.Gets a node from the graph with the given key.boolean
boolean
boolean
isRootNode
(NodeT node) Checks whether the given node is root node of this DAG.void
Prepares this DAG for node enumeration using getNext method, each call to getNext returns next node in the DAG with no dependencies.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()
-
Field Details
-
parentDAGs
the immediate parent graphs of this graph. A parent graph is the one with it's root depends on this graph's root. -
queue
to perform topological sort on the graph. During sorting queue contains the nodes which are ready to invoke.
-
-
Constructor Details
-
DAGraph
Creates a new DAG.- Parameters:
rootNode
- the root node of this DAG
-
-
Method Details
-
hasParents
public boolean hasParents()- Returns:
- true if this DAG is merged with one or more DAG and hence has parents
-
root
- Returns:
- the root node of the DAG.
-
isRootNode
Checks whether the given node is root node of this DAG.- Parameters:
node
- the nodeDAGNode
to be checked- Returns:
- true if the given node is root node
-
isPreparer
public boolean isPreparer()- Returns:
- true if this dag is the preparer responsible for preparing the DAG for traversal.
-
getNode
Gets a node from the graph with the given key.- Parameters:
key
- the key of the node- Returns:
- the node
-
addDependencyGraph
Mark root of this DAG depends on given DAG's root.- Parameters:
dependencyGraph
- the dependency DAG
-
addDependentGraph
Mark root of the given DAG depends on this DAG's root.- Parameters:
dependentGraph
- the dependent DAG
-
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. -
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:
- next node or null if all the nodes have been explored or no node is available at this moment.
-
reportCompletion
Reports that a node is resolved hence other nodes depends on it can consume it.- Parameters:
completed
- the node ready to be consumed
-
reportError
Reports that a node is faulted.- Parameters:
faulted
- the node faultedthrowable
- the reason for fault
-