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
-
Location()
- Construct a Location at 0N 0E.
-
Location(int, int, String, int, int, String)
- Constructs a Location object.
-
compareTo(Object)
- This method allows a Location object to be orderable within SQL-J
statements.
-
equals(Object)
- For correct = comparisons.
-
getDistance(Location)
- Determine the distance (in miles) between this location and another one.
-
getEastWestOrderableLocation()
- Get the decimal longitude for comparing locations by
east/west relative location.
-
getLatitudeDegrees()
-
-
getLatitudeDir()
-
-
getLatitudeMinutes()
-
-
getLongitudeDegrees()
-
-
getLongitudeDir()
-
-
getLongitudeMinutes()
-
-
getNorthSouthOrderableLocation()
- Get the decimal latitude for comparing locations by
north/south relative location.
-
hashCode()
-
-
isTropical()
- Determine if the location is tropical or not.
-
toString()
- Convert the object to a string.
Location
public Location()
- Construct a Location at 0N 0E.
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
toString
public String toString()
- Convert the object to a string.
- Returns:
- string representation of the object.
- Overrides:
- toString in class Object
getLatitudeDegrees
public int getLatitudeDegrees()
getLatitudeMinutes
public int getLatitudeMinutes()
getLongitudeDegrees
public int getLongitudeDegrees()
getLongitudeMinutes
public int getLongitudeMinutes()
getLatitudeDir
public String getLatitudeDir()
getLongitudeDir
public String getLongitudeDir()
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
isTropical
public boolean isTropical()
- Determine if the location is tropical or not.
- Returns:
- true if the location is tropical.
getNorthSouthOrderableLocation
public double getNorthSouthOrderableLocation()
- Get the decimal latitude for comparing locations by
north/south relative location.
- Returns:
- the latitude as a comparable value
getEastWestOrderableLocation
public double getEastWestOrderableLocation()
- Get the decimal longitude for comparing locations by
east/west relative location.
- Returns:
- the longitude as a comparable value
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
equals
public boolean equals(Object o)
- For correct = comparisons.
- Overrides:
- equals in class Object
hashCode
public int hashCode()
- Overrides:
- hashCode in class Object
All Packages Class Hierarchy This Package Previous Next Index