apply method

  1. @mustCallSuper
void apply()

Commits the edge prepared by prepare.

Implementation

@mustCallSuper
void apply() {
  final next = occupancy + (_push ? 1 : 0) - (_pop ? 1 : 0);
  final range = _maxOccupancy + 1;
  occupancy = next > _maxOccupancy
      ? (next - _maxOccupancy - 1) % range
      : next < 0
          ? _maxOccupancy - ((-next - 1) % range)
          : next;
  firstIndex = nextFirstIndex;
  if (_push) {
    lastIndex = _pushIndex;
  }
}