Package net.sf.saxon.functions
Class CollatingFunctionFixed
- java.lang.Object
-
- net.sf.saxon.functions.AbstractFunction
-
- net.sf.saxon.functions.SystemFunction
-
- net.sf.saxon.functions.CollatingFunctionFixed
-
- All Implemented Interfaces:
Callable
,StatefulSystemFunction
,Function
,GroundedValue
,Item
,Sequence
- Direct Known Subclasses:
CollationKeyFn
,Compare
,Contains
,ContainsToken
,DeepEqual
,DistinctValues
,EndsWith
,IndexOf
,Minimax
,StartsWith
,SubstringAfter
,SubstringBefore
public abstract class CollatingFunctionFixed extends SystemFunction implements StatefulSystemFunction
Abstract superclass for functions that take an optional collation argument, in which the collation is not present as an explicit argument, either because it was defaulted in the original function call, or because it has been bound during static analysis.
-
-
Constructor Summary
Constructors Constructor Description CollatingFunctionFixed()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CollatingFunctionFixed
copy()
Make a copy of this SystemFunction.void
exportAttributes(ExpressionPresenter out)
Export any context attributes held within the SystemFunction object.AtomicComparer
getAtomicComparer(XPathContext context)
During evaluation, get the pre-allocated atomic comparer if available, or allocate a new one otherwiseAtomicComparer
getPreAllocatedAtomicComparer()
Get the pre-allocated atomic comparer, if availableStringCollator
getStringCollator()
Get the collation if known statically, as a StringCollator objectvoid
importAttributes(java.util.Properties attributes)
Import any attributes found in the export file, that is, any attributes output using the exportAttributes methodboolean
isSubstringMatchingFunction()
Ask whether this function needs a collation that can handle substring matchingprotected void
preAllocateComparer(AtomicType type0, AtomicType type1, StaticContext env)
During static analysis, if types are known and the collation is known, pre-allocate a comparer for comparing atomic values.void
setCollationName(java.lang.String collationName)
void
setRetainedStaticContext(RetainedStaticContext retainedStaticContext)
Set the static context in which the function operates, for use with functions whose result depends on the static context-
Methods inherited from class net.sf.saxon.functions.SystemFunction
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, fixArguments, getArity, getCardinality, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, getUniStringArg, hashCode, isSequenceVariadic, isTrustedResultType, makeCall, makeFunction, makeFunctionCall, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, supplyTypeInformation, toShortString, toString, typeCheckCaller
-
Methods inherited from class net.sf.saxon.functions.AbstractFunction
atomize, deepEquals, effectiveBooleanValue, getAnnotations, getSerialNumber, getUnicodeStringValue, isArray, isMap, makeNewContext, simplify, typeCheck
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Method Detail
-
isSubstringMatchingFunction
public boolean isSubstringMatchingFunction()
Ask whether this function needs a collation that can handle substring matching- Returns:
- true in the case of functions such as contains() and starts-with() where substring matching is required. Returns false by default;
-
getStringCollator
public StringCollator getStringCollator()
Get the collation if known statically, as a StringCollator object- Returns:
- a StringCollator. Return null if the collation is not known statically.
-
setRetainedStaticContext
public void setRetainedStaticContext(RetainedStaticContext retainedStaticContext)
Description copied from class:SystemFunction
Set the static context in which the function operates, for use with functions whose result depends on the static context- Overrides:
setRetainedStaticContext
in classSystemFunction
- Parameters:
retainedStaticContext
- the retained static context
-
setCollationName
public void setCollationName(java.lang.String collationName) throws XPathException
- Throws:
XPathException
-
preAllocateComparer
protected void preAllocateComparer(AtomicType type0, AtomicType type1, StaticContext env)
During static analysis, if types are known and the collation is known, pre-allocate a comparer for comparing atomic values. Called by some collating functions during type-checking. The comparer that is allocated treats NaN as not equal to NaN.- Parameters:
type0
- the type of the first comparandtype1
- the type of the second comparandenv
- the static context
-
getPreAllocatedAtomicComparer
public AtomicComparer getPreAllocatedAtomicComparer()
Get the pre-allocated atomic comparer, if available- Returns:
- the preallocated atomic comparer, or null
-
getAtomicComparer
public AtomicComparer getAtomicComparer(XPathContext context)
During evaluation, get the pre-allocated atomic comparer if available, or allocate a new one otherwise- Parameters:
context
- the dynamic evaluation context- Returns:
- the pre-allocated comparer if one is available; otherwise, a newly allocated one, using the specified StringCollator for comparing strings
-
exportAttributes
public void exportAttributes(ExpressionPresenter out)
Description copied from class:SystemFunction
Export any context attributes held within the SystemFunction object. The implementation will normally make one or more calls on out.emitAttribute(name, value).- Overrides:
exportAttributes
in classSystemFunction
- Parameters:
out
- the export destination
-
importAttributes
public void importAttributes(java.util.Properties attributes) throws XPathException
Description copied from class:SystemFunction
Import any attributes found in the export file, that is, any attributes output using the exportAttributes method- Overrides:
importAttributes
in classSystemFunction
- Parameters:
attributes
- the attributes, as a properties object- Throws:
XPathException
- if errors are found in the SEF file
-
copy
public CollatingFunctionFixed copy()
Make a copy of this SystemFunction. This is required only for system functions such as regex functions that maintain state on behalf of a particular caller.- Specified by:
copy
in interfaceStatefulSystemFunction
- Returns:
- a copy of the system function able to contain its own copy of the state on behalf of the caller.
-
-