com.saxonica.functions.hof

## Class UserFunctionItem

- java.lang.Object
- - net.sf.saxon.om.AbstractItem
  - - com.saxonica.functions.hof.AbstractFunctionItem
    - - com.saxonica.functions.hof.UserFunctionItem

- All Implemented Interfaces:
    PullEvent, Callable, FunctionItem, GroundedValue, Item, Sequence

      public class UserFunctionItem
      extends AbstractFunctionItem

  A UserFunctionItem is a function item representing a call on a user-defined function. It is typically created as a result of the expression local:f#1 where local:f is a user-defined function. The implementation is a wrapper around a UserFunctionCall representing a call on the specified function.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected UserFunctionCall` | `target`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserFunctionItem(UserFunctionCall target)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Sequence` | `call(XPathContext context, Sequence[] args)` Invoke the function
    `void` | `explain(ExpressionPresenter out)`
    `int` | `getArity()` Get the arity of the function
    `FunctionItemType` | `getFunctionItemType(TypeHierarchy th)` Determine the item type of the items in the value
    `StructuredQName` | `getFunctionName()` Get the name of the function
    `UserFunctionCall` | `getUserFunctionCall()` Get the underlying UserFunctionCall
    `void` | `optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)` Optimize the function (may modify it)
    `void` | `simplify(ExpressionVisitor visitor)`
    `void` | `typeCheck(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)` Type check the function (may modify it by adding code for converting the arguments)

    - ### Methods inherited from class com.saxonica.functions.hof.AbstractFunctionItem

      `deepEquals, effectiveBooleanValue, getStringValue, getStringValueCS, getTypedValue`

    - ### Methods inherited from class net.sf.saxon.om.AbstractItem

      `getLength, head, itemAt, iterate, reduce, subsequence`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `getLength, itemAt, reduce, subsequence`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `head, iterate`

- - ### Field Detail

    - #### target

          protected UserFunctionCall target

  - ### Constructor Detail

    - #### UserFunctionItem

          public UserFunctionItem(UserFunctionCall target)

  - ### Method Detail

    - #### getUserFunctionCall

          public UserFunctionCall getUserFunctionCall()

      Get the underlying UserFunctionCall
      Returns:
        the UserFunctionCall represented by this function item

    - #### getArity

          public int getArity()

      Get the arity of the function
      Returns:
        the number of arguments

    - #### getFunctionName

          public StructuredQName getFunctionName()

      Get the name of the function
      Returns:
        the name of the function, if it has a name, or null otherwise

    - #### getFunctionItemType

          public FunctionItemType getFunctionItemType(TypeHierarchy th)

      Determine the item type of the items in the value
      Parameters:
        `th` -
      Returns:
        the function item type

    - #### simplify

          public void simplify(ExpressionVisitor visitor)
                        throws XPathException

      Overrides:
        `simplify` in class `AbstractFunctionItem`
      Throws:
        `XPathException`

    - #### typeCheck

          public void typeCheck(ExpressionVisitor visitor,
                       ExpressionVisitor.ContextItemType contextItemType)
                         throws XPathException

      Type check the function (may modify it by adding code for converting the arguments)
      Overrides:
        `typeCheck` in class `AbstractFunctionItem`
      Parameters:
        `visitor` - the expression visitor, supplies context information
        `contextItemType` - the context item type at the point where the function definition appears
      Throws:
        `XPathException`

    - #### optimize

          public void optimize(ExpressionVisitor visitor,
                      ExpressionVisitor.ContextItemType contextItemType)
                        throws XPathException

      Optimize the function (may modify it)
      Overrides:
        `optimize` in class `AbstractFunctionItem`
      Parameters:
        `visitor` - the expression visitor, supplies context information
        `contextItemType` - the context item type at the point where the function definition appears
      Throws:
        `XPathException`

    - #### call

          public Sequence call(XPathContext context,
                      Sequence[] args)
                        throws XPathException

      Invoke the function
      Parameters:
        `context` - the XPath dynamic evaluation context
        `args` - the actual arguments to be supplied
      Returns:
        the result of invoking the function
      Throws:
        `XPathException`

    - #### explain

          public void explain(ExpressionPresenter out)

      Overrides:
        `explain` in class `AbstractFunctionItem`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.