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 TypeMethodDescriptiongetIncomingEdges
(T node) Returns any incoming edges (dependencies) from the given node.int
Retrieves the index previously stored into the node bysetIndex(Object, int)
.boolean
isTempMarked
(T node) Retrieves the state previously set the node bysetTempMarked(Object, boolean)
.void
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
The sort has already seen and added the node to the result. The index may be retrieved bygetIndex(Object)
.- Parameters:
node
- a node of the graphindex
- the index of the node in the result
-
getIndex
Retrieves the index previously stored into the node bysetIndex(Object, int)
. This method must return -1 initially, and return the actual index oncesetIndex(Object, int)
is called during the sort.- Parameters:
node
- a node of the graph- Returns:
- the index of the node in the result
-
setTempMarked
Sets a transient state to indicate that it is visited during sorting, used to check cyclic dependencies. The state may be retrieved byisTempMarked(Object)
.- Parameters:
node
- a node of the graphmarked
- whether the node is temporarily marked or not
-
isTempMarked
Retrieves the state previously set the node bysetTempMarked(Object, boolean)
.- Parameters:
node
- a node of the graph- Returns:
- whether the node is temporarily marked or not
-
getIncomingEdges
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
-