twitter4j
Class GeoLocation

java.lang.Object
  extended by twitter4j.GeoLocation
All Implemented Interfaces:
java.io.Serializable

public class GeoLocation
extends java.lang.Object
implements java.io.Serializable

A data class representing geo location.

Author:
Yusuke Yamamoto - yusuke at mac.com
See Also:
Serialized Form

Field Summary
protected  double latitude
           
protected  double longitude
           
private static long serialVersionUID
           
 
Constructor Summary
GeoLocation(double latitude, double longitude)
          Creates a GeoLocation instance
 
Method Summary
(package private) static GeoLocation[][] coordinatesAsGeoLocationArray(twitter4j.internal.org.json.JSONArray coordinates)
           
 boolean equals(java.lang.Object o)
           
(package private) static GeoLocation getInstance(twitter4j.internal.org.json.JSONObject json)
          returns a GeoLocation instance if a "geo" element is found.
 double getLatitude()
          returns the latitude of the geo location
 double getLongitude()
          returns the longitude of the geo location
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

latitude

protected double latitude

longitude

protected double longitude

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

GeoLocation

public GeoLocation(double latitude,
                   double longitude)
Creates a GeoLocation instance

Parameters:
latitude - the latitude
longitude - the longitude
Method Detail

getInstance

static GeoLocation getInstance(twitter4j.internal.org.json.JSONObject json)
                        throws TwitterException
returns a GeoLocation instance if a "geo" element is found.

Parameters:
json - JSONObject to be parsed
Returns:
GeoLocation instance
Throws:
TwitterException - when coordinates is not included in geo element (should be an API side issue)

coordinatesAsGeoLocationArray

static GeoLocation[][] coordinatesAsGeoLocationArray(twitter4j.internal.org.json.JSONArray coordinates)
                                              throws TwitterException
Throws:
TwitterException

getLatitude

public double getLatitude()
returns the latitude of the geo location

Returns:
the latitude

getLongitude

public double getLongitude()
returns the longitude of the geo location

Returns:
the longitude

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object