Class SimpleTypeComparison

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public class SimpleTypeComparison
    extends java.lang.Object
    implements EqualityMatcher<AtomicSequence>
    This class implements equality and ordering comparisons between values of simple types: that is, atomic values, and sequences of atomic values, following the XSD-defined rules for equality and ordering comparisons. These are not always the same as the XPath-defined rules. In particular, under XSD rules values are generally only comparable with others of the same primitive type; a double and a float, for example, never compare equal.

    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.