## com.saxonica.functions.hof
Class AbstractFunctionItem

    java.lang.Object
      com.saxonica.functions.hof.AbstractFunctionItem

All Implemented Interfaces:
  Serializable, PullEvent, FunctionItem, Item, ValueRepresentation

Direct Known Subclasses:
  CoercedFunction, CurriedFunction, FirstClassFunction, UserFunctionItem

    public abstract class AbstractFunctionItem

extends Object
implements FunctionItem

Abstract superclass (and factory class) for implementations of FunctionItem

See Also:
  Serialized Form

Field Summary

Fields inherited from interface net.sf.saxon.om.ValueRepresentation
`EMPTY_VALUE_ARRAY`

Constructor Summary
`AbstractFunctionItem()`

Method Summary
`static AbstractFunctionItem` `bind(StructuredQName functionName, int arity, StaticContext env, Container container)` Factory method to create a function item representing a function item literal
`FunctionItem` `curry(int arg, ValueRepresentation value)` Curry a function by binding one of its arguments
`void` `explain(ExpressionPresenter out)`
`String` `getStringValue()` Get the string value of the function item
`CharSequence` `getStringValueCS()` Get the string value of the function item
`SequenceIterator` `getTypedValue()` Get the typed value of the item.
`void` `optimize(ExpressionVisitor visitor, ItemType contextItemType)` Optimize the function (may modify it)
`void` `typeCheck(ExpressionVisitor visitor, ItemType contextItemType)` Type check the function (may modify it by adding code for converting the arguments)

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.FunctionItem
`getArity, getFunctionItemType, getFunctionName, invoke`

Constructor Detail

### AbstractFunctionItem

    public AbstractFunctionItem()

Method Detail

### getStringValue

    public String getStringValue()

  Get the string value of the function item

  Specified by:
    `getStringValue` in interface `Item`
  Specified by:
    `getStringValue` in interface `ValueRepresentation`
  Returns:
    the string value of the item
  Throws:
    `UnsupportedOperationException` - (the string value of a function item is not defined)
  See Also:
    `Item.getStringValueCS()`

### getStringValueCS

    public CharSequence getStringValueCS()

  Get the string value of the function item

  Specified by:
    `getStringValueCS` in interface `Item`
  Specified by:
    `getStringValueCS` in interface `ValueRepresentation`
  Returns:
    the string value of the item
  Throws:
    `UnsupportedOperationException` - (the string value of a function item is not defined)
  See Also:
    `Item.getStringValue()`

### getTypedValue

    public SequenceIterator getTypedValue()
                                   throws XPathException

  Get the typed value of the item.

  Specified by:
    `getTypedValue` in interface `Item`
  Returns:
    an iterator over the items in the typed value of the node or atomic value. The items returned by this iterator will always be atomic values.
  Throws:
    `XPathException` - (always) - a function item cannot be atomized

### typeCheck

    public void typeCheck(ExpressionVisitor visitor,
                          ItemType contextItemType)
                   throws XPathException

  Type check the function (may modify it by adding code for converting the arguments)

  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,
                         ItemType contextItemType)
                  throws XPathException

  Optimize the function (may modify it)

  Parameters:
    `visitor` - the expression visitor, supplies context information
    `contextItemType` - the context item type at the point where the function definition appears
  Throws:
    `XPathException`

### curry

    public FunctionItem curry(int arg,
                              ValueRepresentation value)
                       throws XPathException

  Curry a function by binding one of its arguments

  Specified by:
    `curry` in interface `FunctionItem`
  Parameters:
    `arg` - the argument to be found (1-based)
    `value` - the value to which the argument is to be bound
  Throws:
    `XPathException`

### bind

    public static AbstractFunctionItem bind(StructuredQName functionName,
                                            int arity,
                                            StaticContext env,
                                            Container container)
                                     throws XPathException

  Factory method to create a function item representing a function item literal

  Parameters:
    `functionName` - the name of the function to be called
    `arity` - the arity of the function
    `env` - the static context of the function item literal
  Returns:
    the constructed function item
  Throws:
    `XPathException` - for example if there is no function with the specified name and arity in the static context

### explain

    public void explain(ExpressionPresenter out)

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