diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2011-09-16 14:36:28 +0200 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2011-09-16 14:36:28 +0200 |
| commit | 579ef7a535489d4aa632db11667a3b01deb6cafd (patch) | |
| tree | 55810021c02ac7d80d3a9702ef0b59e4af154b9c /src/cgeo/geocaching/sorting/RatingComparator.java | |
| parent | 96ea21fd50334479c262da692038965d0e4d596a (diff) | |
| download | cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.zip cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.tar.gz cgeo-579ef7a535489d4aa632db11667a3b01deb6cafd.tar.bz2 | |
Move sources into the main directory
This prepares the inclusion of tests into the same repository.
Diffstat (limited to 'src/cgeo/geocaching/sorting/RatingComparator.java')
| -rw-r--r-- | src/cgeo/geocaching/sorting/RatingComparator.java | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/cgeo/geocaching/sorting/RatingComparator.java b/src/cgeo/geocaching/sorting/RatingComparator.java deleted file mode 100644 index b7140c6..0000000 --- a/src/cgeo/geocaching/sorting/RatingComparator.java +++ /dev/null @@ -1,36 +0,0 @@ -package cgeo.geocaching.sorting; - -import cgeo.geocaching.cgCache; - -/** - * sorts caches by gcvote.com rating - * - */ -public class RatingComparator extends AbstractCacheComparator { - - @Override - protected boolean canCompare(cgCache cache1, cgCache cache2) { - return cache1.rating != null && cache2.rating != null; - } - - @Override - protected int compareCaches(cgCache cache1, cgCache cache2) { - Float rating1 = cache1.rating; - Float rating2 = cache2.rating; - - // voting can be disabled for caches, then assume an average rating instead - if (rating1 == 0.0) { - rating1 = 2.5f; - } - if (rating2 == 0.0) { - rating2 = 2.5f; - } - - if (rating1 < rating2) { - return 1; - } else if (rating2 < rating1) { - return -1; - } - return 0; - } -}
\ No newline at end of file |
