|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.ant4eclipse.lang.dependencygraph.DependencyGraph
public final class DependencyGraph
A DependencyGraph
could be used to serialise tree structures regarding the dependencies. The tree will
be transformed in a linear structure (List).
A referenced node will always appear prior to the referencing node. Example:
A | ------------- | | | B C D | Ewill be transformed to E,B,D,C,A oder B,E,D,C,A.
The order of the nodes depends on the order of the defintion via addVertex()
and addEdge()
.
Nested Class Summary | |
---|---|
static class |
DependencyGraph.Edge
Internal representation of an edge. |
Constructor Summary | |
---|---|
DependencyGraph()
Creates a new instance of type DependencyGraph. |
Method Summary | |
---|---|
void |
addEdge(java.lang.Object parent,
java.lang.Object child)
Adds an edge to the dependency graph. |
void |
addVertex(java.lang.Object vertex)
Adds a vertex to the dependency graph. |
java.util.List |
calculateOrder()
Computers the order of all the nodes. |
boolean |
containsVertex(java.lang.Object vertex)
Returns true , if the given vertex has already been added to the DependencyGraph. |
boolean |
isClosed()
Returns true , if the graph is closed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DependencyGraph()
Method Detail |
---|
public void addVertex(java.lang.Object vertex)
vertex
- the vertex that will be added.public boolean containsVertex(java.lang.Object vertex)
true
, if the given vertex has already been added to the DependencyGraph.
vertex
- the vertex
true
, if the given vertex has already been added to the DependencyGraph, otherwise
false
.public void addEdge(java.lang.Object parent, java.lang.Object child)
parent
- the parent nodechild
- the child nodepublic boolean isClosed()
true
, if the graph is closed.
true
, if the graph is closed.public java.util.List calculateOrder() throws CyclicDependencyException
CyclicDependencyException
- thrown, if the graph structure contains a cycle.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |