Overview | Package | Class | Tree | Deprecated | Index | 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.ComputedExpression
          net.sf.saxon.expr.FunctionCall
              net.sf.saxon.expr.UserFunctionCall

All Implemented Interfaces:
  Container, Expression, InstructionInfoProvider, java.io.Serializable, javax.xml.transform.SourceLocator

public class UserFunctionCall
extends FunctionCall
implements InstructionInfoProvider

This class represents a call to a function defined in the stylesheet or query. It is used for all user-defined functions in XQuery, and for a limited class of user-defined functions in XSLT: those that can be reduced to the evaluation of a single expression.

See Also:
  Serialized Form

Nested Class Summary
`class` | `UserFunctionCall.FunctionCallPackage` Inner class used to wrap up the set of actual arguments to a tail-recursive call of the containing function.

Field Summary

Fields inherited from class net.sf.saxon.expr.FunctionCall
`argument`

Fields inherited from class net.sf.saxon.expr.ComputedExpression
`locationId, staticProperties`

Fields inherited from interface 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
`int` | `computeCardinality()` Determine the cardinality of the result
`void` | `display(int level, NamePool pool, java.io.PrintStream out)` 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.
`UserFunction` | `getFunction()` Get the function that is being called by this function call
`InstructionInfo` | `getInstructionInfo()` Get diagnostic information about this expression
`ItemType` | `getItemType()` Determine the data type of the expression, if possible
`boolean` | `isConfirmed()` Determine whether this function call is confirmed
`SequenceIterator` | `iterate(XPathContext c)` Call the function, returning an iterator over the results.
`boolean` | `markTailFunctionCalls()` Mark tail-recursive calls on stylesheet functions.
`Expression` | `preEvaluate(StaticContext env)` Pre-evaluate a function at compile time.
`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

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

Methods inherited from class net.sf.saxon.expr.ComputedExpression
`adoptChildExpression, checkPermittedContents, computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, dynamicError, effectiveBooleanValue, evaluateAsString, getCardinality, getColumnNumber, getConstructType, getDependencies, getExecutable, getImplementationMethod, getIntrinsicDependencies, getLineNumber, getLocationId, getParentExpression, getPublicId, getSpecialProperties, getSystemId, process, resetStaticProperties, setLocationId, setParentExpression, typeError, typeError`

Methods inherited from class java.lang.Object
`clone, equals, finalize, 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

### checkArguments

    public void checkArguments(StaticContext env)
                        throws XPathException

  Method called during the type checking phase

  Specified by:
    `checkArguments` in class `FunctionCall`
  Throws:
    `XPathException`

### 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()

  Determine the data type of the expression, if possible

  Specified by:
    `getItemType` in interface `Expression`
  Returns:
    Type.ITEM (meaning not known in advance)

### computeCardinality

    public int computeCardinality()

  Determine the cardinality of the result

  Specified by:
    `computeCardinality` in class `ComputedExpression`

### simplify

    public Expression simplify(StaticContext env)
                        throws XPathException

  Simplify the function call

  Specified by:
    `simplify` in interface `Expression`
  Overrides:
    `simplify` in class `FunctionCall`
  Throws:
    `XPathException`

### markTailFunctionCalls

    public boolean markTailFunctionCalls()

  Mark tail-recursive calls on stylesheet functions. For most expressions, this does nothing.

  Overrides:
    `markTailFunctionCalls` in class `ComputedExpression`
  Returns:
    true if a tail recursive call was found and if this call accounts for the whole of the value.

### 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 `Expression`
  Overrides:
    `evaluateItem` in class `ComputedExpression`
  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 `Expression`
  Overrides:
    `iterate` in class `ComputedExpression`
  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

### 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,
                        NamePool pool,
                        java.io.PrintStream out)

  Description copied from interface: `Expression`
  Diagnostic print of expression structure. The expression is written to the System.err output stream

  Specified by:
    `display` in interface `Expression`
  Overrides:
    `display` in class `FunctionCall`

### getInstructionInfo

    public InstructionInfo getInstructionInfo()

  Get diagnostic information about this expression

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

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