cpw.mods.fml.common.toposort
Class TopologicalSort

java.lang.Object
  extended by cpw.mods.fml.common.toposort.TopologicalSort

public class TopologicalSort
extends Object

Topological sort for mod loading Based on a variety of sources, including http://keithschwarz.com/interesting/code/?dir=topological-sort

Author:
cpw

Nested Class Summary
static class TopologicalSort.DirectedGraph<T>
           
 
Constructor Summary
TopologicalSort()
           
 
Method Summary
static
<T> void
explore(T node, TopologicalSort.DirectedGraph<T> graph, List<T> sortedResult, Set<T> visitedNodes, Set<T> expandedNodes)
           
static
<T> TopologicalSort.DirectedGraph<T>
reverse(TopologicalSort.DirectedGraph<T> graph)
           
static
<T> List<T>
topologicalSort(TopologicalSort.DirectedGraph<T> graph)
          Sort the input graph into a topologically sorted list Uses the reverse depth first search as outlined in ...
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TopologicalSort

public TopologicalSort()
Method Detail

topologicalSort

public static <T> List<T> topologicalSort(TopologicalSort.DirectedGraph<T> graph)
Sort the input graph into a topologically sorted list Uses the reverse depth first search as outlined in ...

Parameters:
graph -
Returns:
The sorted mods list.

reverse

public static <T> TopologicalSort.DirectedGraph<T> reverse(TopologicalSort.DirectedGraph<T> graph)

explore

public static <T> void explore(T node,
                               TopologicalSort.DirectedGraph<T> graph,
                               List<T> sortedResult,
                               Set<T> visitedNodes,
                               Set<T> expandedNodes)