public class Location
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_TOLERANCE
Distance, when two locations are considered near.
|
protected double |
x
The x-coordinate.
|
protected double |
y
The y-coordinate.
|
Constructor and Description |
---|
Location()
Create a new location.
|
Location(double x,
double y)
Create a new location.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Test if two instances are equal.
|
double |
getDistance(Location other)
Caculate is a location is near this location.
|
double |
getX()
Get the x of this Location.
|
double |
getY()
Get the y of this Location.
|
int |
hashCode()
Get the hashcode.
|
boolean |
isNear(Location other)
Check, if two locations are near to each other
using the default tolerance.
|
boolean |
isNear(Location other,
double tolerance)
Check, if two locations are near to each other.
|
void |
setX(double x)
Set the x of this Location.
|
void |
setY(double y)
Set the y of this Location.
|
java.lang.String |
toString()
Convert the location to a string representation.
|
public static final double DEFAULT_TOLERANCE
protected double x
protected double y
public Location()
public Location(double x, double y)
x
- The x coordinate.y
- The y coordinate.public double getX()
public void setX(double x)
x
- the value to be setpublic double getY()
public void setY(double y)
y
- the value to be setpublic double getDistance(Location other)
public boolean isNear(Location other)
public boolean isNear(Location other, double tolerance)
tolerance
- The distance, when two locations are considered near.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object