Class Location
- java.lang.Object
-
- jadex.bdi.examples.cleanerworld_classic.Location
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Location extends java.lang.Object implements java.lang.CloneableEditable Java class for concept Location of cleaner-generated ontology.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_TOLERANCEDistance, when two locations are considered near.protected doublexThe x-coordinate.protected doubleyThe y-coordinate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clone the object.booleanequals(java.lang.Object o)Test if two instances are equal.doublegetDistance(Location other)Caculate is a location is near this location.doublegetX()Get the x of this Location.doublegetY()Get the y of this Location.inthashCode()booleanisNear(Location other)Check, if two locations are near to each other using the default tolerance.booleanisNear(Location other, double tolerance)Check, if two locations are near to each other.voidsetX(double x)Set the x of this Location.voidsetY(double y)Set the y of this Location.java.lang.StringtoString()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:
toStringin 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.
-
clone
public java.lang.Object clone()
Clone the object.- Overrides:
clonein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
Test if two instances are equal.- Overrides:
equalsin classjava.lang.Object- Returns:
- True, if equal.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-