001
014
015 package com.liferay.portal.kernel.search.geolocation;
016
017
020 public class GeoLocationPoint {
021
022 public GeoLocationPoint(double latitude, double longitude) {
023 _latitude = latitude;
024 _longitude = longitude;
025 }
026
027 @Override
028 public boolean equals(Object obj) {
029 if (this == obj) {
030 return true;
031 }
032
033 if (!(obj instanceof GeoLocationPoint)) {
034 return false;
035 }
036
037 GeoLocationPoint geoLocationPoint = (GeoLocationPoint)obj;
038
039 if (Double.compare(geoLocationPoint.getLatitude(), _latitude) != 0) {
040 return false;
041 }
042
043 if (Double.compare(geoLocationPoint.getLongitude(), _longitude) != 0) {
044 return false;
045 }
046
047 return true;
048 }
049
050 public double getLatitude() {
051 return _latitude;
052 }
053
054 public double getLongitude() {
055 return _longitude;
056 }
057
058 @Override
059 public int hashCode() {
060 long value = Double.doubleToLongBits(_latitude);
061
062 int hashCode = (int) (value ^ (value >>> 32));
063
064 value = Double.doubleToLongBits(_longitude);
065
066 hashCode = 31 * hashCode + (int) (value ^ (value >>> 32));
067
068 return hashCode;
069 }
070
071 private final double _latitude;
072 private final double _longitude;
073
074 }