Class Location
- java.lang.Object
-
- jadex.bdiv3.examples.cleanerworld.world.Location
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Location extends java.lang.Object implements java.lang.Cloneable
Editable Java class for concept Location of cleaner-generated ontology.
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_TOLERANCE
Distance, when two locations are considered near.protected double
x
The x-coordinate.protected double
y
The y-coordinate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
DEFAULT_TOLERANCE
public static final double DEFAULT_TOLERANCE
Distance, when two locations are considered near.- See Also:
- Constant Field Values
-
x
protected double x
The x-coordinate.
-
y
protected double y
The y-coordinate.
-
-
Method Detail
-
getX
public double getX()
Get the x of this Location. The x-coordinate.- Returns:
- x
-
setX
public void setX(double x)
Set the x of this Location. The x-coordinate.- Parameters:
x
- the value to be set
-
getY
public double getY()
Get the y of this Location. The y-coordinate.- Returns:
- y
-
setY
public void setY(double y)
Set the y of this Location. The y-coordinate.- Parameters:
y
- the value to be set
-
toString
public java.lang.String toString()
Get a string representation of this Location.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string representation.
-
getDistance
public double getDistance(Location other)
Caculate is a location is near this location.- Returns:
- The distance.
-
isNear
public boolean isNear(Location other)
Check, if two locations are near to each other using the default tolerance.- Returns:
- True, if two locations are near to each other.
-
isNear
public boolean isNear(Location other, double tolerance)
Check, if two locations are near to each other.- Parameters:
tolerance
- The distance, when two locations are considered near.- Returns:
- True, if two locations are near to each other.
-
equals
public boolean equals(java.lang.Object o)
Test if two instances are equal.- Overrides:
equals
in classjava.lang.Object
- Returns:
- True, if equal.
-
hashCode
public int hashCode()
Get the hashcode.- Overrides:
hashCode
in classjava.lang.Object
-
clone
public java.lang.Object clone()
Clone the object.- Overrides:
clone
in classjava.lang.Object
-
-