compareElementTimeWithSeparateItem method

  1. @override
TimeComparisonResult compareElementTimeWithSeparateItem(
  1. int elementNrA,
  2. GpsStay elementB
)
override

Performs compareTime for the item in the positions elementNrA and some separate elementB that's presumably not in the list, then returns the result.

Children my override this method to implement more efficient or custom algorithms, for example if they support overlapping time or if they have a way to do quick time comparisons without doing full item retrieval.

Implementation

@override
TimeComparisonResult compareElementTimeWithSeparateItem(
    int elementNrA, GpsStay elementB) {
  // See documentation of compareElementTime for what the various rules are.
  // This implementation is effectively a copypaste operation, for speed
  // reasons.
  final startA = _getUint32(_elementNrToByteOffset(elementNrA));
  final endA =
      _getUint32(_elementNrToByteOffset(elementNrA) + _offsetEndTime);
  final startB = Conversions.gpsTimeToUint32(elementB.time);
  final endB = Conversions.gpsTimeToUint32(elementB.endTime);

  return compareTimeSpans(
      startA: startA, endA: endA, startB: startB, endB: endB);
}