Location { public static double normalizeLongitude(double degrees) { double lon = degrees % 360; return lon > 180 ? lon - 360 : (lon < -180 ? 360 + lon : lon); } Location();  Location(double latitude, double longitude);  Location(Location location); static Location fromDegrees(double latitudeDegrees, double longitudeDegrees); static Location fromRadians(double latitudeRadians, double longitudeRadians); static Location fromTimeZone(TimeZone timeZone); static double normalizeLatitude(double degrees); static double normalizeLongitude(double degrees); static double clampLatitude(double degrees); static double clampLongitude(double degrees); static boolean locationsCrossAntimeridian(List<? extends Location> locations); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); Location set(double latitude, double longitude); Location set(Location location); Location interpolateAlongPath(Location endLocation, @WorldWind.PathType int pathType, double amount,
                                         Location result); double greatCircleAzimuth(Location location); double greatCircleDistance(Location location); Location greatCircleLocation(double azimuthDegrees, double distanceRadians, Location result); double rhumbAzimuth(Location location); double rhumbDistance(Location location); Location rhumbLocation(double azimuthDegrees, double distanceRadians, Location result); double linearAzimuth(Location location); double linearDistance(Location location); Location linearLocation(double azimuthDegrees, double distanceRadians, Location result); public double latitude; public double longitude; }
@Test public void testNormalizeLongitude() throws Exception { assertEquals("zero", 0.0, Location.normalizeLongitude(0.0), 0); assertEquals("270", -90.0, Location.normalizeLongitude(270.0), 0); assertEquals("-270", 90.0, Location.normalizeLongitude(-270.0), 0); assertEquals("179", 179.0, Location.normalizeLongitude(179.0), 0); assertEquals("180", 180.0, Location.normalizeLongitude(180.0), 0); assertEquals("181", -179.0, Location.normalizeLongitude(181.0), 0); assertEquals("1", 1.0, Location.normalizeLongitude(1.0), 0); assertEquals("-1", -1.0, Location.normalizeLongitude(-1.0), 0); assertEquals("359", -1.0, Location.normalizeLongitude(359.0), 0); assertEquals("360", 0.0, Location.normalizeLongitude(360.0), 0); assertEquals("361", 1.0, Location.normalizeLongitude(361.0), 0); assertEquals("719", -1.0, Location.normalizeLongitude(719.0), 0); assertEquals("720", 0.0, Location.normalizeLongitude(720.0), 0); assertEquals("721", 1.0, Location.normalizeLongitude(721.0), 0); assertEquals("-180", -180.0, Location.normalizeLongitude(-180.0), 0); assertTrue("NaN", Double.isNaN(Location.normalizeLongitude(Double.NaN))); }