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:
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


Field Summary
 
Fields inherited from interface net.sf.saxon.om.ValueRepresentation
EMPTY_VALUE_ARRAY
 
Constructor Summary
CurriedFunction(FunctionItem targetFunction, ValueRepresentation[] boundValues)
          Create a curried function
 
Method Summary
 int getArity()
          Get the arity of the function (equal to the number of placeholders)
 FunctionItemType getFunctionItemType(TypeHierarchy th)
          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, deepEquals, explain, getStringValue, getStringValueCS, getTypedValue, optimize, simplify, 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,
                       ValueRepresentation[] boundValues)
                throws XPathException
Create a curried function

Parameters:
targetFunction - the function to be curried
boundValues - the values to which the arguments are to be bound, representing unbound values (placeholders) by null
Throws:
XPathException - if any $boundArg does not exist among the arguments
Method Detail

getFunctionItemType

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

Parameters:
th - the type hierarchy cache
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 (equal to the number of placeholders)

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-2011 Saxonica Limited. All rights reserved.