diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2012-04-28 12:04:36 +0200 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2012-04-28 13:30:05 +0200 |
commit | 49716bc6a97ca76ff2b0ff90f0b06d826a1a6220 (patch) | |
tree | 1cb1317993cf4616c07348cc55d9cb7e52e6a306 /main/src/cgeo/geocaching/apps/cache | |
parent | b3c534f8c7b4d42819960486bb1942b109d877f8 (diff) | |
download | cgeo-49716bc6a97ca76ff2b0ff90f0b06d826a1a6220.zip cgeo-49716bc6a97ca76ff2b0ff90f0b06d826a1a6220.tar.gz cgeo-49716bc6a97ca76ff2b0ff90f0b06d826a1a6220.tar.bz2 |
Refactoring: remove unnecessary else statements
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache')
-rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java index c5abf7f..16b641e 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java @@ -46,13 +46,24 @@ abstract class AbstractPointNavigationApp extends AbstractNavigationApp { protected abstract void navigate(Activity activity, Geopoint point); - private static Geopoint getCoordinates(cgCache cache, cgWaypoint waypoint, Geopoint coords) { + /** + * Return the first of the cache coordinates, the waypoint coordinates or the extra coordinates. <code>null</code> + * entities are skipped. + * + * @param cache a cache + * @param waypoint a waypoint + * @param coords extra coordinates + * @return the first non-null coordinates, or null if none are set + */ + private static Geopoint getCoordinates(final cgCache cache, final cgWaypoint waypoint, final Geopoint coords) { if (cache != null && cache.getCoords() != null) { return cache.getCoords(); } - else if (waypoint != null && waypoint.getCoords() != null) { + + if (waypoint != null && waypoint.getCoords() != null) { return waypoint.getCoords(); } + return coords; } }
\ No newline at end of file |