|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.oopitis.weather.GeoLocation
public class GeoLocation
An object of this class represents either a specific geographical location or
locations that share the same attributes. Objects of this class or its
subclasses appear in the queries in WeatherService as well as
in WeatherReport objects. How these objects are created and
interpreted may be specific to the service that provides them. Without
extending, this class can be instantiated with a latitude and a longitude in
signed degrees.
All get methods in this class can return null if
the requested information is not applicable or available, but at least one
of them should return a non-null object.
| Nested Class Summary | |
|---|---|
static class |
GeoLocation.Coordinates
Geographical coordinates for a location. |
| Constructor Summary | |
|---|---|
|
GeoLocation(float latitude,
float longitude)
Constructs a GeoLocation with geographical coordinates. |
protected |
GeoLocation(java.lang.String id,
java.lang.String city,
java.lang.String region,
java.lang.String zipCode,
java.util.Locale locale,
GeoLocation.Coordinates coordinates)
Constructs a GeoLocation with one or more associated
attributes. |
| Method Summary | |
|---|---|
static java.lang.String |
formatCoordinate(float f)
Formats a coordinate. |
java.lang.String |
getCity()
Returns the name of the city that contains this location. |
GeoLocation.Coordinates |
getCoordinates()
Returns the geographical coordinates of this location. |
java.lang.String |
getId()
Returns the service-specific ID of this location. |
java.util.Locale |
getLocale()
Returns the locale of this location. |
java.lang.String |
getRegion()
Returns the name of the county or state that contains this location. |
java.lang.String |
getZipCode()
Returns the zip code of this location. |
static GeoLocation.Coordinates |
newCoordinates(float latitude,
float longitude)
Creates a new Coordinates object. |
java.lang.String |
toString()
Returns a string representation of this location. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected GeoLocation(java.lang.String id,
java.lang.String city,
java.lang.String region,
java.lang.String zipCode,
java.util.Locale locale,
GeoLocation.Coordinates coordinates)
GeoLocation with one or more associated
attributes. All arguments are optional, but at least one of them must
not be null.
id - the service-specific ID that identifies the locationcity - the name of the city that contains this locationregion - the region that contains the city; for example, a county or
statezipCode - the zip code of the locationlocale - the locale of the location. When provided, most likely
only the country code of the locale is in use.coordinates - the geographical coordinates of the location
java.lang.NullPointerException - if all arguments are null
public GeoLocation(float latitude,
float longitude)
GeoLocation with geographical coordinates.
latitude - the latitudelongitude - the longitude
java.lang.IllegalArgumentException - if the latitude or longitude is out
of range| Method Detail |
|---|
public static GeoLocation.Coordinates newCoordinates(float latitude,
float longitude)
Coordinates object.
latitude - the latitudelongitude - the longitude
Coordinates object
java.lang.IllegalArgumentException - if the latitude or longitude is out
of rangepublic java.lang.String getId()
null if
unavailablepublic java.lang.String getCity()
null if unavailablepublic java.lang.String getRegion()
null if unavailablepublic java.lang.String getZipCode()
null if unavailablepublic java.util.Locale getLocale()
null if unavailablepublic GeoLocation.Coordinates getCoordinates()
null
if unavailablepublic static java.lang.String formatCoordinate(float f)
DecimalFormat with
pattern "###.######".
f - the latitude or longitude
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||