org.geomajas.geometry
Class Coordinate.CoordinateComparator
java.lang.Object
org.geomajas.geometry.Coordinate.CoordinateComparator
- All Implemented Interfaces:
- Comparator
- Enclosing class:
- Coordinate
public static class Coordinate.CoordinateComparator
- extends Object
- implements Comparator
Compares two Coordinates, allowing for either a 2-dimensional or 3-dimensional comparison, and handling
NaN values correctly.
|
Method Summary |
static int |
compare(double a,
double b)
Compare two doubles, allowing for NaN values. |
int |
compare(Object o1,
Object o2)
Compares two Coordinates along to the number of dimensions specified. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Coordinate.CoordinateComparator
public Coordinate.CoordinateComparator()
- Creates a comparator for 2 dimensional coordinates.
compare
public static int compare(double a,
double b)
- Compare two
doubles, allowing for NaN values. NaN is treated as being less than any valid
number.
- Parameters:
a - a doubleb - a double
- Returns:
- -1, 0, or 1 depending on whether a is less than, equal to or greater than b
compare
public int compare(Object o1,
Object o2)
- Compares two
Coordinates along to the number of dimensions specified.
- Specified by:
compare in interface Comparator
- Parameters:
o1 - a Coordinateo2 - a {link Coordinate}
- Returns:
- -1, 0, or 1 depending on whether o1 is less than, equal to, or greater than 02
Copyright © 2010 Geosparc. All Rights Reserved.