compareItemToTime function
Compares an item at a specific position in collection
to a given time
,
returning -1 if the item in the collection
is before time
, 0 if they're
the same or overlapping, and 1 if the item in the collection
is
after time
.
Implementation
int compareItemToTime(GpsPointsView collection, int itemNr, GpsTime time) {
final result = collection.compareElementTimeWithSeparateTime(itemNr, time);
switch (result) {
case TimeComparisonResult.before:
return -1;
// same and overlapping both count as matches.
case TimeComparisonResult.same:
case TimeComparisonResult.overlapping:
return 0;
case TimeComparisonResult.after:
return 1;
}
}