Class SimpleTypeComparison
- All Implemented Interfaces:
EqualityMatcher<AtomicSequence>
- Direct Known Subclasses:
SimpleTypeIdentityComparison
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcompareItems(AtomicValue a1, AtomicValue a2) intbooleanCompare two objects for equalitybooleanstatic SimpleTypeComparisonGet the singleton instance of the classintCompute a hash code for an object
-
Constructor Details
-
SimpleTypeComparison
public SimpleTypeComparison()
-
-
Method Details
-
getInstance
Get the singleton instance of the class- Returns:
- the singleton instance
-
compareSequences
-
compareItems
-
equal
Description copied from interface:EqualityMatcherCompare two objects for equality- Specified by:
equalin interfaceEqualityMatcher<AtomicSequence>- Parameters:
a- one objectb- another object- Returns:
- true if the two objects are deemed equal
-
hash
Description copied from interface:EqualityMatcherCompute a hash code for an object- Specified by:
hashin interfaceEqualityMatcher<AtomicSequence>- Parameters:
a- an object- Returns:
- a hash code, which has the property that if two objects are equal, then they must have the same hash code
-
equalOrIdentical
-