Package icyllis.arc3d.engine

# Class TopologicalSort

java.lang.Object
icyllis.arc3d.engine.TopologicalSort

public final class TopologicalSort extends Object
Provides a depth-first-search topological sort algorithm for simple directed acyclic graphs.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static interface`
  `TopologicalSort.Access<T>`
  The node access.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TopologicalSort()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static <T> void`
  `topologicalSort(List<T> graph, TopologicalSort.Access<T> access)`
  Topologically sort the nodes in 'graph'.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TopologicalSort

    public TopologicalSort()

- ## Method Details

  - ### topologicalSort

    public static <T> void topologicalSort(List<T> graph, TopologicalSort.Access<T> access)
    Topologically sort the nodes in 'graph'. For this sort, when node 'i' depends on node 'j' it means node 'j' must appear in the result before node 'i'.

    The graph to sort must be directed, must not allow self loops, and must not contain cycles. Otherwise, `IllegalStateException` will be thrown and the contents of 'graph' will be in some arbitrary state.

    Type Parameters:
      `T` - the node type of the graph
    Parameters:
      `graph` - the directed acyclic graph to sort
      `access` - the node access
    Throws:
      `IllegalStateException` - if the graph contains loops