com.saxonica.functions.hof
Class CurriedFunction

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

public class CurriedFunction
extends AbstractFunctionItem

A function obtained by currying another function, that is, the result of calling fn:partial-apply

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
 
Constructor Summary
CurriedFunction(FunctionItem targetFunction, int boundArg, ValueRepresentation boundValue)
          Create a curried function
 
Method Summary
 int getArity()
          Get the arity of the function
 FunctionItemType getFunctionItemType()
          Get the item type of the function item
 StructuredQName getFunctionName()
          Get the name of the function, or null if it is anonymous
 SequenceIterator invoke(SequenceIterator[] args, XPathContext context)
          Invoke the function
 
Methods inherited from class com.saxonica.functions.hof.AbstractFunctionItem
bind, curry, explain, getStringValue, getStringValueCS, getTypedValue, optimize, typeCheck
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurriedFunction

public CurriedFunction(FunctionItem targetFunction,
                       int boundArg,
                       ValueRepresentation boundValue)
                throws XPathException
Create a curried function

Parameters:
targetFunction - the function to be curried
boundArg - the argument in the target function whose value is to be bound, as a 1-based index into the arguments of the target function
boundValue - the value to which the argument is to be bound
Throws:
XPathException - if $boundArg does not exist among the arguments
Method Detail

getFunctionItemType

public FunctionItemType getFunctionItemType()
Get the item type of the function item

Returns:
the function item's type

getFunctionName

public StructuredQName getFunctionName()
Get the name of the function, or null if it is anonymous

Returns:
the function name, or null for an anonymous inline function

getArity

public int getArity()
Get the arity of the function

Returns:
the number of arguments in the function signature

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


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