aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2011-09-16 14:36:28 +0200
committerSamuel Tardieu <sam@rfc1149.net>2011-09-16 14:36:28 +0200
commit579ef7a535489d4aa632db11667a3b01deb6cafd (patch)
tree55810021c02ac7d80d3a9702ef0b59e4af154b9c /src/cgeo/geocaching/sorting/AbstractCacheComparator.java
parent96ea21fd50334479c262da692038965d0e4d596a (diff)
downloadcgeo-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/AbstractCacheComparator.java')
-rw-r--r--src/cgeo/geocaching/sorting/AbstractCacheComparator.java46
1 files changed, 0 insertions, 46 deletions
diff --git a/src/cgeo/geocaching/sorting/AbstractCacheComparator.java b/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
deleted file mode 100644
index 03db8df..0000000
--- a/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package cgeo.geocaching.sorting;
-
-import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgSettings;
-
-import android.util.Log;
-
-/**
- * abstract super implementation for all cache comparators
- *
- */
-public abstract class AbstractCacheComparator implements CacheComparator {
-
- @Override
- public final int compare(cgCache cache1, cgCache cache2) {
- try {
- // first check that we have all necessary data for the comparison
- if (!canCompare(cache1, cache2)) {
- return 0;
- }
- return compareCaches(cache1, cache2);
- } catch (Exception e) {
- Log.e(cgSettings.tag, "AbstractCacheComparator.compare: " + e.toString());
- }
- return 0;
- }
-
- /**
- * check necessary preconditions (like missing fields) before running the comparison itself
- *
- * @param cache1
- * @param cache2
- * @return
- */
- protected abstract boolean canCompare(final cgCache cache1, final cgCache cache2);
-
- /**
- * compares two caches. Logging and exception handling is implemented outside this method already.
- *
- * @param cache1
- * @param cache2
- * @return an integer < 0 if cache1 is less than cache2, 0 if they are equal, and > 0 if cache1 is greater than
- * cache2.
- */
- protected abstract int compareCaches(final cgCache cache1, final cgCache cache2);
-}