Package net.minecraft.util
Class TopologicalSorts
java.lang.Object
net.minecraft.util.TopologicalSorts
Utilities to perform a topological sort.
- Mappings:
Namespace Name official aoqintermediary net/minecraft/class_6496named net/minecraft/util/TopologicalSorts
-
Constructor Summary
Constructors -
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:
trueif the sort ends up in a loop, orfalsefor a successful sort- Mappings:
Namespace Name Mixin selector official aLaoq;a(Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/function/Consumer;Ljava/lang/Object;)Zintermediary method_37951Lnet/minecraft/class_6496;method_37951(Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/function/Consumer;Ljava/lang/Object;)Znamed sortLnet/minecraft/util/TopologicalSorts;sort(Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/function/Consumer;Ljava/lang/Object;)Z
-