diff options
Diffstat (limited to 'main/src/cgeo/geocaching/connector/oc')
6 files changed, 33 insertions, 33 deletions
diff --git a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java index 5776c12..5cba53d 100644 --- a/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java +++ b/main/src/cgeo/geocaching/connector/oc/OC11XMLParser.java @@ -1,10 +1,10 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Image; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; @@ -53,7 +53,7 @@ public class OC11XMLParser { private static ImageHolder imageHolder = null; private static class CacheHolder { - public cgCache cache; + public Geocache cache; public String latitude; public String longitude; } @@ -177,7 +177,7 @@ public class OC11XMLParser { } } - private static void setCacheStatus(final int statusId, final cgCache cache) { + private static void setCacheStatus(final int statusId, final Geocache cache) { switch (statusId) { case 1: cache.setArchived(false); @@ -195,7 +195,7 @@ public class OC11XMLParser { } private static void resetCache(final CacheHolder cacheHolder) { - cacheHolder.cache = new cgCache(null); + cacheHolder.cache = new Geocache(null); cacheHolder.cache.setReliableLatLon(true); cacheHolder.cache.setDescription(StringUtils.EMPTY); cacheHolder.latitude = "0.0"; @@ -216,9 +216,9 @@ public class OC11XMLParser { protected static int attributeId; - public static Collection<cgCache> parseCaches(final InputStream stream) throws IOException { + public static Collection<Geocache> parseCaches(final InputStream stream) throws IOException { - final Map<String, cgCache> caches = new HashMap<String, cgCache>(); + final Map<String, Geocache> caches = new HashMap<String, Geocache>(); final Map<String, LogEntry> logs = new HashMap<String, LogEntry>(); final CacheHolder cacheHolder = new CacheHolder(); @@ -242,7 +242,7 @@ public class OC11XMLParser { @Override public void end() { - cgCache cache = cacheHolder.cache; + Geocache cache = cacheHolder.cache; Geopoint coords = new Geopoint(cacheHolder.latitude, cacheHolder.longitude); cache.setCoords(coords); if (caches.size() < CACHE_PARSE_LIMIT && isValid(cache) && !isExcluded(cache)) { @@ -251,7 +251,7 @@ public class OC11XMLParser { } } - private boolean isExcluded(cgCache cache) { + private boolean isExcluded(Geocache cache) { if (cache.isArchived() && Settings.isExcludeDisabledCaches()) { return true; } @@ -261,7 +261,7 @@ public class OC11XMLParser { return !Settings.getCacheType().contains(cache); } - private boolean isValid(cgCache cache) { + private boolean isValid(Geocache cache) { return StringUtils.isNotBlank(cache.getGeocode()) && !cache.getCoords().equals(Geopoint.ZERO); } }); @@ -452,7 +452,7 @@ public class OC11XMLParser { @Override public void end() { - final cgCache cache = caches.get(descHolder.cacheId); + final Geocache cache = caches.get(descHolder.cacheId); if (cache != null) { cache.setShortdesc(descHolder.shortDesc); cache.setDescription(cache.getDescription() + descHolder.desc); @@ -514,7 +514,7 @@ public class OC11XMLParser { @Override public void end() { - final cgCache cache = caches.get(logHolder.cacheId); + final Geocache cache = caches.get(logHolder.cacheId); if (cache != null && logHolder.logEntry.type != LogType.UNKNOWN) { logs.put(logHolder.id, logHolder.logEntry); cache.getLogs().prepend(logHolder.logEntry); @@ -609,7 +609,7 @@ public class OC11XMLParser { @Override public void end() { if (imageHolder.isSpoiler) { - final cgCache cache = caches.get(imageHolder.objectId); + final Geocache cache = caches.get(imageHolder.objectId); if (cache != null) { Image spoiler = new Image(imageHolder.url, imageHolder.title); cache.addSpoiler(spoiler); diff --git a/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java b/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java index 74968e7..69cf8a4 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java +++ b/main/src/cgeo/geocaching/connector/oc/OCApiConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.SearchResult; -import cgeo.geocaching.cgCache; import cgeo.geocaching.connector.capability.ISearchByGeocode; import cgeo.geocaching.network.Parameters; import cgeo.geocaching.utils.CancellableHandler; @@ -21,14 +21,14 @@ public class OCApiConnector extends OCConnector implements ISearchByGeocode { } @Override - public String getLicenseText(final cgCache cache) { + public String getLicenseText(final Geocache cache) { // NOT TO BE TRANSLATED return "<a href=\"" + getCacheUrl(cache) + "\">" + getName() + "</a> data licensed under the Creative Commons BY-SA 3.0 License"; } @Override public SearchResult searchByGeocode(final String geocode, final String guid, final CancellableHandler handler) { - final cgCache cache = OkapiClient.getCache(geocode); + final Geocache cache = OkapiClient.getCache(geocode); if (cache == null) { return null; } diff --git a/main/src/cgeo/geocaching/connector/oc/OCConnector.java b/main/src/cgeo/geocaching/connector/oc/OCConnector.java index e290e51..661f506 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCConnector.java +++ b/main/src/cgeo/geocaching/connector/oc/OCConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.oc; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.connector.AbstractConnector; import cgeo.geocaching.enumerations.CacheRealm; @@ -34,7 +34,7 @@ public class OCConnector extends AbstractConnector { } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { return getCacheUrlPrefix() + cache.getGeocode(); } diff --git a/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java b/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java index 3a2f42e..69707b9 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java +++ b/main/src/cgeo/geocaching/connector/oc/OCXMLApiConnector.java @@ -1,8 +1,8 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.connector.capability.ISearchByCenter; import cgeo.geocaching.connector.capability.ISearchByGeocode; import cgeo.geocaching.connector.capability.ISearchByViewPort; @@ -21,7 +21,7 @@ public class OCXMLApiConnector extends OCConnector implements ISearchByGeocode, @Override public SearchResult searchByGeocode(final String geocode, final String guid, CancellableHandler handler) { - final cgCache cache = OCXMLClient.getCache(geocode); + final Geocache cache = OCXMLClient.getCache(geocode); if (cache == null) { return null; } diff --git a/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java b/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java index f438db0..3e4d5b6 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java +++ b/main/src/cgeo/geocaching/connector/oc/OCXMLClient.java @@ -1,6 +1,6 @@ package cgeo.geocaching.connector.oc; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; @@ -29,7 +29,7 @@ public class OCXMLClient { // Url for single cache requests // http://www.opencaching.de/xml/ocxml11.php?modifiedsince=20060320000000&user=0&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=0&session=0&doctype=0&charset=utf-8&wp=OCC9BE - public static cgCache getCache(final String geoCode) { + public static Geocache getCache(final String geoCode) { try { final Parameters params = getOCXmlQueryParameters(true, true, true); params.put("wp", geoCode); @@ -39,9 +39,9 @@ public class OCXMLClient { return null; } - Collection<cgCache> caches = OC11XMLParser.parseCaches(new GZIPInputStream(data)); + Collection<Geocache> caches = OC11XMLParser.parseCaches(new GZIPInputStream(data)); if (caches.iterator().hasNext()) { - cgCache cache = caches.iterator().next(); + Geocache cache = caches.iterator().next(); cgData.saveCache(cache, LoadFlags.SAVE_ALL); return cache; } @@ -52,7 +52,7 @@ public class OCXMLClient { } } - public static Collection<cgCache> getCachesAround(final Geopoint center, final double distance) { + public static Collection<Geocache> getCachesAround(final Geopoint center, final double distance) { try { final Parameters params = getOCXmlQueryParameters(false, false, false); params.put("lat", GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, center)); diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java index 508d0b5..dbcfea5 100644 --- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java +++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java @@ -1,8 +1,8 @@ package cgeo.geocaching.connector.oc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.Image; import cgeo.geocaching.LogEntry; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; @@ -68,7 +68,7 @@ final public class OkapiClient { private static final String SERVICE_NEAREST = "/okapi/services/caches/search/nearest"; - public static cgCache getCache(final String geoCode) { + public static Geocache getCache(final String geoCode) { final Parameters params = new Parameters("cache_code", geoCode, "fields", SERVICE_CACHE_FIELDS); final JSONObject data = request(ConnectorFactory.getConnector(geoCode), SERVICE_CACHE, params); @@ -79,7 +79,7 @@ final public class OkapiClient { return parseCache(data); } - public static List<cgCache> getCachesAround(final Geopoint center, IConnector connector) { + public static List<Geocache> getCachesAround(final Geopoint center, IConnector connector) { String centerString = GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, center) + "|" + GeopointFormatter.format(GeopointFormatter.Format.LON_DECDEGREE_RAW, center); final Parameters params = new Parameters("center", centerString); final JSONObject data = request(connector, SERVICE_NEAREST, params); @@ -91,7 +91,7 @@ final public class OkapiClient { return parseCaches(data); } - private static List<cgCache> parseCaches(final JSONObject response) { + private static List<Geocache> parseCaches(final JSONObject response) { try { final JSONArray cachesResponse = response.getJSONArray("results"); if (cachesResponse != null) { @@ -102,9 +102,9 @@ final public class OkapiClient { geocodes.add(geocode); } } - List<cgCache> caches = new ArrayList<cgCache>(geocodes.size()); + List<Geocache> caches = new ArrayList<Geocache>(geocodes.size()); for (String geocode : geocodes) { - cgCache cache = getCache(geocode); + Geocache cache = getCache(geocode); if (cache != null) { caches.add(cache); } @@ -117,8 +117,8 @@ final public class OkapiClient { return null; } - private static cgCache parseCache(final JSONObject response) { - final cgCache cache = new cgCache(); + private static Geocache parseCache(final JSONObject response) { + final Geocache cache = new Geocache(); cache.setReliableLatLon(true); try { cache.setGeocode(response.getString(CACHE_CODE)); @@ -235,7 +235,7 @@ final public class OkapiClient { return null; } - private static void setLocation(final cgCache cache, final String location) { + private static void setLocation(final Geocache cache, final String location) { final String latitude = StringUtils.substringBefore(location, "|"); final String longitude = StringUtils.substringAfter(location, "|"); cache.setCoords(new Geopoint(latitude, longitude)); |
