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.SerializableThis class represents a location in the environment.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description static doubleDEFAULT_TOLERANCEDistance, when two locations are considered near.protected doublexThe x-coordinate.protected doubleyThe y-coordinate.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()Get the hashcode.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()Convert the location to a string representation.
 
- 
- 
- 
Field Detail- 
DEFAULT_TOLERANCEpublic static final double DEFAULT_TOLERANCE Distance, when two locations are considered near.- See Also:
- Constant Field Values
 
 - 
xprotected double x The x-coordinate.
 - 
yprotected double y The y-coordinate.
 
- 
 - 
Method Detail- 
getXpublic double getX() Get the x of this Location. The x-coordinate.- Returns:
- x
 
 - 
setXpublic void setX(double x) Set the x of this Location. The x-coordinate.- Parameters:
- x- the value to be set
 
 - 
getYpublic double getY() Get the y of this Location. The y-coordinate.- Returns:
- y
 
 - 
setYpublic void setY(double y) Set the y of this Location. The y-coordinate.- Parameters:
- y- the value to be set
 
 - 
getDistancepublic double getDistance(Location other) Caculate is a location is near this location.- Returns:
- The distance.
 
 - 
isNearpublic 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.
 
 - 
isNearpublic 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.
 
 - 
toStringpublic java.lang.String toString() Convert the location to a string representation.- Overrides:
- toStringin class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object o) Test if two instances are equal.- Overrides:
- equalsin class- java.lang.Object
- Returns:
- True, if equal.
 
 - 
hashCodepublic int hashCode() Get the hashcode.- Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-