isEmpty method

  1. @nonVirtual
bool isEmpty(
  1. int segmentIndex
)

Implementation

@nonVirtual
bool isEmpty(int segmentIndex) {
  // Handle sortedIndex for finding the empty point segment,
  // when segment rearrange with sorting.
  segmentIndex =
      sortedIndexes.isNotEmpty ? sortedIndexes[segmentIndex] : segmentIndex;
  int start = 0;
  int end = emptyPointIndexes.length - 1;
  while (start <= end) {
    final int mid = (start + end) ~/ 2;
    if (emptyPointIndexes[mid] == segmentIndex) {
      return true;
    } else if (emptyPointIndexes[mid] < segmentIndex) {
      start = mid + 1;
    } else {
      end = mid - 1;
    }
  }

  return false;
}