|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.expr.Expression net.sf.saxon.expr.FunctionCall net.sf.saxon.expr.UserFunctionCall
public class UserFunctionCall
This class represents a call to a user-defined function in the stylesheet or query.
Field Summary |
---|
Fields inherited from class net.sf.saxon.expr.Expression |
---|
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD |
Constructor Summary | |
---|---|
UserFunctionCall()
Create a function call to a user-written function in a query or stylesheet |
Method Summary | |
---|---|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap. |
void |
checkArguments(ExpressionVisitor visitor)
Method called during the type checking phase |
void |
checkFunctionCall(UserFunction compiledFunction,
ExpressionVisitor visitor)
Check the function call against the declared function signature |
void |
computeArgumentEvaluationModes()
Compute the evaluation mode of each argument |
int |
computeCardinality()
Determine the cardinality of the result |
Expression |
copy()
Copy an expression. |
ValueRepresentation |
dynamicCall(ValueRepresentation[] suppliedArguments,
XPathContext context)
Call the function dynamically. |
Item |
evaluateItem(XPathContext c)
Call the function, returning the value as an item. |
void |
explain(ExpressionPresenter out)
Diagnostic print of expression structure. |
int[] |
getArgumentEvaluationModes()
Get the evaluation modes that have been determined for each of the arguments |
Expression[] |
getArguments()
Get the arguments (the expressions supplied in the function call) |
UserFunction |
getFunction()
Get the function that is being called by this function call |
StructuredQName |
getFunctionName()
Get the qualified of the function being called |
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). |
InstructionInfo |
getInstructionInfo()
Get diagnostic information about this expression |
int |
getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. |
ItemType |
getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible |
boolean |
isConfirmed()
Determine whether this function call is confirmed |
boolean |
isRecursiveTailCall()
Determine whether this is a recursive tail call |
boolean |
isTailCall()
Determine whether this is a tail call (not necessarily a recursive tail call) |
SequenceIterator |
iterate(XPathContext c)
Call the function, returning an iterator over the results. |
EventIterator |
iterateEvents(XPathContext context)
Process the function call in pull mode |
int |
markTailFunctionCalls(StructuredQName qName,
int arity)
Mark tail-recursive calls on stylesheet functions. |
Expression |
optimize(ExpressionVisitor visitor,
ItemType contextItemType)
Perform optimisation of an expression and its subexpressions. |
Expression |
preEvaluate(ExpressionVisitor visitor)
Pre-evaluate a function at compile time. |
void |
process(XPathContext context)
Process the function call in push mode |
void |
setConfirmed(boolean conf)
Set this function as confirmed (the function being called is known to exist) or not |
void |
setFunction(UserFunction compiledFunction)
Create the reference to the function to be called |
void |
setStaticType(SequenceType type)
Set the static type |
Expression |
typeCheck(ExpressionVisitor visitor,
ItemType contextItemType)
Type-check the expression. |
Methods inherited from class net.sf.saxon.expr.FunctionCall |
---|
addExternalFunctionCallToPathMap, equals, getDisplayName, getNumberOfArguments, hashCode, iterateSubExpressions, promote, replaceSubExpression, setArguments, setFunctionName, simplify, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public UserFunctionCall()
Method Detail |
---|
public void setStaticType(SequenceType type)
type
- the static typepublic void setFunction(UserFunction compiledFunction)
compiledFunction
- the function being calledpublic void checkFunctionCall(UserFunction compiledFunction, ExpressionVisitor visitor) throws XPathException
compiledFunction
- the function being calledvisitor
- an expression visitor
XPathException
public UserFunction getFunction()
public void setConfirmed(boolean conf)
conf
- true if the function being called is known to existpublic boolean isConfirmed()
public boolean isTailCall()
public boolean isRecursiveTailCall()
public Expression[] getArguments()
getArguments
in class FunctionCall
public void checkArguments(ExpressionVisitor visitor) throws XPathException
visitor
- the expression visitor
XPathException
public final StructuredQName getFunctionName()
getFunctionName
in class FunctionCall
public int[] getArgumentEvaluationModes()
public Expression preEvaluate(ExpressionVisitor visitor)
preEvaluate
in class FunctionCall
visitor
- an expression visitor
public ItemType getItemType(TypeHierarchy th)
getItemType
in class Expression
th
- the type hierarchy cache
public int getIntrinsicDependencies()
Expression
getIntrinsicDependencies
in class Expression
public Expression copy()
copy
in class Expression
public int computeCardinality()
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
FunctionCall
typeCheck
in class FunctionCall
visitor
- an expression visitorcontextItemType
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException
FunctionCall
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize
in class FunctionCall
visitor
- an expression visitorcontextItemType
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public void computeArgumentEvaluationModes()
public PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
The default implementation of this method assumes that an expression does no navigation other than the navigation done by evaluating its subexpressions, and that the subexpressions are evaluated in the same context as the containing expression. The method must be overridden for any expression where these assumptions do not hold. For example, implementations exist for AxisExpression, ParentExpression, and RootExpression (because they perform navigation), and for the doc(), document(), and collection() functions because they create a new navigation root. Implementations also exist for PathExpression and FilterExpression because they have subexpressions that are evaluated in a different context from the calling expression.
addToPathMap
in class Expression
pathMap
- the PathMap to which the expression should be addedpathMapNodeSet
-
public int markTailFunctionCalls(StructuredQName qName, int arity)
markTailFunctionCalls
in class Expression
qName
- the name of the functionarity
- the arity (number of parameters) of the function
public int getImplementationMethod()
Expression
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public Item evaluateItem(XPathContext c) throws XPathException
evaluateItem
in interface EvaluableItem
evaluateItem
in class Expression
c
- The context in which the expression is to be evaluated
XPathException
- if any dynamic error occurs evaluating the
expressionpublic SequenceIterator iterate(XPathContext c) throws XPathException
iterate
in interface SequenceIterable
iterate
in class Expression
c
- supplies the context for evaluation
XPathException
- if any dynamic error occurs evaluating the
expressionpublic void process(XPathContext context) throws XPathException
process
in class Expression
context
- the XPath dynamic context
XPathException
public EventIterator iterateEvents(XPathContext context) throws XPathException
iterateEvents
in class Expression
context
- the XPath dynamic context
XPathException
public ValueRepresentation dynamicCall(ValueRepresentation[] suppliedArguments, XPathContext context) throws XPathException
suppliedArguments
- the values to be used for the arguments of the functioncontext
- the dynamic evaluation context
XPathException
public void explain(ExpressionPresenter out)
explain
in class FunctionCall
out
- the expression presenter used to display the structurepublic InstructionInfo getInstructionInfo()
getInstructionInfo
in interface InstructionInfoProvider
getInstructionInfo
in class Expression
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |