Class CollatingFunctionFree

  • All Implemented Interfaces:
    Callable, Function, GroundedValue, Item, Sequence

    public class CollatingFunctionFree
    extends SystemFunction
    Generic class for all functions that take an optional collation argument, where the collation argument is supplied and has not yet been resolved. The class provides methods that either do early evaluation of the collation argument (converting the function to the corresponding instance of CollatingFunctionFixed, or failing that, the collation argument is evaluated at run-time.
    • Constructor Detail

      • CollatingFunctionFree

        public CollatingFunctionFree()
    • Method Detail

      • makeOptimizedFunctionCall

        public Expression makeOptimizedFunctionCall​(ExpressionVisitor visitor,
                                                    ContextItemStaticInfo contextInfo,
                                                    Expression... arguments)
                                             throws XPathException
        Allow the function to create an optimized call based on the values of the actual arguments
        Overrides:
        makeOptimizedFunctionCall in class SystemFunction
        Parameters:
        visitor - the expression visitor
        contextInfo - information about the context item
        arguments - the supplied arguments to the function call
        Returns:
        either a function call on this function, or an expression that delivers the same result, or null indicating that no optimization has taken place
        Throws:
        XPathException - if an error is detected
      • bindCollation

        public CollatingFunctionFixed bindCollation​(java.lang.String collationName)
                                             throws XPathException
        Create an instance of (a subclass of) CollatingFunctionFixed representing the underlying function but with the collator already bound
        Parameters:
        collationName - the name of the collation to be used
        Returns:
        a function to implement this function with a fixed collation
        Throws:
        XPathException - if the collation is unknown
      • expandCollationURI

        public static java.lang.String expandCollationURI​(java.lang.String collationName,
                                                          java.net.URI expressionBaseURI)
                                                   throws XPathException
        Expand a collation URI, which may be a relative URI reference
        Parameters:
        collationName - the collation URI as provided
        expressionBaseURI - the base URI against which the collation URI will be resolved if it is relative
        Returns:
        the resolved (expanded) absolute collation URI
        Throws:
        XPathException - if the collation URI cannot be resolved
      • call

        public Sequence call​(XPathContext context,
                             Sequence[] args)
                      throws XPathException
        Invoke the function. This is done in effect by currying the function: that is, creating a new function in which the collation argument is bound, and then invoking that new function.
        Parameters:
        context - the XPath dynamic evaluation context
        args - the actual arguments to be supplied
        Returns:
        the result of invoking the function
        Throws:
        XPathException - if a dynamic error occurs within the function
      • getStreamerName

        public java.lang.String getStreamerName()
        Description copied from class: SystemFunction
        Get a name that identifies the class that can be used to evaluate this function in streaming mode, that is, supplying one item or event at a time as it is delivered by the parser. Special streaming support is generally available in Saxon-EE for all system functions that take a sequence as their argument.
        Overrides:
        getStreamerName in class SystemFunction
        Returns:
        a name that identifies a class that supports streamed evaluation of this system function, or null if no such class is available. The mapping of names to classes is defined in the Saxon-EE class StreamerMap. In non-streaming Saxon editions (HE and PE) the method always returns null.