Package net.minecraft.util
Class TopologicalSorts
java.lang.Object
net.minecraft.util.TopologicalSorts
Utilities to perform a topological sort.
- Mappings:
Namespace Name official aoq
intermediary net/minecraft/class_6496
named net/minecraft/util/TopologicalSorts
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
TopologicalSorts
private TopologicalSorts()
-
-
Method Details
-
sort
public static <T> boolean sort(Map<T, Set<T>> successors, Set<T> visited, Set<T> visiting, Consumer<T> reversedOrderConsumer, T now) Performs a topological sort recursively through a reverse DFS. The results are passed to the consumer in reverse order, where each element is guaranteed to be passed before any of its predecessors (dependencies). When multiple orders are valid, the results will first trace along earlier returned successors in the successor set iteration for each element.- Parameters:
successors
- the map holding information on successor (dependents) of each elementvisited
- elements that already iterated all their successorsvisiting
- elements that are still iterating their successorsreversedOrderConsumer
- accepts sorted results in reverse order; each element is passed only before any of its predecessors (dependencies) is, or after all its successors (dependents) are passednow
- the starting or current element- Returns:
true
if the sort ends up in a loop, orfalse
for a successful sort- Mappings:
Namespace Name Mixin selector official a
Laoq;a(Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/function/Consumer;Ljava/lang/Object;)Z
intermediary method_37951
Lnet/minecraft/class_6496;method_37951(Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/function/Consumer;Ljava/lang/Object;)Z
named sort
Lnet/minecraft/util/TopologicalSorts;sort(Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/function/Consumer;Ljava/lang/Object;)Z
-