Class Longitude
java.lang.Object
rgu.transport.geospatial.Longitude
- All Implemented Interfaces:
Comparable<Longitude>
Represents a Longitude from -180 degrees (exclusive) to +180 degrees (inclusive) to 7 decimal
places.
- Author:
- Lee A. Christie
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintCompares two longitudes numerically.Returns the longitude as a decimal to 7 decimal places.doubleReturns the longitude as a double.booleanReturns true if the other object is the same longitude value.inthashCode()Returns a hash code for this longitude.static Longitudeof(BigDecimal decimal) Returns a longitude of the specified decimal value.static LongitudeofRounded(double value) Rounds the specified double to a longitude.static LongitudeparseLongitude(String string) Parses the specified string to a longitude.static LongitudeparseLongitudeTruncate(String string) Parses the specified string to a longitude.static LongitudeReads a longitude from the specified input stream.toString()Returns a String object representing this longitude's value.voidwrite(ObjectOutputStream out) Writes this longitude to the specified output stream.
-
Field Details
-
PRIME_MERIDIAN
The value 0.
-
-
Method Details
-
parseLongitude
-
of
Returns a longitude of the specified decimal value.- Parameters:
decimal- the longitude as a decimal- Returns:
- a Longitude
-
ofRounded
Rounds the specified double to a longitude.- Parameters:
value- the longitude as a double, finite- Returns:
- a Longitude
-
parseLongitudeTruncate
-
decimalValue
Returns the longitude as a decimal to 7 decimal places. For example parseLongitude("-2.0943").doubleValue() returns -2.0943000- Returns:
- the longitude as a decimal
-
doubleValue
public double doubleValue()Returns the longitude as a double. For example parseLongitude("-2.0943").doubleValue() returns -2.0943- Returns:
- the longitude as a double
-
hashCode
-
equals
-
toString
-
compareTo
Compares two longitudes numerically.- Specified by:
compareToin interfaceComparable<Longitude>- Returns:
- 0 if this longitude is the same as the other longitude, less than 0 if less, or greater than 0 if greater than the other longitude.
-
write
Writes this longitude to the specified output stream.- Parameters:
out- the output stream, not null- Throws:
IOException- if an exception occurred writing
-
read
Reads a longitude from the specified input stream.- Parameters:
in- the input stream, not null- Returns:
- the longitude
- Throws:
IOException- if an exception occurred reading
-