Class Landmark

java.lang.Object
  |
  +--Landmark
All Implemented Interfaces:
Locatable

public class Landmark
extends java.lang.Object
implements Locatable

This class implements Locations with names.


Constructor Summary
Landmark(java.lang.String tag, double lat, double lon)
          Create a new Landmark object with the given name located at the given location.
 
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 position.
 java.lang.String getName()
          Return the name of this Landmark.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Landmark

public Landmark(java.lang.String tag,
                double lat,
                double lon)
Create a new Landmark object with the given name located at the given location. This constructor stores the name of the Landmark in a private instance variable, and creates a new Location object using the supplied lat and lon values, then stores a reference to that in another private instance variable.

Parameters:
tag - the Landmark's name
lat - the latitude where this Landmark is located. Must satisfy the constraints defined by the Location class.
lon - the longitude where this Landmark is located. Must satisfy the constraints defined by the Location class.
Method Detail

getLocation

public Location getLocation()
Return a reference to a copy of the Location object describing our position.

Specified by:
getLocation in interface Locatable
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.

Specified by:
setLocation in interface Locatable
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.

Specified by:
setLocation in interface Locatable
Parameters:
lat - the new latitude value
lon - the new longitude value

distanceTo

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

Specified by:
distanceTo in interface Locatable
Parameters:
other - the other Location
Returns:
the distance in meters to the other object

getName

public java.lang.String getName()
Return the name of this Landmark.

Returns:
the name