boolean (@NotNull VFileEvent event, @NotNull String path, @NotNull MostlySingularMultiMap<String, VFileEvent> files, @NotNull Set<? super String> middleDirs) { boolean canReconcileEvents = true; for (VFileEvent prev : files.get(path)) { if (!(isContentChangeLikeHarmlessEvent(event) && isContentChangeLikeHarmlessEvent(prev))) { canReconcileEvents = false; break; } } if (!canReconcileEvents) { // conflicting event found for (non-strict) descendant, stop return true; } if (middleDirs.contains(path)) { // conflicting event found for (non-strict) descendant, stop return true; } files.add(path, event); int li = path.length(); while (true) { int liPrev = path.lastIndexOf('/', li - 1); if (liPrev == -1) break; String parentDir = path.substring(0, liPrev); if (files.containsKey(parentDir)) { // conflicting event found for the ancestor, stop return true; } if (!middleDirs.add(parentDir)) break; // all parents are already stored; stop li = liPrev; } return false; }