Class GeoComparator
java.lang.Object
org.deltava.comparators.GeoComparator
- All Implemented Interfaces:
Serializable
,Comparator<GeoLocation>
A comparator to sort geographic locations by their distance from a fixed point.
- Since:
- 1.0
- Version:
- 8.6
- Author:
- Luke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGeoComparator
(GeoLocation loc) Creates a new GeoComparator, comparing distance from an arbitrary location.GeoComparator
(GeoLocation loc, boolean useFeet) Creates a new GeoComparator, comparing distance from an arbitrary location. -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(GeoLocation l1, GeoLocation l2) Returns the reference location.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
GeoComparator
Creates a new GeoComparator, comparing distance from an arbitrary location.- Parameters:
loc
- the location
-
GeoComparator
Creates a new GeoComparator, comparing distance from an arbitrary location.- Parameters:
loc
- the locationuseFeet
- TRUE if the calculation should be measured in feet, otherwise FALSE for miles
-
-
Method Details
-
getLocation
-
compare
- Specified by:
compare
in interfaceComparator<GeoLocation>
-