diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2013-02-03 13:53:48 +0100 |
---|---|---|
committer | Samuel Tardieu <sam@rfc1149.net> | 2013-02-03 13:53:48 +0100 |
commit | b53b6303ae321276d8c25d6a492372ac615580a2 (patch) | |
tree | e756bbd1ac81d7117bfadde5c53bb8d5b72d9a85 /main/src/cgeo/geocaching/connector | |
parent | 56106aba18200cd87bc4a51858bdf1125fe913af (diff) | |
download | cgeo-b53b6303ae321276d8c25d6a492372ac615580a2.zip cgeo-b53b6303ae321276d8c25d6a492372ac615580a2.tar.gz cgeo-b53b6303ae321276d8c25d6a492372ac615580a2.tar.bz2 |
Refactoring: rename cgCache into Geocache
Diffstat (limited to 'main/src/cgeo/geocaching/connector')
18 files changed, 91 insertions, 91 deletions
diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java index 9604b5f..1eb8fbb 100644 --- a/main/src/cgeo/geocaching/connector/AbstractConnector.java +++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java @@ -1,6 +1,6 @@ package cgeo.geocaching.connector; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheRealm; import cgeo.geocaching.geopoint.Geopoint; @@ -31,7 +31,7 @@ public abstract class AbstractConnector implements IConnector { * @return success */ @Override - public boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt) { + public boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt) { throw new UnsupportedOperationException(); } @@ -39,7 +39,7 @@ public abstract class AbstractConnector implements IConnector { * {@link IConnector} */ @Override - public boolean deleteModifiedCoordinates(cgCache cache) { + public boolean deleteModifiedCoordinates(Geocache cache) { throw new UnsupportedOperationException(); } @@ -54,7 +54,7 @@ public abstract class AbstractConnector implements IConnector { } @Override - public String getLicenseText(final cgCache cache) { + public String getLicenseText(final Geocache cache) { return null; } diff --git a/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java b/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java index 15113da..ac2fb37 100644 --- a/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java +++ b/main/src/cgeo/geocaching/connector/GeocachingAustraliaConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; import org.apache.commons.lang3.StringUtils; @@ -13,7 +13,7 @@ public class GeocachingAustraliaConnector extends AbstractConnector { } @Override - public String getCacheUrl(final cgCache cache) { + public String getCacheUrl(final Geocache cache) { return getCacheUrlPrefix() + cache.getGeocode(); } diff --git a/main/src/cgeo/geocaching/connector/GeopeitusConnector.java b/main/src/cgeo/geocaching/connector/GeopeitusConnector.java index c20b8f8..500f752 100644 --- a/main/src/cgeo/geocaching/connector/GeopeitusConnector.java +++ b/main/src/cgeo/geocaching/connector/GeopeitusConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; import org.apache.commons.lang3.StringUtils; @@ -13,7 +13,7 @@ public class GeopeitusConnector extends AbstractConnector { } @Override - public String getCacheUrl(final cgCache cache) { + public String getCacheUrl(final Geocache cache) { return getCacheUrlPrefix() + StringUtils.stripStart(cache.getGeocode().substring(2), "0"); } diff --git a/main/src/cgeo/geocaching/connector/IConnector.java b/main/src/cgeo/geocaching/connector/IConnector.java index d45368a..da626f2 100644 --- a/main/src/cgeo/geocaching/connector/IConnector.java +++ b/main/src/cgeo/geocaching/connector/IConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheRealm; import cgeo.geocaching.geopoint.Geopoint; @@ -27,7 +27,7 @@ public interface IConnector { * @param cache * @return */ - public String getCacheUrl(final cgCache cache); + public String getCacheUrl(final Geocache cache); /** * enable/disable watchlist controls in cache details @@ -63,7 +63,7 @@ public interface IConnector { * @param cache * @return */ - public String getLicenseText(final cgCache cache); + public String getLicenseText(final Geocache cache); /** * enable/disable user actions in cache details @@ -118,7 +118,7 @@ public interface IConnector { * @param wpt * @return success */ - public boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt); + public boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt); /** * Reseting of modified coordinates on website to details @@ -126,7 +126,7 @@ public interface IConnector { * @param cache * @return success */ - public boolean deleteModifiedCoordinates(cgCache cache); + public boolean deleteModifiedCoordinates(Geocache cache); /** * The CacheRealm this cache belongs to diff --git a/main/src/cgeo/geocaching/connector/UnknownConnector.java b/main/src/cgeo/geocaching/connector/UnknownConnector.java index 3edd8a6..b6fc29a 100644 --- a/main/src/cgeo/geocaching/connector/UnknownConnector.java +++ b/main/src/cgeo/geocaching/connector/UnknownConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; import cgeo.geocaching.ICache; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import org.apache.commons.lang3.StringUtils; @@ -13,7 +13,7 @@ public class UnknownConnector extends AbstractConnector { } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { return null; // we have no url for these caches } diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java index 7716b8f..2a38bd9 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java +++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java @@ -1,10 +1,10 @@ package cgeo.geocaching.connector.gc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.connector.AbstractConnector; import cgeo.geocaching.connector.capability.ISearchByCenter; @@ -51,7 +51,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { // it would also be possible to use "http://www.geocaching.com/seek/cache_details.aspx?wp=" + cache.getGeocode(); return "http://www.geocaching.com//seek/cache_details.aspx?wp=" + cache.getGeocode(); } @@ -143,7 +143,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } - public static boolean addToWatchlist(cgCache cache) { + public static boolean addToWatchlist(Geocache cache) { final boolean added = GCParser.addToWatchlist(cache); if (added) { cgData.saveChangedCache(cache); @@ -151,7 +151,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, return added; } - public static boolean removeFromWatchlist(cgCache cache) { + public static boolean removeFromWatchlist(Geocache cache) { final boolean removed = GCParser.removeFromWatchlist(cache); if (removed) { cgData.saveChangedCache(cache); @@ -168,7 +168,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, * @return <code>true</code> if the cache was sucessfully added, <code>false</code> otherwise */ - public static boolean addToFavorites(cgCache cache) { + public static boolean addToFavorites(Geocache cache) { final boolean added = GCParser.addToFavorites(cache); if (added) { cgData.saveChangedCache(cache); @@ -185,7 +185,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, * @return <code>true</code> if the cache was sucessfully added, <code>false</code> otherwise */ - public static boolean removeFromFavorites(cgCache cache) { + public static boolean removeFromFavorites(Geocache cache) { final boolean removed = GCParser.removeFromFavorites(cache); if (removed) { cgData.saveChangedCache(cache); @@ -194,7 +194,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } @Override - public boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt) { + public boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt) { final boolean uploaded = GCParser.uploadModifiedCoordinates(cache, wpt); if (uploaded) { cgData.saveChangedCache(cache); @@ -203,7 +203,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } @Override - public boolean deleteModifiedCoordinates(cgCache cache) { + public boolean deleteModifiedCoordinates(Geocache cache) { final boolean deleted = GCParser.deleteModifiedCoordinates(cache); if (deleted) { cgData.saveChangedCache(cache); diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java index 20739db..2e1dff0 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCMap.java +++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java @@ -2,7 +2,7 @@ package cgeo.geocaching.connector.gc; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.cgData; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.enumerations.CacheSize; @@ -68,7 +68,7 @@ public class GCMap { } for (int j = 0; j < dataArray.length(); j++) { - final cgCache cache = new cgCache(); + final Geocache cache = new Geocache(); JSONObject dataObject = dataArray.getJSONObject(j); cache.setName(dataObject.getString("name")); @@ -202,7 +202,7 @@ public class GCMap { String id = entry.getKey(); List<UTFGridPosition> pos = entry.getValue(); UTFGridPosition xy = UTFGrid.getPositionInGrid(pos); - cgCache cache = new cgCache(); + Geocache cache = new Geocache(); cache.setDetailed(false); cache.setReliableLatLon(false); cache.setGeocode(id); diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index d9d9c0b..b54e00c 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -1,5 +1,6 @@ package cgeo.geocaching.connector.gc; +import cgeo.geocaching.Geocache; import cgeo.geocaching.LogEntry; import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; @@ -7,7 +8,6 @@ import cgeo.geocaching.Settings; import cgeo.geocaching.Trackable; import cgeo.geocaching.TrackableLog; import cgeo.geocaching.Waypoint; -import cgeo.geocaching.cgCache; import cgeo.geocaching.cgData; import cgeo.geocaching.Image; import cgeo.geocaching.cgeoapplication; @@ -119,7 +119,7 @@ public abstract class GCParser { final int rows_count = rows.length; for (int z = 1; z < rows_count; z++) { - final cgCache cache = new cgCache(); + final Geocache cache = new Geocache(); String row = rows[z]; // check for cache type presence @@ -287,8 +287,8 @@ public abstract class GCParser { // get direction images if (Settings.getLoadDirImg()) { - final Set<cgCache> caches = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); - for (cgCache cache : caches) { + final Set<Geocache> caches = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB); + for (Geocache cache : caches) { if (cache.getCoords() == null && StringUtils.isNotEmpty(cache.getDirectionImg())) { DirectionImage.getDrawable(cache.getGeocode(), cache.getDirectionImg()); } @@ -301,7 +301,7 @@ public abstract class GCParser { static SearchResult parseCache(final String page, final CancellableHandler handler) { final SearchResult searchResult = parseCacheFromText(page, handler); if (searchResult != null && !searchResult.getGeocodes().isEmpty()) { - final cgCache cache = searchResult.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); + final Geocache cache = searchResult.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB); getExtraOnlineInfo(cache, page, handler); cache.setDetailedUpdatedNow(); if (CancellableHandler.isCancelled(handler)) { @@ -345,7 +345,7 @@ public abstract class GCParser { return searchResult; } - final cgCache cache = new cgCache(); + final Geocache cache = new Geocache(); cache.setDisabled(page.contains(GCConstants.STRING_DISABLED)); cache.setArchived(page.contains(GCConstants.STRING_ARCHIVED)); @@ -744,7 +744,7 @@ public abstract class GCParser { } // search results don't need to be filtered so load GCVote ratings here - GCVote.loadRatings(new ArrayList<cgCache>(searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB))); + GCVote.loadRatings(new ArrayList<Geocache>(searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB))); // save to application search.setError(searchResult.getError()); @@ -1125,7 +1125,7 @@ public abstract class GCParser { * the cache to add * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean addToWatchlist(final cgCache cache) { + static boolean addToWatchlist(final Geocache cache) { final String uri = "http://www.geocaching.com/my/watchlist.aspx?w=" + cache.getCacheId(); String page = Login.postRequestLogged(uri, null); @@ -1151,7 +1151,7 @@ public abstract class GCParser { * the cache to remove * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean removeFromWatchlist(final cgCache cache) { + static boolean removeFromWatchlist(final Geocache cache) { final String uri = "http://www.geocaching.com/my/watchlist.aspx?ds=1&action=rem&id=" + cache.getCacheId(); String page = Login.postRequestLogged(uri, null); @@ -1200,11 +1200,11 @@ public abstract class GCParser { * the cache to add * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean addToFavorites(final cgCache cache) { + static boolean addToFavorites(final Geocache cache) { return changeFavorite(cache, true); } - private static boolean changeFavorite(final cgCache cache, final boolean add) { + private static boolean changeFavorite(final Geocache cache, final boolean add) { final String page = requestHtmlPage(cache.getGeocode(), null, "n", "0"); final String userToken = BaseUtils.getMatch(page, GCConstants.PATTERN_USERTOKEN, ""); if (StringUtils.isEmpty(userToken)) { @@ -1234,7 +1234,7 @@ public abstract class GCParser { * the cache to remove * @return <code>false</code> if an error occurred, <code>true</code> otherwise */ - static boolean removeFromFavorites(final cgCache cache) { + static boolean removeFromFavorites(final Geocache cache) { return changeFavorite(cache, false); } @@ -1436,7 +1436,7 @@ public abstract class GCParser { * @param friends * retrieve friend logs */ - private static List<LogEntry> loadLogsFromDetails(final String page, final cgCache cache, final boolean friends, final boolean getDataFromPage) { + private static List<LogEntry> loadLogsFromDetails(final String page, final Geocache cache, final boolean friends, final boolean getDataFromPage) { String rawResponse; if (!getDataFromPage) { @@ -1623,7 +1623,7 @@ public abstract class GCParser { params.put("tx", cacheType.guid); } - private static void getExtraOnlineInfo(final cgCache cache, final String page, final CancellableHandler handler) { + private static void getExtraOnlineInfo(final Geocache cache, final String page, final CancellableHandler handler) { if (CancellableHandler.isCancelled(handler)) { return; } @@ -1668,15 +1668,15 @@ public abstract class GCParser { } } - public static boolean uploadModifiedCoordinates(cgCache cache, Geopoint wpt) { + public static boolean uploadModifiedCoordinates(Geocache cache, Geopoint wpt) { return editModifiedCoordinates(cache, wpt); } - public static boolean deleteModifiedCoordinates(cgCache cache) { + public static boolean deleteModifiedCoordinates(Geocache cache) { return editModifiedCoordinates(cache, null); } - public static boolean editModifiedCoordinates(cgCache cache, Geopoint wpt) { + public static boolean editModifiedCoordinates(Geocache cache, Geopoint wpt) { final String page = requestHtmlPage(cache.getGeocode(), null, "n", "0"); final String userToken = BaseUtils.getMatch(page, GCConstants.PATTERN_USERTOKEN, ""); if (StringUtils.isEmpty(userToken)) { diff --git a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java index 0bebd02..98bd28a 100644 --- a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java +++ b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.gc; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.enumerations.CacheType; import android.graphics.Bitmap; @@ -25,7 +25,7 @@ public abstract class IconDecoder { private static final int CT_VIRTUAL = 11; private static final int CT_LETTERBOX = 12; - public static boolean parseMapPNG(final cgCache cache, Bitmap bitmap, UTFGridPosition xy, int zoomlevel) { + public static boolean parseMapPNG(final Geocache cache, Bitmap bitmap, UTFGridPosition xy, int zoomlevel) { final int topX = xy.getX() * 4; final int topY = xy.getY() * 4; final int bitmapWidth = bitmap.getWidth(); 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)); diff --git a/main/src/cgeo/geocaching/connector/ox/OXConnector.java b/main/src/cgeo/geocaching/connector/ox/OXConnector.java index 17d8ab4..eec07e3 100644 --- a/main/src/cgeo/geocaching/connector/ox/OXConnector.java +++ b/main/src/cgeo/geocaching/connector/ox/OXConnector.java @@ -1,9 +1,9 @@ package cgeo.geocaching.connector.ox; +import cgeo.geocaching.Geocache; import cgeo.geocaching.ICache; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; -import cgeo.geocaching.cgCache; import cgeo.geocaching.connector.AbstractConnector; import cgeo.geocaching.connector.capability.ISearchByCenter; import cgeo.geocaching.connector.capability.ISearchByGeocode; @@ -27,7 +27,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I } @Override - public String getCacheUrl(cgCache cache) { + public String getCacheUrl(Geocache cache) { return getCacheUrlPrefix() + cache.getGeocode(); } @@ -42,7 +42,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I } @Override - public String getLicenseText(cgCache cache) { + public String getLicenseText(Geocache cache) { // NOT TO BE TRANSLATED return "<a href=\"" + getCacheUrl(cache) + "\">" + getName() + "</a> data licensed under the Creative Commons BY-SA 3.0 License"; } @@ -54,7 +54,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I @Override public SearchResult searchByGeocode(String geocode, String guid, CancellableHandler handler) { - final cgCache cache = OpenCachingApi.searchByGeoCode(geocode); + final Geocache cache = OpenCachingApi.searchByGeoCode(geocode); if (cache == null) { return null; } @@ -64,7 +64,7 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I @Override public SearchResult searchByCenter(Geopoint center) { - Collection<cgCache> caches = OpenCachingApi.searchByCenter(center); + Collection<Geocache> caches = OpenCachingApi.searchByCenter(center); if (caches == null) { return null; } diff --git a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java index 377785a..f40a3e8 100644 --- a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java +++ b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java @@ -1,6 +1,6 @@ package cgeo.geocaching.connector.ox; -import cgeo.geocaching.cgCache; +import cgeo.geocaching.Geocache; import cgeo.geocaching.files.GPX10Parser; public class OXGPXParser extends GPX10Parser { @@ -13,7 +13,7 @@ public class OXGPXParser extends GPX10Parser { } @Override - protected void afterParsing(cgCache cache) { + protected void afterParsing(Geocache cache) { cache.setUpdated(System.currentTimeMillis()); if (isDetailed) { cache.setDetailedUpdate(cache.getUpdated()); diff --git a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java index 17be540..f25e289 100644 --- a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java +++ b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector.ox; +import cgeo.geocaching.Geocache; import cgeo.geocaching.StoredList; -import cgeo.geocaching.cgCache; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.geopoint.GeopointFormatter; import cgeo.geocaching.network.Network; @@ -20,25 +20,25 @@ public class OpenCachingApi { private static final String DEV_KEY = CryptUtils.rot13("PtqQnHo9RUTht3Np"); - public static cgCache searchByGeoCode(final String geocode) { + public static Geocache searchByGeoCode(final String geocode) { final HttpResponse response = Network.getRequest("http://www.opencaching.com/api/geocache/" + geocode + ".gpx", new Parameters( "Authorization", DEV_KEY, "log_limit", "30", "hint", "true", "description", "html")); - final Collection<cgCache> caches = importCachesFromResponse(response, true); + final Collection<Geocache> caches = importCachesFromResponse(response, true); if (CollectionUtils.isNotEmpty(caches)) { return caches.iterator().next(); } return null; } - private static Collection<cgCache> importCachesFromResponse(final HttpResponse response, final boolean isDetailed) { + private static Collection<Geocache> importCachesFromResponse(final HttpResponse response, final boolean isDetailed) { if (response == null) { return Collections.emptyList(); } - Collection<cgCache> caches; + Collection<Geocache> caches; try { caches = new OXGPXParser(StoredList.STANDARD_LIST_ID, isDetailed).parse(response.getEntity().getContent(), null); } catch (Exception e) { @@ -48,7 +48,7 @@ public class OpenCachingApi { return caches; } - public static Collection<cgCache> searchByCenter(final Geopoint center) { + public static Collection<Geocache> searchByCenter(final Geopoint center) { final HttpResponse response = Network.getRequest("http://www.opencaching.com/api/geocache/.gpx", new Parameters( "Authorization", DEV_KEY, |