aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
diff options
context:
space:
mode:
authorSammysHP <sven@sammyshp.de>2011-09-14 21:42:32 +0200
committerSammysHP <sven@sammyshp.de>2011-09-14 21:42:32 +0200
commit4f7c67407019de18fd53b640edb9682a346fbfef (patch)
tree5a1d10843e8f5104e4202211f4792b5bfe830cb6 /src/cgeo/geocaching/sorting/AbstractCacheComparator.java
parent90e7bf968f6722b8df8b884f37617e7fc78901b5 (diff)
downloadcgeo-4f7c67407019de18fd53b640edb9682a346fbfef.zip
cgeo-4f7c67407019de18fd53b640edb9682a346fbfef.tar.gz
cgeo-4f7c67407019de18fd53b640edb9682a346fbfef.tar.bz2
Formatting
Diffstat (limited to 'src/cgeo/geocaching/sorting/AbstractCacheComparator.java')
-rw-r--r--src/cgeo/geocaching/sorting/AbstractCacheComparator.java62
1 files changed, 33 insertions, 29 deletions
diff --git a/src/cgeo/geocaching/sorting/AbstractCacheComparator.java b/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
index 4630888..a7a3336 100644
--- a/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
+++ b/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
@@ -1,42 +1,46 @@
package cgeo.geocaching.sorting;
-import android.util.Log;
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;
- }
+ @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);
+ /**
+ * 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);
+ /**
+ * 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);
}