Class IntegratedFunctionCall

    • Method Detail

      • setResultType

        public void setResultType​(SequenceType resultType)
        Set the result type of the function
        Parameters:
        resultType - the result type
      • getTargetFunction

        public Function getTargetFunction​(XPathContext context)
        Get the target function to be called
        Specified by:
        getTargetFunction in class FunctionCall
        Parameters:
        context - the dynamic evaluation context
        Returns:
        the target function, or null if unknown
      • getFunction

        public ExtensionFunctionCall getFunction()
        Get the ExtensionFunctionCall object supplied by the application
        Returns:
        the ExtensionFunctionCall object
      • checkArguments

        public void checkArguments​(ExpressionVisitor visitor)
                            throws XPathException
        Method supplied by each class of function to check arguments during parsing, when all the argument expressions have been read. This implementation of the method checks the arguments of the supplied function call against the argument types declared as part of the extension function definition, and generates code to do the conversion if necessary.
        Overrides:
        checkArguments in class FunctionCall
        Parameters:
        visitor - the expression visitor
        Throws:
        XPathException - if the arguments are statically determined to be incompatible with the declared argument types of the function.
      • typeCheck

        public Expression typeCheck​(ExpressionVisitor visitor,
                                    ContextItemStaticInfo contextInfo)
                             throws XPathException
        Type-check the expression.
        Overrides:
        typeCheck in class FunctionCall
        Parameters:
        visitor - an expression visitor
        contextInfo - Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.
        Returns:
        the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
        Throws:
        XPathException - if an error is discovered during this phase (typically a type error)
      • preEvaluate

        public Expression preEvaluate​(ExpressionVisitor visitor)
        Pre-evaluate a function at compile time. This function does not allow pre-evaluation, so the method returns null.
        Overrides:
        preEvaluate in class FunctionCall
        Parameters:
        visitor - an expression visitor
        Returns:
        for this class: always null
      • getItemType

        public ItemType getItemType()
        Determine the data type of the expression, if possible. All expression return sequences, in general; this method determines the type of the items within the sequence, assuming that (a) this is known in advance, and (b) it is the same for all items in the sequence.

        This method should always return a result, though it may be the best approximation that is available at the time.

        Specified by:
        getItemType in class Expression
        Returns:
        a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
      • getIntrinsicDependencies

        public int getIntrinsicDependencies()
        Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. For example, position() has an intrinsic dependency on the context position, while (position()+1) does not. The default implementation of the method returns 0, indicating "no dependencies".
        Overrides:
        getIntrinsicDependencies in class Expression
        Returns:
        a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
      • computeSpecialProperties

        protected int computeSpecialProperties()
        Compute the special properties of this expression. These properties are denoted by a bit-significant integer, possible values are in class StaticProperty. The "special" properties are properties other than cardinality and dependencies, and most of them relate to properties of node sequences, for example whether the nodes are in document order.
        Overrides:
        computeSpecialProperties in class Expression
        Returns:
        the special properties, as a bit-significant integer
      • copy

        public Expression copy​(RebindingMap rebindings)
        Copy an expression. This makes a deep copy.
        Specified by:
        copy in class Expression
        Parameters:
        rebindings - Variables that need to be re-bound
        Returns:
        the copy of the original expression
      • export

        public void export​(ExpressionPresenter out)
                    throws XPathException
        Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
        Specified by:
        export in interface ExportAgent
        Overrides:
        export in class FunctionCall
        Parameters:
        out - the expression presenter used to display the structure
        Throws:
        XPathException - if the export fails, for example if an expression is found that won't work in the target environment.
      • iterate

        public SequenceIterator iterate​(XPathContext context)
                                 throws XPathException
        Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.
        Overrides:
        iterate in class FunctionCall
        Parameters:
        context - supplies the context for evaluation
        Returns:
        a SequenceIterator that can be used to iterate over the result of the expression
        Throws:
        XPathException - if any dynamic error occurs evaluating the expression
      • effectiveBooleanValue

        public boolean effectiveBooleanValue​(XPathContext context)
                                      throws XPathException
        Get the effective boolean value of the expression. This returns false if the value is the empty sequence, a zero-length string, a number equal to zero, or the boolean false. Otherwise it returns true.
        Overrides:
        effectiveBooleanValue in class Expression
        Parameters:
        context - The context in which the expression is to be evaluated
        Returns:
        the effective boolean value
        Throws:
        XPathException - if any dynamic error occurs evaluating the expression
      • call

        public Sequence call​(XPathContext context,
                             Sequence[] arguments)
                      throws XPathException
        Description copied from interface: Callable
        Call the Callable.
        Specified by:
        call in interface Callable
        Parameters:
        context - the dynamic evaluation context
        arguments - the values of the arguments, supplied as Sequences.

        Generally it is advisable, if calling iterate() to process a supplied sequence, to call it only once; if the value is required more than once, it should first be converted to a GroundedValue by calling the utility method SequenceTool.toGroundedValue().

        If the expected value is a single item, the item should be obtained by calling Sequence.head(): it cannot be assumed that the item will be passed as an instance of Item or AtomicValue.

        It is the caller's responsibility to perform any type conversions required to convert arguments to the type expected by the callee. An exception is where this Callable is explicitly an argument-converting wrapper around the original Callable.

        Returns:
        the result of the evaluation, in the form of a Sequence. It is the responsibility of the callee to ensure that the type of result conforms to the expected result type.
        Throws:
        XPathException - if a dynamic error occurs during the evaluation of the expression