diff options
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/cgCache.java | 23 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/files/GPXParser.java | 5 |
2 files changed, 23 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java index 76dca5b..230e84e 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/cgCache.java @@ -19,6 +19,7 @@ import cgeo.geocaching.enumerations.LoadFlags.RemoveFlag; import cgeo.geocaching.enumerations.LoadFlags.SaveFlag; import cgeo.geocaching.enumerations.LogType; import cgeo.geocaching.enumerations.WaypointType; +import cgeo.geocaching.files.GPXParser; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.network.HtmlImage; import cgeo.geocaching.utils.CancellableHandler; @@ -130,6 +131,26 @@ public class cgCache implements ICache, IWaypoint { private Handler changeNotificationHandler = null; + /** + * Create a new cache. To be used everywhere except for the GPX parser + */ + public cgCache() { + // empty + } + + /** + * Cache constructor to be used by the GPX parser only. This constructor explicitly sets several members to empty + * lists. + * + * @param gpxParser + */ + public cgCache(GPXParser gpxParser) { + setReliableLatLon(true); + setAttributes(Collections.<String> emptyList()); + setWaypoints(Collections.<cgWaypoint> emptyList(), false); + setLogs(Collections.<LogEntry> emptyList()); + } + public void setChangeNotificationHandler(Handler newNotificationHandler) { changeNotificationHandler = newNotificationHandler; } @@ -1612,4 +1633,4 @@ public class cgCache implements ICache, IWaypoint { } return result; } -}
\ No newline at end of file +} diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java index 879814e..c451ad5 100644 --- a/main/src/cgeo/geocaching/files/GPXParser.java +++ b/main/src/cgeo/geocaching/files/GPXParser.java @@ -854,10 +854,7 @@ public abstract class GPXParser extends FileParser { desc = null; cmt = null; - cache = new cgCache(); - cache.setReliableLatLon(true); - cache.setAttributes(new ArrayList<String>()); - cache.setWaypoints(new ArrayList<cgWaypoint>(), false); + cache = new cgCache(this); for (int i = 0; i < userData.length; i++) { userData[i] = null; } |
