net.sf.saxon.functions

Class CollatingFunction

public abstract class CollatingFunction extends SystemFunction

Abstract superclass for all functions that take an optional collation argument
Field Summary
protected StringCollatorstringCollator
Method Summary
voidcheckArguments(ExpressionVisitor visitor)
Expressioncopy()
Copy an expression.
StringgetAbsoluteCollationURI()
Get the absolute collation URI if known statically, as a string
protected GenericAtomicComparergetAtomicComparer(int arg, XPathContext context)
Get a GenericAtomicComparer that can be used to compare values.
protected StringCollatorgetCollator(int arg, XPathContext context)
Get a collator suitable for comparing strings.
URIgetExpressionBaseURI()
Get the saved static base URI
StringCollatorgetStringCollator()
Get the collation if known statically, as a StringCollator object

Field Detail

stringCollator

protected StringCollator stringCollator

Method Detail

checkArguments

public void checkArguments(ExpressionVisitor visitor)

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

getAbsoluteCollationURI

public 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

getAtomicComparer

protected GenericAtomicComparer getAtomicComparer(int arg, XPathContext context)
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 CollatingFunction 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 used context The dynamic evaluation context.

Returns: a GenericAtomicComparer that can be used to compare atomic values.

getCollator

protected StringCollator getCollator(int arg, XPathContext context)
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 to CollatingFunction) 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 present context The dynamic context

Returns: a StringCollator

getExpressionBaseURI

public 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.