|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.DirectedAcyclicGraph
This utility class represents a directed acyclic graph. It is useful for sorting collections that contain some incomparable members.
| Nested Class Summary | |
static interface |
DirectedAcyclicGraph.EdgeCalculator
|
| Field Summary | |
private boolean[][] |
edgeExists
The edges of the DAG. |
private int |
nextResultSlot
Index to the next entry to be filled in result. |
private java.lang.Object[] |
result
Working space for the depth-first search algorithm |
private java.lang.Object[] |
vertex
The vertices of the DAG. |
private boolean[] |
visited
Tracks whether the depth-first search algorithm has visited a given vertex. |
| Constructor Summary | |
DirectedAcyclicGraph(java.lang.Object[] vertices,
DirectedAcyclicGraph.EdgeCalculator calc)
Constructs a directed acyclic graph with the given objects as the vertices and the given calculator specifying the edges. |
|
| Method Summary | |
java.lang.Object[] |
inDFSOrder()
Returns the vertices in depth-first search order. |
private void |
initEdges(DirectedAcyclicGraph.EdgeCalculator calc)
Initializes the edges of the DAG representation using the given calculator. |
private void |
showDAG()
|
private void |
visit(int pos)
Helper method for depthFirstOrder. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private final java.lang.Object[] vertex
private final boolean[][] edgeExists
private java.lang.Object[] result
private int nextResultSlot
private boolean[] visited
| Constructor Detail |
public DirectedAcyclicGraph(java.lang.Object[] vertices,
DirectedAcyclicGraph.EdgeCalculator calc)
requires vertices != null && calc != null && acyclic(vertices, calc);
| Method Detail |
private void initEdges(DirectedAcyclicGraph.EdgeCalculator calc)
public java.lang.Object[] inDFSOrder()
private void visit(int pos)
private void showDAG()
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||