DataT - the type of the data stored in the graph nodesNodeT - the type of the nodes in the graphpublic class DAGraph<DataT,NodeT extends DAGNode<DataT,NodeT>> extends Graph<DataT,NodeT>
each node in a DAG is represented by DAGNode
| Constructor and Description |
|---|
DAGraph(NodeT rootNode)
Creates a new DAG.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
hasParent() |
boolean |
isPreparer() |
boolean |
isRootNode(NodeT node)
Checks whether the given node is root node of this DAG.
|
void |
merge(DAGraph<DataT,NodeT> parent)
Merge this DAG with another DAG.
|
void |
mergeChildToParent(String parentKey,
NodeT childNode)
Merges DAG associated with childNode to DAG associated with a parent node
of given key.
|
void |
prepare()
Prepares this DAG for traversal 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.
|
public DAGraph(NodeT rootNode)
rootNode - the root node of this DAGpublic boolean hasParent()
public boolean isRootNode(NodeT node)
node - the node DAGNode to be checkedpublic boolean isPreparer()
public void merge(DAGraph<DataT,NodeT> parent)
This will mark this DAG as a child DAG, the dependencies of nodes in this DAG will be merged with (copied to) the parent DAG
parent - the parent DAGpublic void mergeChildToParent(String parentKey, NodeT childNode)
parentKey - the key of the parent nodechildNode - the child nodepublic void prepare()
public NodeT getNext()
public NodeT getNode(String key)
key - the key of the nodepublic void reportCompletion(NodeT completed)
completed - the node ready to be consumed/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/