SearchAlgorithm<P extends GpsPoint, C extends GpsPointsView<P>, F> class abstract

Abstract class representing a search algorithm looking for entities of type P in a collection of type C. The entity of type P will be identified based on find-target data of type F.

For example if looking for items of type GpsStay with a specific GpsStay.endTime in a GpcCompactGpsStay, the types will be:

Implementers

Constructors

SearchAlgorithm(C collection, SearchCompareDiff<C, F> compareDiff)
Constructor for the algorithm. It's necessary to bind both the collection and the compareDiff, because an algorithm created for one list cannot necessarily be used in another list.

Properties

collection → C
The collection on which the search will be performed.
final
compareDiff SearchCompareDiff<C, F>
The comparison function that will be used to identify the desired item.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

find(F target, [num? tolerance, int start = 0, int? end]) int?
Tries to find and return the item index between start and end for which the compareDiff returns TimeComparisonResult.same or TimeComparisonResult.overlapping, or that is within tolerance from target. If such an item is not fount, the function null.
findUnsafe(F target, num? tolerance, int start, int end) int?
Internal implementation for find, which does not do any validity checks on its arguments. Not to be called directly.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

getBestAlgorithm<P extends GpsPoint, C extends GpsPointsView<P>, F>(C collection, bool isSorted, SearchCompareDiff<C, F> compareDiff) SearchAlgorithm<GpsPoint, GpsPointsView<GpsPoint>, dynamic>
Determines which algorithm is best suited for the search in the given collection.