Class IntegratedFunctionCall

All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, CallableExpression, InstructionInfo, Locator

public class IntegratedFunctionCall extends FunctionCall implements CallableExpression
Expression representing a call to a user-written extension function implemented as a subtype of ExtensionFunctionCall
See Also:
  • Constructor Details

  • Method Details

    • getFunction

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

      public void setContainer(Container container)
      Mark an expression as being in a given Container. This link is used primarily for diagnostics: the container links to the location map held in the executable.

      This affects the expression and all its subexpressions. Any subexpressions that are not in the same container are marked with the new container, and this proceeds recursively. However, any subexpression that is already in the correct container is not modified.

      Overrides:
      setContainer in class Expression
      Parameters:
      container - The container of this expression.
    • 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.
      Specified by:
      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, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
      Type-check the expression.
      Overrides:
      typeCheck in class FunctionCall
      Parameters:
      visitor - an expression visitor
      contextItemType - the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to Type.ITEM_TYPE
      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) throws XPathException
      Pre-evaluate a function at compile time. Functions that do not allow pre-evaluation, or that need access to context information, can override this method.
      Overrides:
      preEvaluate in class FunctionCall
      Parameters:
      visitor - an expression visitor
      Returns:
      the result of the early evaluation, or the original expression, or potentially a simplified expression
      Throws:
      XPathException - if evaluation fails
    • getItemType

      public ItemType getItemType(TypeHierarchy th)
      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
      Parameters:
      th - the type hierarchy cache
      Returns:
      a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
    • computeCardinality

      protected int computeCardinality()
      Compute the static cardinality of this expression
      Specified by:
      computeCardinality in class Expression
      Returns:
      the computed cardinality, as one of the values StaticProperty.ALLOWS_ZERO_OR_ONE, StaticProperty.EXACTLY_ONE, StaticProperty.ALLOWS_ONE_OR_MORE, StaticProperty.ALLOWS_ZERO_OR_MORE
    • 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()
      Copy an expression. This makes a deep copy.
      Specified by:
      copy in class Expression
      Returns:
      the copy of the original expression
    • 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 Expression
      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 SequenceIterator<? extends Item> call(SequenceIterator<? extends Item>[] arguments, XPathContext context) throws XPathException
      Description copied from interface: CallableExpression
      Evaluate the expression
      Specified by:
      call in interface CallableExpression
      Parameters:
      arguments - the values of the arguments, supplied as SequenceIterators
      context - the dynamic evaluation context
      Returns:
      the result of the evaluation, in the form of a SequenceIterator
      Throws:
      XPathException - if a dynamic error occurs during the evaluation of the expression