blob: c126e41ff0680b124d1d5a5e589b3140d82b2c78 (
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
25
26
27
28
|
package cgeo.geocaching.sorting;
import cgeo.geocaching.cgCache;
/**
* sorts caches by number of items in inventory
* @author bananeweizen
*
*/
public class InventoryComparator extends AbstractCacheComparator {
@Override
protected boolean canCompare(cgCache cache1, cgCache cache2) {
return true;
}
@Override
protected int compareCaches(cgCache cache1, cgCache cache2) {
int itemCount1 = cache1.inventoryItems;
int itemCount2 = cache2.inventoryItems;
if (itemCount1 < itemCount2) {
return 1;
} else if (itemCount2 < itemCount1) {
return -1;
}
return 0;
}
}
|