Interface Locatable

All Known Implementing Classes:
Landmark, LocatedVehicle

public interface Locatable

This interface defines the methods that a class must implement in order to be locatable in a 2-dimensional latitude / longitude world.


Method Summary
 double distanceTo(Locatable other)
          Calculate the distance to another Locatable object
 Location getLocation()
          Return a reference to a copy of the Location object describing our current position.
 void setLocation(double lat, double lon)
          Set the values of our current Location by copying them from the arguments provided.
 void setLocation(Location loc)
          Set the values of our current Location by copying them from the given Location object.
 

Method Detail

getLocation

public Location getLocation()
Return a reference to a copy of the Location object describing our current position. Note that this method should not return a reference to our own Location object, since Locations can be changed by anyone with a reference to them.

Returns:
a copy of the Location object for this object

setLocation

public void setLocation(Location loc)
Set the values of our current Location by copying them from the given Location object.

Parameters:
loc - the location to copy from

setLocation

public void setLocation(double lat,
                        double lon)
Set the values of our current Location by copying them from the arguments provided. The arguments must satisfy the constraints imposed by the Location class.

Parameters:
lat - the new latitude value
lon - the new longitude value

distanceTo

public double distanceTo(Locatable other)
Calculate the distance to another Locatable object

Parameters:
other - the other Location
Returns:
the distance in meters to the other object