|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.saxon.expr.sort.NumericComparer
public class NumericComparer
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. NaN values compare equal to each other, and equal to an empty sequence, but less than anything else.
This class is used in XSLT only, so there is no need to handle XQuery's "empty least" vs "empty greatest" options.
| Field Summary | |
|---|---|
protected StringToDouble |
converter
|
| Constructor Summary | |
|---|---|
protected |
NumericComparer()
|
| Method Summary | |
|---|---|
int |
compareAtomicValues(AtomicValue a,
AtomicValue b)
Compare two Items by converting them to numbers and comparing the numeric values. |
boolean |
comparesEqual(AtomicValue a,
AtomicValue b)
Compare two AtomicValue objects for equality according to the rules for their data type. |
StringCollator |
getCollator()
Get the collation used by this AtomicComparer if any |
ComparisonKey |
getComparisonKey(AtomicValue a)
Get a comparison key for an object. |
static NumericComparer |
getInstance()
|
AtomicComparer |
provideContext(XPathContext context)
Supply the dynamic context in case this is needed for the comparison |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected StringToDouble converter
| Constructor Detail |
|---|
protected NumericComparer()
| Method Detail |
|---|
public static NumericComparer getInstance()
public StringCollator getCollator()
AtomicComparer
getCollator in interface AtomicComparerpublic AtomicComparer provideContext(XPathContext context)
provideContext in interface AtomicComparercontext - the dynamic evaluation context
public int compareAtomicValues(AtomicValue a,
AtomicValue b)
compareAtomicValues in interface AtomicComparera - the first Item to be compared.b - the second Item to be compared.
ClassCastException - if the objects are not Items
public boolean comparesEqual(AtomicValue a,
AtomicValue b)
comparesEqual in interface AtomicComparera - the first object to be compared.b - the second object to be compared.
ClassCastException - if the objects are not comparablepublic ComparisonKey getComparisonKey(AtomicValue a)
getComparisonKey in interface AtomicComparer
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||