All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JBMSTours.serializabletypes.Location

java.lang.Object
   |
   +----JBMSTours.serializabletypes.Location

public class Location
extends Object
implements Serializable
Look at the Source.

The Location class includes stores longitude and latitude information. In this application, part of the City object.

See Also:
City

Constructor Index

 o Location()
Construct a Location at 0N 0E.
 o Location(int, int, String, int, int, String)
Constructs a Location object.

Method Index

 o compareTo(Object)
This method allows a Location object to be orderable within SQL-J statements.
 o equals(Object)
For correct = comparisons.
 o getDistance(Location)
Determine the distance (in miles) between this location and another one.
 o getEastWestOrderableLocation()
Get the decimal longitude for comparing locations by east/west relative location.
 o getLatitudeDegrees()
 o getLatitudeDir()
 o getLatitudeMinutes()
 o getLongitudeDegrees()
 o getLongitudeDir()
 o getLongitudeMinutes()
 o getNorthSouthOrderableLocation()
Get the decimal latitude for comparing locations by north/south relative location.
 o hashCode()
 o isTropical()
Determine if the location is tropical or not.
 o toString()
Convert the object to a string.

Constructors

 o Location
 public Location()
Construct a Location at 0N 0E.

 o Location
 public Location(int latDeg,
                 int latMin,
                 String latDir,
                 int longDeg,
                 int longMin,
                 String longDir)
Constructs a Location object.

Parameters:
latDeg - degrees latitude
latMin - minutes latitude
latDir - "N" or "S" for latitude
longDeg - degrees longitude
longMin - minutes longitude
longDir - "E" or "W" for latitude

Methods

 o toString
 public String toString()
Convert the object to a string.

Returns:
string representation of the object.
Overrides:
toString in class Object
 o getLatitudeDegrees
 public int getLatitudeDegrees()
 o getLatitudeMinutes
 public int getLatitudeMinutes()
 o getLongitudeDegrees
 public int getLongitudeDegrees()
 o getLongitudeMinutes
 public int getLongitudeMinutes()
 o getLatitudeDir
 public String getLatitudeDir()
 o getLongitudeDir
 public String getLongitudeDir()
 o getDistance
 public int getDistance(Location b)
Determine the distance (in miles) between this location and another one. Computes the distance using the great circle formula, which is not entirely precise but reasonably accurate. 69.16 is the number of miles in a degree.

Parameters:
b - the other location
 o isTropical
 public boolean isTropical()
Determine if the location is tropical or not.

Returns:
true if the location is tropical.
 o getNorthSouthOrderableLocation
 public double getNorthSouthOrderableLocation()
Get the decimal latitude for comparing locations by north/south relative location.

Returns:
the latitude as a comparable value
 o getEastWestOrderableLocation
 public double getEastWestOrderableLocation()
Get the decimal longitude for comparing locations by east/west relative location.

Returns:
the longitude as a comparable value
 o compareTo
 public int compareTo(Object o) throws ClassCastException
This method allows a Location object to be orderable within SQL-J statements.

Returns -1 if this object is "less than" the parameter, 1 if this object is "greater than" the parameter, and "0" if they are equal.

We have arbitrarily decided to order Locations by their latitudes (from North to South), and secondarily by their longitudes (from East to West).

Throws: ClassCastException
Thrown if the objects cannot be compared.
See Also:
City
 o equals
 public boolean equals(Object o)
For correct = comparisons.

Overrides:
equals in class Object
 o hashCode
 public int hashCode()
Overrides:
hashCode in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index