com.saxonica.functions.hof
Class UserFunctionItem

java.lang.Object
  extended by com.saxonica.functions.hof.AbstractFunctionItem
      extended by com.saxonica.functions.hof.UserFunctionItem
All Implemented Interfaces:
PullEvent, FunctionItem, Item, ValueRepresentation

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
protected  UserFunctionCall target
           
 
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
 
Constructor Summary
UserFunctionItem(UserFunctionCall target)
           
 
Method Summary
 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
 SequenceIterator invoke(SequenceIterator[] args, XPathContext context)
          Invoke the function
 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
bind, curry, deepEquals, getStringValue, getStringValueCS, getTypedValue, optimize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

invoke

public SequenceIterator invoke(SequenceIterator[] args,
                               XPathContext context)
                        throws XPathException
Invoke the function

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

explain

public void explain(ExpressionPresenter out)
Overrides:
explain in class AbstractFunctionItem


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