T
- Type of Node/Task IDR
- Type of Node/Task resultpublic final class DefaultDag<T extends Comparable<T>,R> extends Object implements Dag<T,R>, Serializable
Constructor and Description |
---|
DefaultDag() |
Modifier and Type | Method and Description |
---|---|
void |
addAsDependencyToAllInitialNodes(T nodeValue)
Adds the node as dependency to all initial nodes (at the time of adding), meaning this given node would be evaluated first and then all initial nodes would run in parallel
|
void |
addAsDependentOnAllLeafNodes(T nodeValue)
Adds the node as dependent on all leaf nodes (at the time of adding), meaning all leaf nodes would be evaluated first and then the given node
|
void |
addDependency(T evalFirstNode,
T evalLaterNode)
Should add the two nodes in the datastructure in such a way that
evalFirstValue should be evaluated before evalAfterValue . |
void |
addIndependent(T nodeValue)
Adds the given node to the datastructure whith out any dependency
Nodes should be created only if it is not already added.
|
Collection<Node<T,R>> |
allNodes()
Returns all nodes in this graph
|
Node<T,R> |
get(T id)
Returns the node with the given id
|
Set<Node<T,R>> |
getInitialNodes()
Returns the Set of nodes for which there is no incoming dependencies.
|
Set<Node<T,R>> |
getLeafNodes()
Retruns the set of nodes for which there is no outgoing dependencies.
|
Set<Node<T,R>> |
getNonProcessedRootNodes() |
int |
size()
Returns the total number of nodes in this graph
|
public void addAsDependentOnAllLeafNodes(T nodeValue)
DependencyAware
addAsDependentOnAllLeafNodes
in interface DependencyAware<T extends Comparable<T>>
nodeValue
- Node which should depend on all leaf nodespublic void addAsDependencyToAllInitialNodes(T nodeValue)
DependencyAware
addAsDependencyToAllInitialNodes
in interface DependencyAware<T extends Comparable<T>>
nodeValue
- Node on which all initial nodes should depends onpublic void addIndependent(T nodeValue)
DependencyAware
addIndependent
in interface DependencyAware<T extends Comparable<T>>
nodeValue
- Unique node idpublic void addDependency(T evalFirstNode, T evalLaterNode)
DependencyAware
evalFirstValue
should be evaluated before evalAfterValue
.
Nodes should be created only if it is not already added.addDependency
in interface DependencyAware<T extends Comparable<T>>
evalFirstNode
- Node which should be evaluated firstevalLaterNode
- Node which should be evaluated after evalFirstValue
public Set<Node<T,R>> getInitialNodes()
Dag
getInitialNodes
in interface Dag<T extends Comparable<T>,R>
public Set<Node<T,R>> getNonProcessedRootNodes()
getNonProcessedRootNodes
in interface Dag<T extends Comparable<T>,R>
public int size()
Dag
public Collection<Node<T,R>> allNodes()
Dag
public Set<Node<T,R>> getLeafNodes()
Dag
getLeafNodes
in interface Dag<T extends Comparable<T>,R>
Copyright © 2016 Dexecutor. All rights reserved.