JTS Topology Suite - v 1.12

## com.vividsolutions.jts.geom
Class Coordinate.DimensionalComparator

    java.lang.Object
      com.vividsolutions.jts.geom.Coordinate.DimensionalComparator

All Implemented Interfaces:
  java.util.Comparator

Enclosing class:
  Coordinate

    public static class Coordinate.DimensionalComparator

extends java.lang.Object
implements java.util.Comparator

Compares two `Coordinate`s, allowing for either a 2-dimensional or 3-dimensional comparison, and handling NaN values correctly.

Constructor Summary
`Coordinate.DimensionalComparator()` Creates a comparator for 2 dimensional coordinates.
`Coordinate.DimensionalComparator(int dimensionsToTest)` Creates a comparator for 2 or 3 dimensional coordinates, depending on the value provided.

Method Summary
`static int` `compare(double a, double b)` Compare two `double`s, allowing for NaN values.
`int` `compare(java.lang.Object o1, java.lang.Object o2)` Compares two `Coordinate`s 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`

Methods inherited from interface java.util.Comparator
`equals`

Constructor Detail

### Coordinate.DimensionalComparator

    public Coordinate.DimensionalComparator()

  Creates a comparator for 2 dimensional coordinates.

### Coordinate.DimensionalComparator

    public Coordinate.DimensionalComparator(int dimensionsToTest)

  Creates a comparator for 2 or 3 dimensional coordinates, depending on the value provided.

  Parameters:
    `dimensionsToTest` - the number of dimensions to test

Method Detail

### compare

    public static int compare(double a,
                              double b)

  Compare two `double`s, allowing for NaN values. NaN is treated as being less than any valid number.

  Parameters:
    `a` - a `double`
    `b` - a `double`
  Returns:
    -1, 0, or 1 depending on whether a is less than, equal to or greater than b

### compare

    public int compare(java.lang.Object o1,
                       java.lang.Object o2)

  Compares two `Coordinate`s along to the number of dimensions specified.

  Specified by:
    `compare` in interface `java.util.Comparator`
  Parameters:
    `o1` - a `Coordinate`
    `o2` - a {link Coordinate}
  Returns:
    -1, 0, or 1 depending on whether o1 is less than, equal to, or greater than 02

JTS Topology Suite - v 1.12