net.sf.saxon.functions
Class CollatingFunction

java.lang.Object
  extended bynet.sf.saxon.expr.ComputedExpression
      extended bynet.sf.saxon.expr.FunctionCall
          extended bynet.sf.saxon.functions.SystemFunction
              extended bynet.sf.saxon.functions.CollatingFunction
All Implemented Interfaces:
Expression, Serializable
Direct Known Subclasses:
Compare, Contains, DeepEqual, DistinctValues, IndexOf, Minimax

public abstract class CollatingFunction
extends SystemFunction

Abstract superclass for all functions that take an optional collation argument

See Also:
Serialized Form

Field Summary
 
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.ComputedExpression
lineNumber, NO_ARGUMENTS, staticProperties
 
Constructor Summary
CollatingFunction()
           
 
Method Summary
protected  AtomicComparer getAtomicComparer(int arg, XPathContext context)
          Get a AtomicComparer that can be used to compare values
protected  Comparator getCollator(int arg, XPathContext context, boolean useDefault)
          Get a collator suitable for comparing strings.
 Expression preEvaluate(StaticContext env)
          preEvaluate: this method suppresses compile-time evaluation by doing nothing (because collation definitions are not available statically)
 
Methods inherited from class net.sf.saxon.functions.SystemFunction
addContextDocumentArgument, checkArguments, computeCardinality, display, getDetails, getItemType, getName, getRequiredType, main, makeSystemFunction, useContextItemAsDefault
 
Methods inherited from class net.sf.saxon.expr.FunctionCall
analyze, checkArgumentCount, getNumberOfArguments, getSubExpressions, promote, setArguments, simplify, simplifyArguments
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getDependencies, getIntrinsicDependencies, getLineNumber, getSpecialProperties, iterate, markTailFunctionCalls, setLineNumber, typeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollatingFunction

public CollatingFunction()
Method Detail

preEvaluate

public Expression preEvaluate(StaticContext env)
preEvaluate: this method suppresses compile-time evaluation by doing nothing (because collation definitions are not available statically)

Overrides:
preEvaluate in class FunctionCall

getAtomicComparer

protected AtomicComparer getAtomicComparer(int arg,
                                           XPathContext context)
                                    throws XPathException
Get a AtomicComparer that can be used to compare values

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.
Throws:
XPathException

getCollator

protected Comparator getCollator(int arg,
                                 XPathContext context,
                                 boolean useDefault)
                          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.

Parameters:
arg - The argument position (counting from zero) that holds the collation URI if present
context - The dynamic context
useDefault - true if, in the absence of a collation argument, the default collation should be used; false if the codepoint collation should be used.
Returns:
a Comparator, which will either be a java.text.Collator, or a CodepointCollator
Throws:
XPathException