public class SimpleTypeComparison extends java.lang.Object implements EqualityMatcher<AtomicSequence>
For ordered data types, the compare() functions follow the usual convention: the return
value is -1, 0, or +1 according as the first value is less than, equal to, or greater
than the second. For non-ordered data types, if the values are not equal then the functions
return SequenceTool.INDETERMINATE_ORDERING.
The class can be used directly to perform comparison between atomic values and sequences.
It can also be used to parameterise a CustomSet or CustomMap, to provide
a set or map that uses explicit equals() logic rather than relying on the equals()
and hashCode() methods of the supplied objects - thus avoiding the need to create
wrapper objects purely to redefine equality semantics.
The class is a singleton that cannot be externally instantiated.
| Constructor and Description |
|---|
SimpleTypeComparison() |
| Modifier and Type | Method and Description |
|---|---|
int |
compareItems(AtomicValue a1,
AtomicValue a2) |
int |
compareSequences(AtomicSequence a1,
AtomicSequence a2) |
boolean |
equal(AtomicSequence a,
AtomicSequence b)
Compare two objects for equality
|
boolean |
equalOrIdentical(AtomicSequence a1,
AtomicSequence a2) |
static SimpleTypeComparison |
getInstance()
Get the singleton instance of the class
|
int |
hash(AtomicSequence a)
Compute a hash code for an object
|
public static SimpleTypeComparison getInstance()
public int compareSequences(AtomicSequence a1, AtomicSequence a2)
public int compareItems(AtomicValue a1, AtomicValue a2)
public boolean equal(AtomicSequence a, AtomicSequence b)
EqualityMatcherequal in interface EqualityMatcher<AtomicSequence>a - one objectb - another objectpublic int hash(AtomicSequence a)
EqualityMatcherhash in interface EqualityMatcher<AtomicSequence>a - an objectpublic boolean equalOrIdentical(AtomicSequence a1, AtomicSequence a2)
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.