public class Location
extends java.lang.Object
implements java.lang.Cloneable
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 |
---|---|
java.lang.Object |
clone()
Clone the object.
|
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()
Get a string representation of this Location.
|
public static final double DEFAULT_TOLERANCE
protected double x
protected double y
public Location()
public Location(double x, double y)
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 java.lang.String toString()
toString
in class java.lang.Object
public 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 boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object