|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.avalon.fortress.util.dag.Vertex
public final class Vertex
Vertex is used to track dependencies and each node in a graph. Typical uses would be to ensure components are started up and torn down in the proper order, or bundles were loaded and unloaded in the proper order, etc.
Constructor Summary | |
---|---|
Vertex(Object node)
A vertex wraps a node, which can be anything. |
|
Vertex(String name,
Object node)
A vertex wraps a node, which can be anything. |
Method Summary | |
---|---|
void |
addDependency(Vertex v)
Add a dependecy to this Vertex. |
int |
compareTo(Object o)
Used in the sort algorithm to sort all the Vertices so that they respect the ordinal they were given during the topological sort. |
List |
getDependencies()
Get the list of dependencies. |
String |
getName()
Returns the name of the Vertex. |
Object |
getNode()
Get the wrapped node that this Vertex represents. |
int |
getOrder()
Get the ordinal for this vertex. |
void |
reset()
Reset the Vertex so that all the flags and runtime states are set back to the original values. |
void |
resolveOrder()
Recurse through the tree from this vertex assigning an order to each and at the same time checking for any cyclic dependencies. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Vertex(Object node)
node
- The wrapped node.public Vertex(String name, Object node)
name
- A name for the node which will be used to produce useful errors.node
- The wrapped node.Method Detail |
---|
public void reset()
public String getName()
public Object getNode()
public void addDependency(Vertex v)
v
- The vertex we depend on.public void resolveOrder() throws CyclicDependencyException
CyclicDependencyException
- If a cyclic dependency is discovered.public List getDependencies()
public int compareTo(Object o)
compareTo
in interface Comparable
o
- The other Vertex to compare with
public int getOrder()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |