Package net.sf.saxon.expr
Class SwitchCaseComparer
java.lang.Object
net.sf.saxon.expr.sort.GenericAtomicComparer
net.sf.saxon.expr.SwitchCaseComparer
- All Implemented Interfaces:
AtomicComparer
A comparer that compares atomic values for equality, with the properties:
- non-comparable types compare false
- NaN compares equal to NaN
Used for comparisons in XQuery Switch expressions
-
Nested Class Summary
Nested classes/interfaces inherited from class net.sf.saxon.expr.sort.GenericAtomicComparer
GenericAtomicComparer.AtomicComparisonFunction
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SwitchCaseComparer
(StringCollator collator, XPathContext context) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compare two AtomicValue objects for equality according to the rules for their data type.provideContext
(XPathContext context) Supply the dynamic context in case this is needed for the comparisonsave()
Create a string representation of this AtomicComparer that can be saved in a compiled package and used to reconstitute the AtomicComparer when the package is reloadedMethods inherited from class net.sf.saxon.expr.sort.GenericAtomicComparer
compareAtomicValues, equals, getCollator, getContext, getStringCollator, hashCode, makeAtomicComparer, makeAtomicComparisonFunction
-
Constructor Details
-
SwitchCaseComparer
-
-
Method Details
-
provideContext
Description copied from class:GenericAtomicComparer
Supply the dynamic context in case this is needed for the comparison- Specified by:
provideContext
in interfaceAtomicComparer
- Overrides:
provideContext
in classGenericAtomicComparer
- Parameters:
context
- the dynamic evaluation context- Returns:
- either the original AtomicComparer, or a new AtomicComparer in which the context is known. The original AtomicComparer is not modified
-
comparesEqual
Compare two AtomicValue objects for equality according to the rules for their data type. UntypedAtomic values are compared as if they were strings; if different semantics are wanted, the conversion must be done by the caller.- Specified by:
comparesEqual
in interfaceAtomicComparer
- Overrides:
comparesEqual
in classGenericAtomicComparer
- Parameters:
a
- the first object to be compared. If it is a StringValue, the collator is used to compare the values, otherwise the value must implement the equals() method.b
- the second object to be compared. This must be comparable with the first object: for example, if one is a string, they must both be strings.- Returns:
- true if the values are equal, false if not
- Throws:
ClassCastException
- if the objects are not comparableNoDynamicContextException
- if no dynamic context has been supplied, and a dynamic context is needed (for example, because the comparison uses the implicit timezone)
-
save
Create a string representation of this AtomicComparer that can be saved in a compiled package and used to reconstitute the AtomicComparer when the package is reloaded- Specified by:
save
in interfaceAtomicComparer
- Overrides:
save
in classGenericAtomicComparer
- Returns:
- a string representation of the AtomicComparer
-