Package icyllis.arc3d.engine

# Interface TopologicalSort.Access<T>

Type Parameters:
  `T` - the node type of the graph

Enclosing class:
  `TopologicalSort`

public static interface TopologicalSort.Access<T>
The node access. This removes the overhead of creating new data structures and searching for elements.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Collection<T>`
  `getIncomingEdges(T node)`
  Returns any incoming edges (dependencies) from the given node.
  `int`
  `getIndex(T node)`
  Retrieves the index previously stored into the node by `setIndex(Object, int)`.
  `boolean`
  `isTempMarked(T node)`
  Retrieves the state previously set the node by `setTempMarked(Object, boolean)`.
  `void`
  `setIndex(T node, int index)`
  The sort has already seen and added the node to the result.
  `void`
  `setTempMarked(T node, boolean marked)`
  Sets a transient state to indicate that it is visited during sorting, used to check cyclic dependencies.

- ## Method Details

  - ### setIndex

    void setIndex(T node, int index)
    The sort has already seen and added the node to the result. The index may be retrieved by `getIndex(Object)`.
    Parameters:
      `node` - a node of the graph
      `index` - the index of the node in the result

  - ### getIndex

    int getIndex(T node)
    Retrieves the index previously stored into the node by `setIndex(Object, int)`. This method must return -1 initially, and return the actual index once `setIndex(Object, int)` is called during the sort.
    Parameters:
      `node` - a node of the graph
    Returns:
      the index of the node in the result

  - ### setTempMarked

    void setTempMarked(T node, boolean marked)
    Sets a transient state to indicate that it is visited during sorting, used to check cyclic dependencies. The state may be retrieved by `isTempMarked(Object)`.
    Parameters:
      `node` - a node of the graph
      `marked` - whether the node is temporarily marked or not

  - ### isTempMarked

    boolean isTempMarked(T node)
    Retrieves the state previously set the node by `setTempMarked(Object, boolean)`.
    Parameters:
      `node` - a node of the graph
    Returns:
      whether the node is temporarily marked or not

  - ### getIncomingEdges

    Collection<T> getIncomingEdges(T node)
    Returns any incoming edges (dependencies) from the given node.
    Parameters:
      `node` - a node of the graph
    Returns:
      a list containing any incoming edges, or null if there are none