net.agmodel.physical
Class Location

java.lang.Object
  |
  +--net.agmodel.physical.Location2D
        |
        +--net.agmodel.physical.Location
All Implemented Interfaces:
Comparable, Serializable
Direct Known Subclasses:
Place

public class Location
extends Location2D

A location is simply a point on the planet. There may not be a weather station at this point. This abstraction is intended to support GIS type applications where data must be synthesised over a regular grid, irrespective of the location of individual stations The class is made final because it overrides the equals method. If any classes extend this and add a field then the equals method of this class is likely to not be transitive.

See Also:
Serialized Form

Field Summary
static Location UNKNOWN
           
 
Fields inherited from class net.agmodel.physical.Location2D
latitude, longitude, nf
 
Constructor Summary
Location(double latitude, double longitude, double altitude)
           
 
Method Summary
 int compareTo(Object a)
          More northerly locations sort first.
 boolean equals(Object o)
          Tests whether two objects represent the same Location.
 double getAltitude()
           
 int hashCode()
           
 String toString()
           
 
Methods inherited from class net.agmodel.physical.Location2D
getLatitude, getLongitude, isUnknown
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNKNOWN

public static final Location UNKNOWN
Constructor Detail

Location

public Location(double latitude,
                double longitude,
                double altitude)
         throws IllegalArgumentException
Method Detail

toString

public String toString()
Overrides:
toString in class Location2D

getAltitude

public double getAltitude()

compareTo

public int compareTo(Object a)
More northerly locations sort first. If latitude is the same, more more westerly (lesser longitude) locations sort first. If latitude and longitude are the same, boxes with higher altitude sort first.

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class Location2D

equals

public boolean equals(Object o)
Tests whether two objects represent the same Location.

Overrides:
equals in class Location2D
Parameters:
o - the other object
Returns:
true if the other object is a Location with the same latitude, longitude, and altitude

hashCode

public int hashCode()
Overrides:
hashCode in class Location2D