Package nzilbb.util
Class DependencyGraph<C>
- java.lang.Object
-
- nzilbb.util.DependencyGraph<C>
-
public class DependencyGraph<C> extends Object
Graph of dependencies.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Constructor Summary
Constructors Constructor Description DependencyGraph()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DependencyNode<C>
add(DependencyNode<C> node)
Adds the given node to the graph.Set<DependencyNode<C>>
getNodes()
Getter fornodes
: All the nodes in the graph.Collection<DependencyNode<C>>
resolve()
Resolves dependencies, and returns an ordered list of nodes reflecting the order in which nodes must be processed to ensure each node's depencies are met before processing.
-
-
-
Method Detail
-
getNodes
public Set<DependencyNode<C>> getNodes()
Getter fornodes
: All the nodes in the graph.- Returns:
- All the nodes in the graph.
-
add
public DependencyNode<C> add(DependencyNode<C> node)
Adds the given node to the graph.- Parameters:
node
-- Returns:
- The node added.
-
resolve
public Collection<DependencyNode<C>> resolve() throws CircularDependencyException
Resolves dependencies, and returns an ordered list of nodes reflecting the order in which nodes must be processed to ensure each node's depencies are met before processing.- Returns:
- An ordered list of nodes reflecting the order in which nodes must be processed to ensure each node's depencies are met before processing.
- Throws:
CircularDependencyException
- If a circular dependency is detected.
-
-