void (@NotNull T interval, boolean assertInvalid) { IntervalNode<T> root = lookupNode(interval); if (root == null) return; //noinspection NumberEquality assert root.getTree() == this : root.getTree() + " ("+root.getTree().getClass()+")"+ "; this: "+this + "("+getClass()+")"; if (!VERIFY) return; if (assertInvalid) { assert !root.intervals.isEmpty(); boolean contains = false; for (int i = root.intervals.size() - 1; i >= 0; i--) { T key = root.intervals.get(i).get(); if (key == null) continue; contains |= key == interval; IntervalNode<T> node = lookupNode(key); assert node == root : node; //noinspection NumberEquality assert node.getTree() == this : node; } assert contains : root.intervals + "; " + interval; } IntervalNode<T> e = root; while (e.getParent() != null) e = e.getParent(); assert e == getRoot(); // assert the node belongs to our tree }