Package net.sf.saxon.functions
Class CollatingFunction
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.FunctionCall
-
- net.sf.saxon.functions.SystemFunction
-
- net.sf.saxon.functions.CollatingFunction
-
- All Implemented Interfaces:
java.io.Serializable
,javax.xml.transform.SourceLocator
,LocationProvider
,SaxonLocator
,InstructionInfo
,org.xml.sax.Locator
- Direct Known Subclasses:
Compare
,Contains
,DeepEqual
,DistinctValues
,EndsWith
,IndexOf
,Minimax
,StartsWith
,SubstringAfter
,SubstringBefore
public abstract class CollatingFunction extends SystemFunction
Abstract superclass for all functions that take an optional collation argument- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected StringCollator
stringCollator
-
Fields inherited from class net.sf.saxon.functions.SystemFunction
operation
-
Fields inherited from class net.sf.saxon.expr.FunctionCall
argument
-
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD
-
-
Constructor Summary
Constructors Constructor Description CollatingFunction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkArguments(ExpressionVisitor visitor)
Method called during static type checkingExpression
copy()
Copy an expression.boolean
equals(java.lang.Object o)
Determine whether two expressions are equivalentstatic java.lang.String
expandCollationURI(java.lang.String collationName, java.net.URI expressionBaseURI, XPathContext context)
java.lang.String
getAbsoluteCollationURI()
Get the absolute collation URI if known statically, as a stringprotected GenericAtomicComparer
getAtomicComparer(int arg, XPathContext context)
Get a GenericAtomicComparer that can be used to compare values.protected StringCollator
getCollator(int arg, XPathContext context)
Get a collator suitable for comparing strings.java.net.URI
getExpressionBaseURI()
Get the saved static base URIStringCollator
getStringCollator()
Get the collation if known statically, as a StringCollator object-
Methods inherited from class net.sf.saxon.functions.SystemFunction
addContextDocumentArgument, addDocToPathMap, computeCardinality, computeSpecialProperties, getDetails, getErrorCodeForTypeErrors, getImplementationMethod, getItemType, getOperation, getRequiredType, makeSystemFunction, optimize, setDetails, useContextItemAsDefault
-
Methods inherited from class net.sf.saxon.expr.FunctionCall
addExternalFunctionCallToPathMap, checkArgumentCount, explain, getArguments, getDisplayName, getExpressionName, getFunctionName, getNumberOfArguments, hashCode, iterateSubExpressions, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionName, simplify, simplifyArguments, toString, typeCheck
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, iterateEvents, iterateSameFocusSubExpressions, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, typeError
-
-
-
-
Field Detail
-
stringCollator
protected StringCollator stringCollator
-
-
Method Detail
-
checkArguments
public void checkArguments(ExpressionVisitor visitor) throws XPathException
Description copied from class:SystemFunction
Method called during static type checking- Overrides:
checkArguments
in classSystemFunction
- Parameters:
visitor
- the expression visitor- Throws:
XPathException
- if the arguments are incorrect
-
getExpressionBaseURI
public java.net.URI getExpressionBaseURI()
Get the saved static base URI- Returns:
- the static base URI
-
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.
-
getAbsoluteCollationURI
public java.lang.String getAbsoluteCollationURI()
Get the absolute collation URI if known statically, as a string- Returns:
- the absolute collation URI, as a string, or null if it is not known statically
-
copy
public Expression copy()
Copy an expression. This makes a deep copy.- Overrides:
copy
in classSystemFunction
- Returns:
- the copy of the original expression
-
equals
public boolean equals(java.lang.Object o)
Determine whether two expressions are equivalent- Overrides:
equals
in classSystemFunction
-
getAtomicComparer
protected GenericAtomicComparer getAtomicComparer(int arg, XPathContext context) throws XPathException
Get a GenericAtomicComparer that can be used to compare values. This method is called at run time by subclasses to evaluate the parameter containing the collation name.The difference between this method and
getCollator(int, net.sf.saxon.expr.XPathContext)
is that a GenericAtomicComparer is capable of comparing values of any atomic type, not only strings. It is therefore called by functions such as compare, deep-equal, index-of, and min() and max() where the operands may include a mixture of strings and other types.- Parameters:
arg
- the position of the argument (starting at 0) containing the collation name. If this argument was not supplied, the default collation is usedcontext
- The dynamic evaluation context.- Returns:
- a GenericAtomicComparer that can be used to compare atomic values.
- Throws:
XPathException
-
getCollator
protected StringCollator getCollator(int arg, XPathContext context) throws XPathException
Get a collator suitable for comparing strings. Returns the collator specified in the given function argument if present, otherwise returns the default collator. This method is called by subclasses at run time. It is used (in contrast togetAtomicComparer(int, net.sf.saxon.expr.XPathContext)
) when it is known that the values to be compared are always strings.- Parameters:
arg
- The argument position (counting from zero) that holds the collation URI if presentcontext
- The dynamic context- Returns:
- a StringCollator
- Throws:
XPathException
-
expandCollationURI
public static java.lang.String expandCollationURI(java.lang.String collationName, java.net.URI expressionBaseURI, XPathContext context) throws XPathException
- Throws:
XPathException
-
-