blob: efeeb5db8726fa7bbdae45cd2cf3512befbae571 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
package cgeo.geocaching.sorting;
import cgeo.geocaching.Geocache;
/**
* Compares caches by date. Used only for event caches.
*/
public class EventDateComparator extends DateComparator {
final static public EventDateComparator singleton = new EventDateComparator();
@Override
protected int sortSameDate(final Geocache left, final Geocache right) {
return compare(left.guessEventTimeMinutes(), right.guessEventTimeMinutes());
}
/**
* copy of {@link Integer#compare(int, int)}, as that is not available on lower API levels
*
*/
private static int compare(final int left, final int right) {
return left < right ? -1 : (left == right ? 0 : 1);
}
}
|