Skip to content

GeographicCoordinate 2.0

Compare
Choose a tag to compare
@kloverde kloverde released this 03 Mar 04:17
  • The Latitude, Longitude and Point classes have always implemented hashCode(), so as to allow their use in HashMaps. Despite this, the classes were mutable, which, as you might know, is incorrect. Given the choice of either making the classes immutable or taking away hashCode(), it was decided to make them immutable. If you are on a previous release and are currently using setters, you will need to refactor your code.
  • As an additional result of hiding the setters in Latitude, Longitude and Point, their no-arg constructors have been removed and the setters have been removed from the GeographicCoordinate interface.
  • The GeographicCoordinateImpl class has been renamed to AbstractGeographicCoordinate to better reflect its nature.
  • As a result of making the coordinate classes immutable, AbstractGeographicCoordinate's no-arg constructor has also been removed. No client code should be impacted, since client code would have been instantiating the Latitude and Longitude classes only.
  • Extending AbstractGeographicCoordinate is now disallowed and is enforced by throwing an exception from its constructors. This is not a client class. No client code should be impacted, since client code would have been instantiating the Latitude and Longitude classes only.
  • GeographicCoordinateException has been changed from a checked exception to a runtime exception. You can now decide for yourself whether to explicitly catch it during instantiation.
  • Added a 'name' field to the Point class
  • Added Direction.NEITHER to Latitude and Longitude to represent the Equator and Prime Meridian, since they are neither north, south, east nor west
  • Added the international foot, U.S. survey foot and yard as units of length to DistanceCalculator
  • Fixed NullPointerException in Latitude/Longitude's .equals() when null was passed