|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.saxonica.functions.hof.AbstractFunctionItem
com.saxonica.functions.hof.FirstClassFunction
public class FirstClassFunction
A FirstClassFunction is a value that encapsulates a function; it can therefore be manipulated like any other value: for example it can be assigned to a variable and passed as a parameter to a function.
A FirstClassFunction can be created using the extension function saxon:function(), and can be invoked using the extension function saxon:call().
In XQuery 3.0, a FirstClassFunction can be created using an inline function literal (for example "fn:contains#2" or an inline function definition, for example "function($x) {$x=0}". It can be called using a dynamic function call such as $f(17).
Currently all FirstClassFunction objects are created statically (at compile time).
| Field Summary |
|---|
| Fields inherited from interface net.sf.saxon.om.ValueRepresentation |
|---|
EMPTY_VALUE_ARRAY |
| Constructor Summary | |
|---|---|
protected |
FirstClassFunction(Expression target,
StructuredQName name,
int arity,
FunctionItemType type)
|
| Method Summary | |
|---|---|
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 |
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, explain, getStringValue, getStringValueCS, getTypedValue, optimize |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected FirstClassFunction(Expression target,
StructuredQName name,
int arity,
FunctionItemType type)
| Method Detail |
|---|
public int getArity()
public StructuredQName getFunctionName()
public FunctionItemType getFunctionItemType(TypeHierarchy th)
th -
public void simplify(ExpressionVisitor visitor)
throws XPathException
simplify in class AbstractFunctionItemXPathException
public void typeCheck(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType)
throws XPathException
typeCheck in class AbstractFunctionItemvisitor - the expression visitor, supplies context informationcontextItemType - the context item type at the point where the function definition appears
XPathException
public SequenceIterator invoke(SequenceIterator[] args,
XPathContext context)
throws XPathException
args - the actual arguments to be suppliedcontext - the XPath dynamic evaluation context
XPathException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||