int (@NotNull IntervalTreeImpl.IntervalNode<T> i1, @NotNull IntervalTreeImpl.IntervalNode<T> i2) { RMNode<?> o1 = (RMNode<?>)i1; RMNode<?> o2 = (RMNode<?>)i2; boolean greedyL1 = o1.isGreedyToLeft(); boolean greedyL2 = o2.isGreedyToLeft(); if (greedyL1 != greedyL2) return greedyL1 ? -1 : 1; int o1Length = o1.intervalEnd() - o1.intervalStart(); int o2Length = o2.intervalEnd() - o2.intervalStart(); int d = o1Length - o2Length; if (d != 0) return d; boolean greedyR1 = o1.isGreedyToRight(); boolean greedyR2 = o2.isGreedyToRight(); if (greedyR1 != greedyR2) return greedyR1 ? -1 : 1; boolean stickyR1 = o1.isStickingToRight(); boolean stickyR2 = o2.isStickingToRight(); if (stickyR1 != stickyR2) return stickyR1 ? -1 : 1; return 0; }