Class Location
- java.lang.Object
-
- jadex.bdi.examples.marsworld_classic.Location
-
- All Implemented Interfaces:
java.io.Serializable
public class Location extends java.lang.Object implements java.io.Serializable
This class represents a location in the environment.- See Also:
- Serialized Form
-
-
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 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.
-
-
-
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
-
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.
-
toString
public java.lang.String toString()
Convert the location to a string representation.- Overrides:
toString
in classjava.lang.Object
-
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
-
-