removeContiguousRange method

void removeContiguousRange(
  1. int start,
  2. int endExclusive
)

Intention-revealing bulk removal of the contiguous range [start, endExclusive): clears each removed entry's reverse-index slot, removes the physical range, and reindexes the shifted suffix. That is the whole contiguous-removal protocol in one owner. Subtree-size cache decrements follow removeRange's suppression contract.

Implementation

void removeContiguousRange(int start, int endExclusive) {
  final end = endExclusive < _len ? endExclusive : _len;
  for (int i = start; i < end; i++) {
    final nid = _orderNids[i];
    if (nid >= 0 && nid < _indexByNid.length) {
      _indexByNid[nid] = kNotVisible;
    }
  }
  removeRange(start, endExclusive);
  reindexFrom(start);
}