diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2011-10-15 19:03:18 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2011-10-15 19:03:18 +0200 |
commit | 9715ae30450e02fcf731a06888ad832c1734e544 (patch) | |
tree | 0bf14c2df4045509d9ad08c16ce64f10a4324b40 /main/src/cgeo | |
parent | f626fe08ed6ecf6a33327ebada2a362bbceedd57 (diff) | |
download | cgeo-9715ae30450e02fcf731a06888ad832c1734e544.zip cgeo-9715ae30450e02fcf731a06888ad832c1734e544.tar.gz cgeo-9715ae30450e02fcf731a06888ad832c1734e544.tar.bz2 |
code cleanup: remove all unnecessary casts
Diffstat (limited to 'main/src/cgeo')
5 files changed, 36 insertions, 36 deletions
diff --git a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java index e4afc31..4cce8d7 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java +++ b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java @@ -27,10 +27,11 @@ class LocusCacheListApp extends AbstractLocusApp implements CacheListApp { @Override public boolean invoke(cgGeo geo, List<cgCache> cacheList, Activity activity, Resources res, final UUID searchId) { - if (CollectionUtils.isEmpty(cacheList)) + if (CollectionUtils.isEmpty(cacheList)) { return false; + } - showInLocus((List<? extends Object>) cacheList, false, activity); + showInLocus(cacheList, false, activity); return true; } diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java index 92acd73..52336ad 100644 --- a/main/src/cgeo/geocaching/cgBase.java +++ b/main/src/cgeo/geocaching/cgBase.java @@ -1642,7 +1642,7 @@ public class cgBase { /** * Parse a trackable HTML description into a cgTrackable object - * + * * @param page * the HTML page to parse, already processed through {@link BaseUtils#replaceWhitespace} * @param app @@ -2385,7 +2385,7 @@ public class cgBase { if (c > 300) { logUpdated.append("&#"); - logUpdated.append(Integer.toString((int) c)); + logUpdated.append(Integer.toString(c)); logUpdated.append(';'); } else { logUpdated.append(c); @@ -3413,7 +3413,7 @@ public class cgBase { /** * Generate a numeric date and time string according to system-wide settings (locale, * date format) such as "7 sept. à 12:35". - * + * * @param context * a Context * @param date diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java index c6e26c0..18ddf2b 100644 --- a/main/src/cgeo/geocaching/cgData.java +++ b/main/src/cgeo/geocaching/cgData.java @@ -43,7 +43,6 @@ public class cgData { "favourite_cnt", "rating", "votes", "myvote", "disabled", "archived", "members", "found", "favourite", "inventorycoins", "inventorytags", "inventoryunknown", "onWatchlist", "personal_note", "reliable_latlon" }; - public cgCacheWrap caches; private Context context = null; private String path = null; private cgDbHelper dbHelper = null; @@ -1756,11 +1755,11 @@ public class cgData { if (cnt > 0) { cursor.moveToFirst(); - viewport.add((Integer) cursor.getInt(cursor.getColumnIndex("cnt"))); - viewport.add((Double) cursor.getDouble(cursor.getColumnIndex("latMin"))); - viewport.add((Double) cursor.getDouble(cursor.getColumnIndex("latMax"))); - viewport.add((Double) cursor.getDouble(cursor.getColumnIndex("lonMin"))); - viewport.add((Double) cursor.getDouble(cursor.getColumnIndex("lonMax"))); + viewport.add(cursor.getInt(cursor.getColumnIndex("cnt"))); + viewport.add(cursor.getDouble(cursor.getColumnIndex("latMin"))); + viewport.add(cursor.getDouble(cursor.getColumnIndex("latMax"))); + viewport.add(cursor.getDouble(cursor.getColumnIndex("lonMin"))); + viewport.add(cursor.getDouble(cursor.getColumnIndex("lonMax"))); } } } catch (Exception e) { @@ -2040,8 +2039,8 @@ public class cgData { cache.updated = cursor.getLong(cursor.getColumnIndex("updated")); cache.reason = cursor.getInt(cursor.getColumnIndex("reason")); cache.detailed = cursor.getInt(cursor.getColumnIndex("detailed")) == 1; - cache.detailedUpdate = (Long) cursor.getLong(cursor.getColumnIndex("detailedupdate")); - cache.visitedDate = (Long) cursor.getLong(cursor.getColumnIndex("visiteddate")); + cache.detailedUpdate = cursor.getLong(cursor.getColumnIndex("detailedupdate")); + cache.visitedDate = cursor.getLong(cursor.getColumnIndex("visiteddate")); cache.geocode = cursor.getString(cursor.getColumnIndex("geocode")); cache.cacheId = cursor.getString(cursor.getColumnIndex("cacheid")); cache.guid = cursor.getString(cursor.getColumnIndex("guid")); @@ -2053,7 +2052,7 @@ public class cgData { cache.hidden = new Date(cursor.getLong(cursor.getColumnIndex("hidden"))); cache.hint = cursor.getString(cursor.getColumnIndex("hint")); cache.size = CacheSize.FIND_BY_ID.get(cursor.getString(cursor.getColumnIndex("size"))); - cache.difficulty = (Float) cursor.getFloat(cursor.getColumnIndex("difficulty")); + cache.difficulty = cursor.getFloat(cursor.getColumnIndex("difficulty")); index = cursor.getColumnIndex("direction"); if (cursor.isNull(index)) { cache.direction = null; @@ -2066,7 +2065,7 @@ public class cgData { } else { cache.distance = cursor.getFloat(index); } - cache.terrain = (Float) cursor.getFloat(cursor.getColumnIndex("terrain")); + cache.terrain = cursor.getFloat(cursor.getColumnIndex("terrain")); cache.latlon = cursor.getString(cursor.getColumnIndex("latlon")); cache.location = cursor.getString(cursor.getColumnIndex("location")); cache.coords = getCoords(cursor); @@ -2074,22 +2073,22 @@ public class cgData { if (cursor.isNull(index)) { cache.elevation = null; } else { - cache.elevation = (Double) cursor.getDouble(index); + cache.elevation = cursor.getDouble(index); } cache.personalNote = cursor.getString(cursor.getColumnIndex("personal_note")); cache.shortdesc = cursor.getString(cursor.getColumnIndex("shortdesc")); // do not set cache.description ! - cache.favouriteCnt = (Integer) cursor.getInt(cursor.getColumnIndex("favourite_cnt")); - cache.rating = (Float) cursor.getFloat(cursor.getColumnIndex("rating")); - cache.votes = (Integer) cursor.getInt(cursor.getColumnIndex("votes")); - cache.myVote = (Float) cursor.getFloat(cursor.getColumnIndex("myvote")); - cache.disabled = cursor.getLong(cursor.getColumnIndex("disabled")) == 1l; - cache.archived = cursor.getLong(cursor.getColumnIndex("archived")) == 1l; - cache.members = cursor.getLong(cursor.getColumnIndex("members")) == 1l; - cache.found = cursor.getLong(cursor.getColumnIndex("found")) == 1l; - cache.favourite = cursor.getLong(cursor.getColumnIndex("favourite")) == 1l; - cache.inventoryItems = (Integer) cursor.getInt(cursor.getColumnIndex("inventoryunknown")); - cache.onWatchlist = cursor.getLong(cursor.getColumnIndex("onWatchlist")) == 1l; + cache.favouriteCnt = cursor.getInt(cursor.getColumnIndex("favourite_cnt")); + cache.rating = cursor.getFloat(cursor.getColumnIndex("rating")); + cache.votes = cursor.getInt(cursor.getColumnIndex("votes")); + cache.myVote = cursor.getFloat(cursor.getColumnIndex("myvote")); + cache.disabled = cursor.getLong(cursor.getColumnIndex("disabled")) == 1L; + cache.archived = cursor.getLong(cursor.getColumnIndex("archived")) == 1L; + cache.members = cursor.getLong(cursor.getColumnIndex("members")) == 1L; + cache.found = cursor.getLong(cursor.getColumnIndex("found")) == 1L; + cache.favourite = cursor.getLong(cursor.getColumnIndex("favourite")) == 1L; + cache.inventoryItems = cursor.getInt(cursor.getColumnIndex("inventoryunknown")); + cache.onWatchlist = cursor.getLong(cursor.getColumnIndex("onWatchlist")) == 1L; cache.reliableLatLon = cursor.getInt(cursor.getColumnIndex("reliable_latlon")) > 0; return cache; } @@ -3167,7 +3166,7 @@ public class cgData { list.id = (cursor.getInt(indexId)) + 10; list.title = cursor.getString(indexTitle); - list.updated = (Long) cursor.getLong(indexUpdated); + list.updated = cursor.getLong(indexUpdated); list.coords = getCoords(cursor, indexLatitude, indexLongitude); result.add(list); diff --git a/main/src/cgeo/geocaching/geopoint/GeopointParser.java b/main/src/cgeo/geocaching/geopoint/GeopointParser.java index a113e10..20258a7 100644 --- a/main/src/cgeo/geocaching/geopoint/GeopointParser.java +++ b/main/src/cgeo/geocaching/geopoint/GeopointParser.java @@ -93,23 +93,23 @@ public class GeopointParser final Matcher matcher = pattern.matcher(text); if (matcher.find()) { - final int sign = matcher.group(1).equalsIgnoreCase("S") || matcher.group(1).equalsIgnoreCase("W") ? -1 : 1; - final int degree = Integer.parseInt(matcher.group(2)); + final double sign = matcher.group(1).equalsIgnoreCase("S") || matcher.group(1).equalsIgnoreCase("W") ? -1.0 : 1.0; + final double degree = Integer.valueOf(matcher.group(2)).doubleValue(); - int minutes = 0; - double seconds = 0; + double minutes = 0.0; + double seconds = 0.0; if (null != matcher.group(3)) { - minutes = Integer.parseInt(matcher.group(3)); + minutes = Integer.valueOf(matcher.group(3)).doubleValue(); if (null != matcher.group(4)) { - seconds = Double.parseDouble("0." + matcher.group(4)) * 60; + seconds = Double.parseDouble("0." + matcher.group(4)) * 60.0; } else if (null != matcher.group(5)) { seconds = Double.parseDouble(matcher.group(5)); } } - return (double) sign * ((double) degree + (double) minutes / 60 + seconds / 3600); + return sign * (degree + minutes / 60.0 + seconds / 3600.0); } else { diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java index 5732e99..6a83c16 100644 --- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java +++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java @@ -15,7 +15,7 @@ public class MapsforgeOtherCachersOverlayItem extends OverlayItem implements Oth private cgUser user = null; public MapsforgeOtherCachersOverlayItem(Context contextIn, cgUser userIn) { - super(new GeoPoint((int) (userIn.coords.getLatitudeE6()), userIn.coords.getLongitudeE6()), userIn.username, ""); + super(new GeoPoint(userIn.coords.getLatitudeE6(), userIn.coords.getLongitudeE6()), userIn.username, ""); context = contextIn; user = userIn; |