Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sf.saxon.expr
Class UserFunctionCall

    java.lang.Object
      net.sf.saxon.expr.Expression
          net.sf.saxon.expr.FunctionCall
              net.sf.saxon.expr.UserFunctionCall

All Implemented Interfaces:
  Serializable, SourceLocator, Container, EvaluableItem, SequenceIterable, InstructionInfoProvider

    public class UserFunctionCall

extends FunctionCall
implements InstructionInfoProvider

This class represents a call to a user-defined function in the stylesheet or query.

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD`

Constructor Summary
`UserFunctionCall()`

Method Summary
`void` | `checkArguments(StaticContext env)` Method called during the type checking phase
`void` | `checkFunctionCall(UserFunction compiledFunction, StaticContext env)` Check the function call against the declared function signature
`void` | `computeArgumentEvaluationModes()`
`int` | `computeCardinality()` Determine the cardinality of the result
`void` | `display(int level, PrintStream out, Configuration config)` Diagnostic print of expression structure.
`ValueRepresentation` | `dynamicCall(ValueRepresentation[] suppliedArguments, XPathContext context)` Call the function dynamically.
`Item` | `evaluateItem(XPathContext c)` Call the function, returning the value as an item.
`int[]` | `getArgumentEvaluationModes()` Get the evaluation modes that have been determined for each of the arguments
`Expression[]` | `getArguments()` Get the arguments (the expressions supplied in the function call)
`UserFunction` | `getFunction()` Get the function that is being called by this function call
`int` | `getImplementationMethod()` An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
`InstructionInfo` | `getInstructionInfo()` Get diagnostic information about this expression
`int` | `getIntrinsicDependencies()` Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions.
`ItemType` | `getItemType(TypeHierarchy th)` Determine the data type of the expression, if possible
`boolean` | `isConfirmed()` Determine whether this function call is confirmed
`boolean` | `isRecursiveTailCall()` Determine whether this is a recursive tail call
`boolean` | `isTailCall()` Determine whether this is a tail call (not necessarily a recursive tail call)
`SequenceIterator` | `iterate(XPathContext c)` Call the function, returning an iterator over the results.
`int` | `markTailFunctionCalls(int nameCode, int arity)` Mark tail-recursive calls on stylesheet functions.
`Expression` | `optimize(Optimizer opt, StaticContext env, ItemType contextItemType)` Perform optimisation of an expression and its subexpressions.
`Expression` | `preEvaluate(StaticContext env)` Pre-evaluate a function at compile time.
`void` | `process(XPathContext context)` Process the function call in push mode
`void` | `setConfirmed(boolean conf)` Set this function as confirmed (the function being called is known to exist) or not
`void` | `setFunction(UserFunction compiledFunction, StaticContext env)` Create the reference to the function to be called, and validate for consistency
`void` | `setStaticType(SequenceType type)` Set the static type
`Expression` | `simplify(StaticContext env)` Simplify the function call
`Expression` | `typeCheck(StaticContext env, ItemType contextItemType)` Type-check the expression.

Methods inherited from class net.sf.saxon.expr.FunctionCall
`getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, promote, replaceSubExpression, setArguments, setFunctionNameCode`

Methods inherited from class net.sf.saxon.expr.Expression
`adoptChildExpression, checkPermittedContents, computeDependencies, computeSpecialProperties, computeStaticProperties, doPromotion, effectiveBooleanValue, evaluateAsString, getCardinality, getColumnNumber, getContainingProcedure, getDependencies, getExecutable, getHostLanguage, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### UserFunctionCall

    public UserFunctionCall()

Method Detail

### setStaticType

    public void setStaticType(SequenceType type)

  Set the static type

### setFunction

    public void setFunction(UserFunction compiledFunction,
                            StaticContext env)
                     throws XPathException

  Create the reference to the function to be called, and validate for consistency

  Throws:
    `XPathException`

### checkFunctionCall

    public void checkFunctionCall(UserFunction compiledFunction,
                                  StaticContext env)
                           throws XPathException

  Check the function call against the declared function signature

  Throws:
    `XPathException`

### getFunction

    public UserFunction getFunction()

  Get the function that is being called by this function call

### setConfirmed

    public void setConfirmed(boolean conf)

  Set this function as confirmed (the function being called is known to exist) or not

### isConfirmed

    public boolean isConfirmed()

  Determine whether this function call is confirmed

### isTailCall

    public boolean isTailCall()

  Determine whether this is a tail call (not necessarily a recursive tail call)

### isRecursiveTailCall

    public boolean isRecursiveTailCall()

  Determine whether this is a recursive tail call

### getArguments

    public Expression[] getArguments()

  Get the arguments (the expressions supplied in the function call)

  Overrides:
    `getArguments` in class `FunctionCall`

### checkArguments

    public void checkArguments(StaticContext env)
                        throws XPathException

  Method called during the type checking phase

  Throws:
    `XPathException`

### getArgumentEvaluationModes

    public int[] getArgumentEvaluationModes()

  Get the evaluation modes that have been determined for each of the arguments

### preEvaluate

    public Expression preEvaluate(StaticContext env)

  Pre-evaluate a function at compile time. This version of the method suppresses early evaluation by doing nothing.

  Overrides:
    `preEvaluate` in class `FunctionCall`

### getItemType

    public ItemType getItemType(TypeHierarchy th)

  Determine the data type of the expression, if possible

  Specified by:
    `getItemType` in class `Expression`
  Parameters:
    `th` -
  Returns:
    Type.ITEM (meaning not known in advance)

### getIntrinsicDependencies

    public int getIntrinsicDependencies()

  Description copied from class: `Expression`
  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

### computeCardinality

    public int computeCardinality()

  Determine the cardinality of the result

### simplify

    public Expression simplify(StaticContext env)
                        throws XPathException

  Simplify the function call

  Overrides:
    `simplify` in class `FunctionCall`
  Returns:
    the simplified expression
  Throws:
    `XPathException` - if an error is discovered during expression rewriting

### typeCheck

    public Expression typeCheck(StaticContext env,
                                ItemType contextItemType)
                         throws XPathException

  Description copied from class: `FunctionCall`
  Type-check the expression. This also calls preEvaluate() to evaluate the function if all the arguments are constant; functions that do not require this behavior can override the preEvaluate method.

  Overrides:
    `typeCheck` in class `FunctionCall`
  Parameters:
    `env` - the static context of the expression
    `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:
    `StaticError` - if an error is discovered during this phase (typically a type error)
    `XPathException`

### optimize

    public Expression optimize(Optimizer opt,
                               StaticContext env,
                               ItemType contextItemType)
                        throws XPathException

  Description copied from class: `FunctionCall`
  Perform optimisation of an expression and its subexpressions.

  This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

  Overrides:
    `optimize` in class `FunctionCall`
  Parameters:
    `opt` - the optimizer in use. This provides access to supporting functions; it also allows different optimization strategies to be used in different circumstances.
    `env` - the static context of the expression
    `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 if appropriate to optimize execution
  Throws:
    `StaticError` - if an error is discovered during this phase (typically a type error)
    `XPathException`

### computeArgumentEvaluationModes

    public void computeArgumentEvaluationModes()

### markTailFunctionCalls

    public int markTailFunctionCalls(int nameCode,
                                     int arity)

  Mark tail-recursive calls on stylesheet functions. This marks the function call as tailRecursive if if is a call to the containing function, and in this case it also returns "true" to the caller to indicate that a tail call was found.

  Overrides:
    `markTailFunctionCalls` in class `Expression`
  Returns:
    0 if no tail call was found; 1 if a tail call on a different function was found; 2 if a tail recursive call was found and if this call accounts for the whole of the value.

### getImplementationMethod

    public int getImplementationMethod()

  Description copied from class: `Expression`
  An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.

  Overrides:
    `getImplementationMethod` in class `Expression`

### evaluateItem

    public Item evaluateItem(XPathContext c)
                      throws XPathException

  Call the function, returning the value as an item. This method will be used only when the cardinality is zero or one. If the function is tail recursive, it returns an Object representing the arguments to the next (recursive) call

  Specified by:
    `evaluateItem` in interface `EvaluableItem`
  Overrides:
    `evaluateItem` in class `Expression`
  Parameters:
    `c` - The context in which the expression is to be evaluated
  Returns:
    the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
  Throws:
    `XPathException` - if any dynamic error occurs evaluating the expression

### iterate

    public SequenceIterator iterate(XPathContext c)
                             throws XPathException

  Call the function, returning an iterator over the results. (But if the function is tail recursive, it returns an iterator over the arguments of the recursive call)

  Specified by:
    `iterate` in interface `SequenceIterable`
  Overrides:
    `iterate` in class `Expression`
  Parameters:
    `c` - 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

### process

    public void process(XPathContext context)
                 throws XPathException

  Process the function call in push mode

  Overrides:
    `process` in class `Expression`
  Parameters:
    `context` -
  Throws:
    `XPathException`

### dynamicCall

    public ValueRepresentation dynamicCall(ValueRepresentation[] suppliedArguments,
                                           XPathContext context)
                                    throws XPathException

  Call the function dynamically. For this to be possible, the static arguments of the function call must have been set up as SuppliedParameterReference objects. The actual arguments are placed on the callee's stack, and the type conversion takes place "in situ".

  Throws:
    `XPathException`

### display

    public void display(int level,
                        PrintStream out,
                        Configuration config)

  Description copied from class: `Expression`
  Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

  Overrides:
    `display` in class `FunctionCall`
  Parameters:
    `level` - indentation level for this expression
    `out` - Output destination

### getInstructionInfo

    public InstructionInfo getInstructionInfo()

  Get diagnostic information about this expression

  Specified by:
    `getInstructionInfo` in interface `InstructionInfoProvider`
  Overrides:
    `getInstructionInfo` in class `Expression`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.