location
Class Location

java.lang.Object
  extended bylocation.Location
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Location
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This represents a physical location (a longitude/latitude pair).

Version:
3.0
Author:
Chien-Liang Fok
See Also:
Serialized Form

Field Summary
private  Latitude latitude
          The latitude.
private  Longitude longitude
          The longitude.
 
Constructor Summary
Location(Latitude lat, Longitude lon)
          Constructor.
Location(Location loc)
          The copy constructor.
 
Method Summary
 java.lang.Object clone()
          This method returns a deep copy of this object.
 double distance(Location l)
          Get the distance in meters from this location to another location.
 boolean equals(java.lang.Object o)
          Determines if another object is equal to this location.
 Latitude getLatitude()
          Accessor method to the latitude.
 Longitude getLongitude()
          Accessor method to the longitude.
 double getX()
          Returns the sexagesimal notation of the longitude of this GPS Location
 double getY()
          Returns the sexagesimal notation of the latitude of this GPS Location
 java.lang.String toString()
          Get a string representation of the location.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

latitude

private Latitude latitude
The latitude.


longitude

private Longitude longitude
The longitude.

Constructor Detail

Location

public Location(Latitude lat,
                Longitude lon)
Constructor.

Parameters:
lat - the host's initial latitude
lon - the host's initial longitude

Location

public Location(Location loc)
The copy constructor.

Method Detail

equals

public boolean equals(java.lang.Object o)
Determines if another object is equal to this location.


getLatitude

public Latitude getLatitude()
Accessor method to the latitude.

Returns:
the current latitude.

getLongitude

public Longitude getLongitude()
Accessor method to the longitude.

Returns:
the current longitude.

getX

public double getX()
Returns the sexagesimal notation of the longitude of this GPS Location

Returns:
the sexagesimal notation of the longitude of this GPS Location

getY

public double getY()
Returns the sexagesimal notation of the latitude of this GPS Location

Returns:
the sexagesimal notation of the latitude of this GPS Location

toString

public java.lang.String toString()
Get a string representation of the location.

Returns:
the string representation of the location.

distance

public double distance(Location l)
Get the distance in meters from this location to another location. The location is obtained by doing a mapping of the degrees longitude and latitude to a linear coordinate system and using the linear distance formula.

Parameters:
l - the other location
Returns:
the distance between this location and l in meters.

clone

public java.lang.Object clone()
This method returns a deep copy of this object.

Returns:
an object