aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorcampbeb <bpcampbell@gmail.com>2012-03-18 12:41:39 +0900
committercampbeb <bpcampbell@gmail.com>2012-03-18 12:41:39 +0900
commit04759a13bf0543a81c0fe1cb87e4e9f8bdabd581 (patch)
tree0d6c8e0b5564b54b36ddc347f9392cc04b52e427 /main/src
parent254bd0204e5521bea6bd96d946b84ecbb89f8c89 (diff)
downloadcgeo-04759a13bf0543a81c0fe1cb87e4e9f8bdabd581.zip
cgeo-04759a13bf0543a81c0fe1cb87e4e9f8bdabd581.tar.gz
cgeo-04759a13bf0543a81c0fe1cb87e4e9f8bdabd581.tar.bz2
Optimization - Avoid use of internal getters.
See http://developer.android.com/guide/practices/design/performance.html#internal_get_set
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/cgCache.java28
-rw-r--r--main/src/cgeo/geocaching/cgDestination.java2
-rw-r--r--main/src/cgeo/geocaching/cgWaypoint.java18
-rw-r--r--main/src/cgeo/geocaching/connector/gc/Tile.java16
-rw-r--r--main/src/cgeo/geocaching/geopoint/Geopoint.java14
5 files changed, 39 insertions, 39 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index 79a4209..85dc4d4 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -159,34 +159,34 @@ public class cgCache implements ICache {
* - logOffline
*/
if (visitedDate == 0) {
- visitedDate = other.getVisitedDate();
+ visitedDate = other.visitedDate;
}
if (listId == StoredList.TEMPORARY_LIST_ID) {
listId = other.listId;
}
if (StringUtils.isBlank(geocode)) {
- geocode = other.getGeocode();
+ geocode = other.geocode;
}
if (StringUtils.isBlank(cacheId)) {
cacheId = other.cacheId;
}
if (StringUtils.isBlank(guid)) {
- guid = other.getGuid();
+ guid = other.guid;
}
if (null == cacheType || CacheType.UNKNOWN == cacheType) {
- cacheType = other.getType();
+ cacheType = other.cacheType;
}
if (StringUtils.isBlank(name)) {
- name = other.getName();
+ name = other.name;
}
if (StringUtils.isBlank(nameSp)) {
nameSp = other.nameSp;
}
if (StringUtils.isBlank(owner)) {
- owner = other.getOwner();
+ owner = other.owner;
}
if (StringUtils.isBlank(ownerReal)) {
- ownerReal = other.getOwnerReal();
+ ownerReal = other.ownerReal;
}
if (hidden == null) {
hidden = other.hidden;
@@ -198,16 +198,16 @@ public class cgCache implements ICache {
size = other.size;
}
if (difficulty == 0) {
- difficulty = other.getDifficulty();
+ difficulty = other.difficulty;
}
if (terrain == 0) {
- terrain = other.getTerrain();
+ terrain = other.terrain;
}
if (direction == null) {
direction = other.direction;
}
if (distance == null) {
- distance = other.getDistance();
+ distance = other.distance;
}
if (StringUtils.isBlank(latlon)) {
latlon = other.latlon;
@@ -229,22 +229,22 @@ public class cgCache implements ICache {
personalNote = other.personalNote;
}
if (StringUtils.isBlank(shortdesc)) {
- shortdesc = other.getShortdesc();
+ shortdesc = other.shortdesc;
}
if (StringUtils.isBlank(description)) {
description = other.description;
}
if (favoritePoints == 0) {
- favoritePoints = other.getFavoritePoints();
+ favoritePoints = other.favoritePoints;
}
if (rating == 0) {
- rating = other.getRating();
+ rating = other.rating;
}
if (votes == 0) {
votes = other.votes;
}
if (myVote == 0) {
- myVote = other.getMyVote();
+ myVote = other.myVote;
}
if (attributes == null) {
attributes = other.attributes;
diff --git a/main/src/cgeo/geocaching/cgDestination.java b/main/src/cgeo/geocaching/cgDestination.java
index 0d20447..cf9a8ef 100644
--- a/main/src/cgeo/geocaching/cgDestination.java
+++ b/main/src/cgeo/geocaching/cgDestination.java
@@ -60,7 +60,7 @@ public class cgDestination {
return false;
}
cgDestination other = (cgDestination) obj;
- return coords.isEqualTo(other.getCoords());
+ return coords.isEqualTo(other.coords);
}
public long getId() {
diff --git a/main/src/cgeo/geocaching/cgWaypoint.java b/main/src/cgeo/geocaching/cgWaypoint.java
index 7287d2d..b13c141 100644
--- a/main/src/cgeo/geocaching/cgWaypoint.java
+++ b/main/src/cgeo/geocaching/cgWaypoint.java
@@ -45,7 +45,7 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> {
*/
public cgWaypoint(final cgWaypoint other) {
merge(other);
- this.waypointType = other.getWaypointType();
+ this.waypointType = other.waypointType;
id = 0;
}
@@ -54,20 +54,20 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> {
}
public void merge(final cgWaypoint old) {
- if (StringUtils.isBlank(getPrefix())) {
- setPrefix(old.getPrefix());
+ if (StringUtils.isBlank(prefix)) {
+ setPrefix(old.prefix);
}
if (StringUtils.isBlank(lookup)) {
lookup = old.lookup;
}
if (StringUtils.isBlank(name)) {
- setName(old.getName());
+ setName(old.name);
}
if (StringUtils.isBlank(latlon) || latlon.startsWith("?")) { // there are waypoints containing "???"
latlon = old.latlon;
}
if (coords == null) {
- coords = old.getCoords();
+ coords = old.coords;
}
if (StringUtils.isBlank(note)) {
note = old.note;
@@ -86,10 +86,10 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> {
for (cgWaypoint old : oldPoints) {
if (old != null) {
boolean merged = false;
- if (old.getName() != null && old.getName().length() > 0) {
+ if (old.name != null && old.name.length() > 0) {
for (cgWaypoint waypoint : newPoints) {
- if (waypoint != null && waypoint.getName() != null) {
- if (old.getName().equalsIgnoreCase(waypoint.getName())) {
+ if (waypoint != null && waypoint.name != null) {
+ if (old.name.equalsIgnoreCase(waypoint.name)) {
waypoint.merge(old);
merged = true;
break;
@@ -242,6 +242,6 @@ public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> {
* @return True - waypoint is final and has coordinates, False - otherwise
*/
public boolean isFinalWithCoords() {
- return WaypointType.FINAL == getWaypointType() && null != getCoords();
+ return WaypointType.FINAL == waypointType && null != coords;
}
} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/connector/gc/Tile.java b/main/src/cgeo/geocaching/connector/gc/Tile.java
index eec83b0..b76cae9 100644
--- a/main/src/cgeo/geocaching/connector/gc/Tile.java
+++ b/main/src/cgeo/geocaching/connector/gc/Tile.java
@@ -123,7 +123,7 @@ public class Tile {
* Calculates the maximum possible zoom level where the supplied points
* are covered by adjacent tiles on the east/west axis.
* The order of the points (left/right) is irrelevant.
- *
+ *
* @param left
* First point
* @param right
@@ -140,7 +140,7 @@ public class Tile {
Tile tileLeft = new Tile(left, zoom);
Tile tileRight = new Tile(right, zoom);
- if (tileLeft.getX() == tileRight.getX()) {
+ if (tileLeft.tileX == tileRight.tileX) {
zoom = zoom + 1;
}
@@ -151,7 +151,7 @@ public class Tile {
* Calculates the maximum possible zoom level where the supplied points
* are covered by adjacent tiles on the north/south axis.
* The order of the points (bottom/top) is irrelevant.
- *
+ *
* @param bottom
* First point
* @param top
@@ -172,7 +172,7 @@ public class Tile {
Tile tileBottom = new Tile(bottom, zoom);
Tile tileTop = new Tile(top, zoom);
- if (Math.abs(tileBottom.getY() - tileTop.getY()) > 1) {
+ if (Math.abs(tileBottom.tileY - tileTop.tileY) > 1) {
zoom = zoom - 1;
}
@@ -186,7 +186,7 @@ public class Tile {
/**
* Calculates the inverted hyperbolic sine
* (after Bronstein, Semendjajew: Taschenbuch der Mathematik
- *
+ *
* @param x
* @return
*/
@@ -202,9 +202,9 @@ public class Tile {
if (!(o instanceof Tile)) {
return false;
}
- return (this.getX() == ((Tile) o).getX())
- && (this.getY() == ((Tile) o).getY())
- && (this.getZoomlevel() == ((Tile) o).getZoomlevel());
+ return (this.tileX == ((Tile) o).tileX)
+ && (this.tileY == ((Tile) o).tileY)
+ && (this.zoomlevel == ((Tile) o).zoomlevel);
}
@Override
diff --git a/main/src/cgeo/geocaching/geopoint/Geopoint.java b/main/src/cgeo/geocaching/geopoint/Geopoint.java
index fdcc663..be4a622 100644
--- a/main/src/cgeo/geocaching/geopoint/Geopoint.java
+++ b/main/src/cgeo/geocaching/geopoint/Geopoint.java
@@ -146,7 +146,7 @@ public final class Geopoint
*/
private float[] pathTo(final Geopoint target) {
float[] results = new float[2];
- android.location.Location.distanceBetween(getLatitude(), getLongitude(), target.getLatitude(), target.getLongitude(), results);
+ android.location.Location.distanceBetween(latitude, longitude, target.latitude, target.longitude, results);
return results;
}
@@ -209,7 +209,7 @@ public final class Geopoint
*/
public boolean isEqualTo(Geopoint gp)
{
- return null != gp && gp.getLatitude() == latitude && gp.getLongitude() == longitude;
+ return null != gp && gp.latitude == latitude && gp.longitude == longitude;
}
/**
@@ -242,7 +242,7 @@ public final class Geopoint
/**
* Returns formatted coordinates with default format.
* Default format is decimalminutes, e.g. N 52° 36.123 E 010° 03.456
- *
+ *
* @return formatted coordinates
*/
@Override
@@ -258,7 +258,7 @@ public final class Geopoint
*/
public Direction asDirection() {
if (direction == null) { // because geopoint is immutable we can "cache" the result
- direction = new Direction(getLatitude(), getLongitude());
+ direction = new Direction(latitude, longitude);
}
return direction;
}
@@ -270,7 +270,7 @@ public final class Geopoint
*/
public DDD asDDD() {
if (ddd == null) {
- ddd = new DDD(getLatitude(), getLongitude());
+ ddd = new DDD(latitude, longitude);
}
return ddd;
}
@@ -282,7 +282,7 @@ public final class Geopoint
*/
public DMM asDMM() {
if (dmm == null) {
- dmm = new DMM(getLatitude(), getLongitude());
+ dmm = new DMM(latitude, longitude);
}
return dmm;
}
@@ -294,7 +294,7 @@ public final class Geopoint
*/
public DMS asDMS() {
if (dms == null) {
- dms = new DMS(getLatitude(), getLongitude());
+ dms = new DMS(latitude, longitude);
}
return dms;
}