aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCBase.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/GCBase.java b/main/src/cgeo/geocaching/connector/gc/GCBase.java
index 566ef4a..4580542 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCBase.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCBase.java
@@ -58,8 +58,6 @@ public class GCBase {
private final static int POSX_FOUND = 10;
private final static int POSY_FOUND = -8;
- private static final LeastRecentlyUsedCache<String, String> geocodeCache = new LeastRecentlyUsedCache<String, String>(2000); // JSON id, geocode
-
/**
* @param viewport
* @param zoomlevel
@@ -228,17 +226,12 @@ public class GCBase {
}
for (String id : positions.keySet()) {
- String geocode = geocodeCache.get(id);
- if (geocode == null) {
- geocode = newidToGeocode(id);
- geocodeCache.put(id, geocode);
- }
List<UTFGridPosition> pos = positions.get(id);
UTFGridPosition xy = getPositionInGrid(pos);
cgCache cache = new cgCache();
cache.setDetailed(false);
cache.setReliableLatLon(false);
- cache.setGeocode(geocode);
+ cache.setGeocode(id);
cache.setName(nameCache.get(id));
cache.setZoomlevel(tile.getZoomlevel());
cache.setCoords(tile.getCoord(xy));
@@ -464,11 +457,16 @@ public class GCBase {
return new String[] { userSession, sessionToken };
}
- private static int[] splitJSONKey(final String key) {
- // two possible positions for the underscore
- int underscore = key.charAt(1) == '_' ? 1 : 2;
- int x = Integer.parseInt(key.substring(0, underscore));
- int y = Integer.parseInt(key.substring(underscore + 1));
+ /**
+ * @param key
+ * Key in the format (xx, xx)
+ * @return
+ */
+ private static int[] splitJSONKey(String key) {
+ // two possible positions for the ,
+ int seperator = key.charAt(2) == ',' ? 2 : 3;
+ int x = Integer.parseInt(key.substring(1, seperator));
+ int y = Integer.parseInt(key.substring(seperator + 2, key.length() - 1));
return new int[] { x, y };
}