Package org.apache.myfaces.config.util
Class DirectedAcyclicGraphVerifier
java.lang.Object
org.apache.myfaces.config.util.DirectedAcyclicGraphVerifier
DirectedAcyclicGraphVerifier provides methods to verify that any set of
 vertices has no cycles.  A Directed Acyclic Graph is a "graph" or set of
 vertices where all connections between each vertex goes in a particular
 direction and there are no cycles or loops.  It is used to track dependencies
 and ansure that dependencies can be loaded and unloaded in the proper order.
- Version:
- CVS $ Revision: 1.1 $
- Author:
- Avalon Development Team
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> intfindVertex(List<Vertex<T>> vertexList, String name) static <T> voidresetVertices(List<Vertex<T>> vertices) Resets all the vertices so that the visitation flags and indegrees are reset to their start values.static <T> voidtopologicalSort(List<Vertex<T>> vertices) Sort a set of vertices so that no dependency is before its vertex.static <T> voidVerify a set of vertices and all their dependencies have no cycles.static <T> voidVerify that a vertex and its set of dependencies have no cycles.
- 
Constructor Details- 
DirectedAcyclicGraphVerifierpublic DirectedAcyclicGraphVerifier()
 
- 
- 
Method Details- 
verifyVerify that a vertex and its set of dependencies have no cycles.- Parameters:
- vertex- The vertex we want to test.
- Throws:
- CyclicDependencyException- if there is a cycle.
 
- 
verifyVerify a set of vertices and all their dependencies have no cycles. All Vertices in the graph must exist in the list.- Parameters:
- vertices- The list of vertices we want to test.
- Throws:
- CyclicDependencyException- if there is a cycle.
 
- 
topologicalSortSort a set of vertices so that no dependency is before its vertex. If we have a vertex named "Parent" and one named "Child" that is listed as a dependency of "Parent", we want to ensure that "Child" always comes after "Parent". As long as there are no cycles in the list, we can sort any number of vertices that may or may not be related. Both "Parent" and "Child" must exist in the vertices list, but "Child" will also be referenced as a dependency of "Parent".Implementation Detail: This particular algorithm is a more efficient variation of the typical Topological Sort algorithm. It uses a Queue (Linked List) to ensure that each edge (connection between two vertices) or vertex is checked only once. The efficiency is O = (|V| + |E|). - Parameters:
- vertices-
- Throws:
- CyclicDependencyException
 
- 
resetVerticesResets all the vertices so that the visitation flags and indegrees are reset to their start values.- Parameters:
- vertices-
 
- 
findVertex
 
-