Map topological sort; used by vanilla to sort feature generation (#2711)

* Map topological sort; used by vanilla to sort feature generation

Signed-off-by: liach <liach@users.noreply.github.com>

* Update mappings/net/minecraft/util/TopologicalSorts.mapping

Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com>

* Update mappings/net/minecraft/util/TopologicalSorts.mapping

Co-authored-by: mschae23 <46165762+mschae23@users.noreply.github.com>

* Now this should be less confusing for "any"

* Update mappings/net/minecraft/util/TopologicalSorts.mapping

* Apply suggestions from code review

Co-authored-by: liach <liach@users.noreply.github.com>
Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com>
Co-authored-by: mschae23 <46165762+mschae23@users.noreply.github.com>
This commit is contained in:
liach 2021-10-03 06:52:08 -05:00 committed by GitHub
parent 8281f23728
commit 54912de905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
CLASS net/minecraft/class_6496 net/minecraft/util/TopologicalSorts
COMMENT Utilities to perform a topological sort.
METHOD method_37951 sort (Ljava/util/Map;Ljava/util/Set;Ljava/util/Set;Ljava/util/function/Consumer;Ljava/lang/Object;)Z
COMMENT Performs a topological sort recursively through a reverse DFS. The
COMMENT results are passed to the consumer in reverse order, where each element
COMMENT is guaranteed to be passed before any of its predecessors (dependencies).
COMMENT When multiple orders are valid, the results will first trace along earlier
COMMENT returned successors in the successor set iteration for each element.
COMMENT
COMMENT @return {@code true} if the sort ends up in a loop, or {@code false} for
COMMENT a successful sort
ARG 0 successors
COMMENT the map holding information on successor (dependents) of each element
ARG 1 visited
COMMENT elements that already iterated all their successors
ARG 2 visiting
COMMENT elements that are still iterating their successors
ARG 3 reversedOrderConsumer
COMMENT accepts sorted results in reverse order; each element is passed only
COMMENT before any of its predecessors (dependencies) is, or after all its
COMMENT successors (dependents) are passed
ARG 4 now
COMMENT the starting or current element