aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching')
-rw-r--r--main/src/cgeo/geocaching/Waypoint.java36
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);
}