void (@NotNull ScheduledPass pass, Map<ScheduledPass, Pair<ScheduledPass, Integer>> id2Visits) { for (ScheduledPass successor : ContainerUtil.concat(pass.mySuccessorsOnCompletion, pass.mySuccessorsOnSubmit)) { Pair<ScheduledPass, Integer> pair = id2Visits.get(successor); if (pair == null) { pair = Pair.create(successor, successor.myRunningPredecessorsCount.get()); id2Visits.put(successor, pair); } int newPred = pair.second - 1; id2Visits.put(successor, Pair.create(successor, newPred)); assert newPred >= 0; if (newPred == 0) { checkConsistency(successor, id2Visits); } } }