## net.sf.saxon.sort
Class NumericComparer

    java.lang.Object
      |
      +--net.sf.saxon.sort.NumericComparer

All Implemented Interfaces:
  java.util.Comparator, java.io.Serializable

public class NumericComparer
extends java.lang.Object
implements java.util.Comparator, java.io.Serializable

A Comparer used for comparing sort keys when data-type="number". The items to be compared are converted to numbers, and the numbers are then compared directly

See Also:
  Serialized Form

Constructor Summary
`NumericComparer()`

Method Summary
`int` `compare(java.lang.Object a, java.lang.Object b)` Compare two Items by converting them to numbers and comparing the numeric values.

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

### NumericComparer

    public NumericComparer()

Method Detail

### compare

    public int compare(java.lang.Object a,
                       java.lang.Object b)

  Compare two Items by converting them to numbers and comparing the numeric values. If either value cannot be converted to a number, it is treated as NaN, and compares less that the other (two NaN values compare equal).

  Specified by:
    `compare` in interface `java.util.Comparator`
  Parameters:
    `a` - the first Item to be compared.
    `b` - the second Item to be compared.
  Returns:
    <0 if a<b, 0 if a=b, >0 if a>b
  Throws:
    `java.lang.ClassCastException` - if the objects are not Items