no need to pre-calc BoundingBox hashcode
This commit is contained in:
parent
b75a3712d5
commit
e7a015a1d7
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||||
|
* Copyright 2014 Hannes Janetzek
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -52,11 +53,6 @@ public class BoundingBox {
|
|||||||
*/
|
*/
|
||||||
public final int minLongitudeE6;
|
public final int minLongitudeE6;
|
||||||
|
|
||||||
/**
|
|
||||||
* The hash code of this object.
|
|
||||||
*/
|
|
||||||
private final int hashCodeValue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param minLatitudeE6
|
* @param minLatitudeE6
|
||||||
* the minimum latitude in microdegrees (degrees * 10^6).
|
* the minimum latitude in microdegrees (degrees * 10^6).
|
||||||
@ -72,7 +68,6 @@ public class BoundingBox {
|
|||||||
this.minLongitudeE6 = minLongitudeE6;
|
this.minLongitudeE6 = minLongitudeE6;
|
||||||
this.maxLatitudeE6 = maxLatitudeE6;
|
this.maxLatitudeE6 = maxLatitudeE6;
|
||||||
this.maxLongitudeE6 = maxLongitudeE6;
|
this.maxLongitudeE6 = maxLongitudeE6;
|
||||||
this.hashCodeValue = calculateHashCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox(double minLatitude, double minLongitude, double maxLatitude,
|
public BoundingBox(double minLatitude, double minLongitude, double maxLatitude,
|
||||||
@ -81,7 +76,6 @@ public class BoundingBox {
|
|||||||
this.minLongitudeE6 = (int) (minLongitude * 1E6);
|
this.minLongitudeE6 = (int) (minLongitude * 1E6);
|
||||||
this.maxLatitudeE6 = (int) (maxLatitude * 1E6);
|
this.maxLatitudeE6 = (int) (maxLatitude * 1E6);
|
||||||
this.maxLongitudeE6 = (int) (maxLongitude * 1E6);
|
this.maxLongitudeE6 = (int) (maxLongitude * 1E6);
|
||||||
this.hashCodeValue = calculateHashCode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -158,7 +152,12 @@ public class BoundingBox {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return hashCodeValue;
|
int result = 7;
|
||||||
|
result = 31 * result + maxLatitudeE6;
|
||||||
|
result = 31 * result + maxLongitudeE6;
|
||||||
|
result = 31 * result + minLatitudeE6;
|
||||||
|
result = 31 * result + minLongitudeE6;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -188,18 +187,6 @@ public class BoundingBox {
|
|||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the hash code of this object.
|
|
||||||
*/
|
|
||||||
private int calculateHashCode() {
|
|
||||||
int result = 7;
|
|
||||||
result = 31 * result + maxLatitudeE6;
|
|
||||||
result = 31 * result + maxLongitudeE6;
|
|
||||||
result = 31 * result + minLatitudeE6;
|
|
||||||
result = 31 * result + minLongitudeE6;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* code below is from osdmroid, @author Nicolas Gramlich */
|
/* code below is from osdmroid, @author Nicolas Gramlich */
|
||||||
public static BoundingBox fromGeoPoints(final List<? extends GeoPoint> partialPolyLine) {
|
public static BoundingBox fromGeoPoints(final List<? extends GeoPoint> partialPolyLine) {
|
||||||
int minLat = Integer.MAX_VALUE;
|
int minLat = Integer.MAX_VALUE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user