diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-06-11 20:00:50 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-06-11 20:00:50 +0200 |
| commit | e9283b50b4d3e15dffefe8a9b9eda7de5b7999e5 (patch) | |
| tree | e42cb85115fbc0a4cf88366dca7cb7ed79e8ff71 /main/src/cgeo/geocaching/Waypoint.java | |
| parent | 5d2ee349f514cf23ae174ccb3076f73bbc5b2d82 (diff) | |
| download | cgeo-e9283b50b4d3e15dffefe8a9b9eda7de5b7999e5.zip cgeo-e9283b50b4d3e15dffefe8a9b9eda7de5b7999e5.tar.gz cgeo-e9283b50b4d3e15dffefe8a9b9eda7de5b7999e5.tar.bz2 | |
fix #3927: do not sort stage, puzzle and waypoint
Diffstat (limited to 'main/src/cgeo/geocaching/Waypoint.java')
| -rw-r--r-- | main/src/cgeo/geocaching/Waypoint.java | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/main/src/cgeo/geocaching/Waypoint.java b/main/src/cgeo/geocaching/Waypoint.java index 275882f..18b055b 100644 --- a/main/src/cgeo/geocaching/Waypoint.java +++ b/main/src/cgeo/geocaching/Waypoint.java @@ -122,22 +122,26 @@ public class Waypoint implements IWaypoint { } private int computeOrder() { + // first parking, then trailhead (as start of the journey) + // puzzles, stages, waypoints can all be mixed + // at last the final and the original coordinates of the final switch (waypointType) { case PARKING: return -1; case TRAILHEAD: return 1; - case STAGE: // puzzles and stages with same value - return 2; + case STAGE: case PUZZLE: + case WAYPOINT: return 2; case FINAL: return 3; - case OWN: + case ORIGINAL: return 4; - default: - return 0; + case OWN: + return 5; } + return 0; } private int order() { @@ -151,7 +155,7 @@ public class Waypoint implements IWaypoint { return prefix; } - public void setPrefix(String prefix) { + public void setPrefix(final String prefix) { this.prefix = prefix; cachedOrder = ORDER_UNDEFINED; } @@ -165,7 +169,7 @@ public class Waypoint implements IWaypoint { return id; } - public void setId(int id) { + public void setId(final int id) { this.id = id; } @@ -174,7 +178,7 @@ public class Waypoint implements IWaypoint { return geocode; } - public void setGeocode(String geocode) { + public void setGeocode(final String geocode) { this.geocode = StringUtils.upperCase(geocode); } @@ -187,7 +191,7 @@ public class Waypoint implements IWaypoint { return lookup; } - public void setLookup(String lookup) { + public void setLookup(final String lookup) { this.lookup = lookup; } @@ -196,7 +200,7 @@ public class Waypoint implements IWaypoint { return name; } - public void setName(String name) { + public void setName(final String name) { this.name = name; } @@ -204,7 +208,7 @@ public class Waypoint implements IWaypoint { return latlon; } - public void setLatlon(String latlon) { + public void setLatlon(final String latlon) { this.latlon = latlon; } @@ -213,7 +217,7 @@ public class Waypoint implements IWaypoint { return coords; } - public void setCoords(Geopoint coords) { + public void setCoords(final Geopoint coords) { this.coords = coords; } @@ -221,7 +225,7 @@ public class Waypoint implements IWaypoint { return note; } - public void setNote(String note) { + public void setNote(final String note) { this.note = note; } @@ -244,7 +248,7 @@ public class Waypoint implements IWaypoint { return "waypoint"; } - public void setVisited(boolean visited) { + public void setVisited(final boolean visited) { this.visited = visited; } @@ -267,7 +271,7 @@ public class Waypoint implements IWaypoint { public static final Comparator<? super Waypoint> WAYPOINT_COMPARATOR = new Comparator<Waypoint>() { @Override - public int compare(Waypoint left, Waypoint right) { + public int compare(final Waypoint left, final Waypoint right) { return left.order() - right.order(); } }; @@ -282,7 +286,7 @@ public class Waypoint implements IWaypoint { String gpxId = prefix; if (StringUtils.isNotBlank(geocode)) { - Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); + final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB); if (cache != null) { gpxId = cache.getWaypointGpxId(prefix); } |
