net.sf.saxon.expr

Class UserFunctionCall

public class UserFunctionCall extends FunctionCall implements InstructionInfoProvider

This class represents a call to a function defined in the stylesheet or query. It is used for all user-defined functions in XQuery, and for a limited class of user-defined functions in XSLT: those that can be reduced to the evaluation of a single expression.
Nested Class Summary
classUserFunctionCall.FunctionCallPackage
Inner class used to wrap up the set of actual arguments to a tail-recursive call of the containing function.
Constructor Summary
UserFunctionCall()
Method Summary
voidcheckArguments(StaticContext env)
Method called during the type checking phase
voidcheckFunctionCall(UserFunction compiledFunction, StaticContext env)
Check the function call against the declared function signature
intcomputeCardinality()
Determine the cardinality of the result
voiddisplay(int level, NamePool pool, PrintStream out)
ValueRepresentationdynamicCall(ValueRepresentation[] suppliedArguments, XPathContext context)
Call the function dynamically.
ItemevaluateItem(XPathContext c)
Call the function, returning the value as an item.
Expression[]getArguments()
Get the arguments (the expressions supplied in the function call)
UserFunctiongetFunction()
Get the function that is being called by this function call
InstructionInfogetInstructionInfo()
Get diagnostic information about this expression
intgetIntrinsicDependencies()
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression, if possible
booleanisConfirmed()
Determine whether this function call is confirmed
SequenceIteratoriterate(XPathContext c)
Call the function, returning an iterator over the results.
booleanmarkTailFunctionCalls()
Mark tail-recursive calls on stylesheet functions.
ExpressionpreEvaluate(StaticContext env)
Pre-evaluate a function at compile time.
voidsetConfirmed(boolean conf)
Set this function as confirmed (the function being called is known to exist) or not
voidsetFunction(UserFunction compiledFunction, StaticContext env)
Create the reference to the function to be called, and validate for consistency
voidsetStaticType(SequenceType type)
Set the static type
Expressionsimplify(StaticContext env)
Simplify the function call

Constructor Detail

UserFunctionCall

public UserFunctionCall()

Method Detail

checkArguments

public void checkArguments(StaticContext env)
Method called during the type checking phase

checkFunctionCall

public void checkFunctionCall(UserFunction compiledFunction, StaticContext env)
Check the function call against the declared function signature

computeCardinality

public int computeCardinality()
Determine the cardinality of the result

display

public void display(int level, NamePool pool, PrintStream out)

dynamicCall

public ValueRepresentation dynamicCall(ValueRepresentation[] suppliedArguments, XPathContext context)
Call the function dynamically. For this to be possible, the static arguments of the function call must have been set up as SuppliedParameterReference objects. The actual arguments are placed on the callee's stack, and the type conversion takes place "in situ".

evaluateItem

public Item evaluateItem(XPathContext c)
Call the function, returning the value as an item. This method will be used only when the cardinality is zero or one. If the function is tail recursive, it returns an Object representing the arguments to the next (recursive) call

getArguments

public Expression[] getArguments()
Get the arguments (the expressions supplied in the function call)

getFunction

public UserFunction getFunction()
Get the function that is being called by this function call

getInstructionInfo

public InstructionInfo getInstructionInfo()
Get diagnostic information about this expression

getIntrinsicDependencies

public int getIntrinsicDependencies()

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible

Parameters: th

Returns: Type.ITEM (meaning not known in advance)

isConfirmed

public boolean isConfirmed()
Determine whether this function call is confirmed

iterate

public SequenceIterator iterate(XPathContext c)
Call the function, returning an iterator over the results. (But if the function is tail recursive, it returns an iterator over the arguments of the recursive call)

markTailFunctionCalls

public boolean markTailFunctionCalls()
Mark tail-recursive calls on stylesheet functions. For most expressions, this does nothing.

preEvaluate

public Expression preEvaluate(StaticContext env)
Pre-evaluate a function at compile time. This version of the method suppresses early evaluation by doing nothing.

setConfirmed

public void setConfirmed(boolean conf)
Set this function as confirmed (the function being called is known to exist) or not

setFunction

public void setFunction(UserFunction compiledFunction, StaticContext env)
Create the reference to the function to be called, and validate for consistency

setStaticType

public void setStaticType(SequenceType type)
Set the static type

simplify

public Expression simplify(StaticContext env)
Simplify the function call