com.afrigis.services.Coordinate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Core Java library to ease use of AfriGIS Services
package com.afrigis.services;
/**
*
* Represents a decimal GPS coordinate.
*
*
* @author hendrikc
*
*/
public class Coordinate {
private Double latitude;
private Double longitude;
/**
*
* Null constructor.
*
*/
public Coordinate() {
super();
}
/**
* Constructor.
* @param latitudeIn the latitude
* @param longitudeIn the longitude
*/
public Coordinate(Double latitudeIn, Double longitudeIn) {
super();
this.latitude = latitudeIn;
this.longitude = longitudeIn;
}
/**
*
* @return the decimal latitude of the coordinate.
*/
public Double getLatitude() {
return latitude;
}
/**
*
* Sets the decimal latitude.
*
* @param latitudeIn the decimal latitude
*/
public final void setLatitude(Double latitudeIn) {
this.latitude = latitudeIn;
}
/**
*
* Sets the decimal longitude.
*
* @param longitudeIn the decimal longitude
*/
public final void setLongitude(Double longitudeIn) {
this.longitude = longitudeIn;
}
/**
*
* @return the decimal longitude of the coordinate.
*/
public Double getLongitude() {
return longitude;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((latitude == null) ? 0 : latitude.hashCode());
result = prime * result
+ ((longitude == null) ? 0 : longitude.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Coordinate other = (Coordinate) obj;
if (latitude == null) {
if (other.latitude != null) {
return false;
}
} else if (!latitude.equals(other.latitude)) {
return false;
}
if (longitude == null) {
if (other.longitude != null) {
return false;
}
} else if (!longitude.equals(other.longitude)) {
return false;
}
return true;
}
}