aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/cgCache.java29
-rw-r--r--main/src/cgeo/geocaching/cgWaypoint.java8
2 files changed, 15 insertions, 22 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index f49dffe..e308209 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -113,8 +113,9 @@ public class cgCache implements ICache {
* Sends a change notification to interested parties
*/
private void notifyChange() {
- if (changeNotificationHandler != null)
+ if (changeNotificationHandler != null) {
changeNotificationHandler.sendEmptyMessage(0);
+ }
}
/**
@@ -920,7 +921,7 @@ public class cgCache implements ICache {
if (waypoints != null) {
for (cgWaypoint waypoint : waypoints) {
waypoint.setGeocode(geocode);
- if (isFinalWithCoords(waypoint)) {
+ if (waypoint.isFinalWithCoords()) {
finalDefined = true;
}
}
@@ -1125,7 +1126,7 @@ public class cgCache implements ICache {
}
waypoints.add(waypoint);
waypoint.setGeocode(geocode);
- if (isFinalWithCoords(waypoint)) {
+ if (waypoint.isFinalWithCoords()) {
finalDefined = true;
}
}
@@ -1143,23 +1144,6 @@ public class cgCache implements ICache {
this.finalDefined = finalDefined;
}
- /**
- * Checks whether a given waypoint is a final and has coordinates
- *
- * @param waypoint
- * Waypoint to check
- * @return True - waypoint is final and has coordinates, False - otherwise
- */
- private static boolean isFinalWithCoords(cgWaypoint waypoint) {
- if (null != waypoint.getWaypointType() && WaypointType.FINAL == waypoint.getWaypointType()) {
- if (null != waypoint.getCoords()) {
- return true;
- }
- }
-
- return false;
- }
-
public boolean hasUserModifiedCoords() {
return userModifiedCoords;
}
@@ -1209,11 +1193,12 @@ public class cgCache implements ICache {
cgeoapplication.getInstance().deleteWaypoint(waypoint.getId());
cgeoapplication.getInstance().removeCache(geocode, EnumSet.of(RemoveFlag.REMOVE_CACHE));
// Check status if Final is defined
- if (isFinalWithCoords(waypoint)) {
+ if (waypoint.isFinalWithCoords()) {
finalDefined = false;
for (cgWaypoint wp : waypoints) {
- if (isFinalWithCoords(wp)) {
+ if (wp.isFinalWithCoords()) {
finalDefined = true;
+ break;
}
}
}
diff --git a/main/src/cgeo/geocaching/cgWaypoint.java b/main/src/cgeo/geocaching/cgWaypoint.java
index 5c926db..7287d2d 100644
--- a/main/src/cgeo/geocaching/cgWaypoint.java
+++ b/main/src/cgeo/geocaching/cgWaypoint.java
@@ -236,4 +236,12 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> {
return name + " " + waypointType.getL10n();
}
+ /**
+ * Checks whether a given waypoint is a final and has coordinates
+ *
+ * @return True - waypoint is final and has coordinates, False - otherwise
+ */
+ public boolean isFinalWithCoords() {
+ return WaypointType.FINAL == getWaypointType() && null != getCoords();
+ }
} \ No newline at end of file