From c61f8b728e62e4e86e304956af7bc41b1839017f Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Tue, 1 May 2012 15:06:46 +0200 Subject: fix #1479: option to delete old caches --- .../geocaching/sorting/StorageTimeComparator.java | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 main/src/cgeo/geocaching/sorting/StorageTimeComparator.java (limited to 'main/src/cgeo/geocaching/sorting') diff --git a/main/src/cgeo/geocaching/sorting/StorageTimeComparator.java b/main/src/cgeo/geocaching/sorting/StorageTimeComparator.java new file mode 100644 index 0000000..32bef32 --- /dev/null +++ b/main/src/cgeo/geocaching/sorting/StorageTimeComparator.java @@ -0,0 +1,23 @@ +package cgeo.geocaching.sorting; + +import cgeo.geocaching.cgCache; + +public class StorageTimeComparator extends AbstractCacheComparator { + + @Override + protected boolean canCompare(cgCache cache1, cgCache cache2) { + return true; + } + + @Override + protected int compareCaches(cgCache cache1, cgCache cache2) { + if (cache1.getUpdated() < cache2.getUpdated()) { + return -1; + } + if (cache1.getUpdated() > cache2.getUpdated()) { + return 1; + } + return 0; + } + +} -- cgit v1.1