aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/sorting/PopularityComparator.java
blob: 62ad9a9c81a310e55ed57f8825d5de42ecbf6b1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package cgeo.geocaching.sorting;

import cgeo.geocaching.cgCache;

/**
 * sorts caches by popularity (favorite count)
 *
 */
public class PopularityComparator extends AbstractCacheComparator {

    @Override
    protected boolean canCompare(final cgCache cache1, final cgCache cache2) {
        return true;
    }

    @Override
    protected int compareCaches(final cgCache cache1, final cgCache cache2) {
        return cache2.getFavoritePoints() - cache1.getFavoritePoints();
    }
}