/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.google.common.collect.ImmutableSet */ package net.minecraft.util; import com.google.common.collect.ImmutableSet; import java.util.Map; import java.util.Set; import java.util.function.Consumer; public final class Graph { private Graph() { } public static boolean depthFirstSearch(Map> edges, Set discovered, Set currentlyVisiting, Consumer reverseTopologicalOrder, T current) { if (discovered.contains(current)) { return false; } if (currentlyVisiting.contains(current)) { return true; } currentlyVisiting.add(current); for (Object next : (Set)edges.getOrDefault(current, (Set)ImmutableSet.of())) { if (!Graph.depthFirstSearch(edges, discovered, currentlyVisiting, reverseTopologicalOrder, next)) continue; return true; } currentlyVisiting.remove(current); discovered.add(current); reverseTopologicalOrder.accept(current); return false; } }