public class UserFunctionCall extends FunctionCall implements UserFunctionResolvable, ComponentInvocation, ContextOriginator
Modifier and Type | Field and Description |
---|---|
static int |
FOREIGN_TAIL_CALL |
static int |
NOT_TAIL_CALL |
static int |
SELF_TAIL_CALL |
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
Constructor and Description |
---|
UserFunctionCall()
Create a function call to a user-written function in a query or stylesheet
|
Modifier and Type | Method and Description |
---|---|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
|
void |
computeArgumentEvaluationModes()
Compute the evaluation mode of each argument
|
int |
computeCardinality()
Determine the cardinality of the result
|
protected int |
computeSpecialProperties()
Compute the special properties of this expression.
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
Sequence[] |
evaluateArguments(XPathContext c) |
Sequence[] |
evaluateArguments(XPathContext c,
boolean streamed) |
Item |
evaluateItem(XPathContext c)
Call the function, returning the value as an item.
|
void |
evaluatePendingUpdates(XPathContext context,
PendingUpdateList pul)
Evaluate an updating expression, adding the results to a Pending Update List.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
int[] |
getArgumentEvaluationModes()
Get the evaluation modes that have been determined for each of the arguments
|
int |
getBindingSlot()
Get the binding slot to be used.
|
int |
getConstructType()
Get the type of this expression for use in tracing and diagnostics
|
java.lang.String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
Component |
getFixedTarget()
Get the target component if this is known in advance, that is, if the target component
is private or final, or in some other cases such as xsl:original.
|
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().
|
int |
getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived
from the dependencies of its subexpressions.
|
ItemType |
getItemType()
Determine the data type of the expression, if possible
|
StructuredQName |
getObjectName() |
java.lang.Object |
getProperty(java.lang.String name) |
UType |
getStaticUType(UType contextItemType)
Get the static type of the expression as a UType, following precisely the type
inference rules defined in the XSLT 3.0 specification.
|
SymbolicName |
getSymbolicName()
Get the symbolic name of the component that this invocation references
|
Component |
getTarget() |
Component |
getTargetComponent(XPathContext context) |
UserFunction |
getTargetFunction(XPathContext context)
Get the target function to be called
|
boolean |
isBeingInlined() |
boolean |
isRecursiveTailCall() |
boolean |
isTailCall()
Determine whether this is a tail call (not necessarily a recursive tail call)
|
boolean |
isUpdatingExpression()
Determine whether this is an updating expression as defined in the XQuery update specification
|
SequenceIterator |
iterate(XPathContext c)
Call the function, returning an iterator over the results.
|
int |
markTailFunctionCalls(StructuredQName qName,
int arity)
Mark tail-recursive calls on stylesheet functions.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo 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 |
resetLocalStaticProperties()
Reset the static properties of the expression to -1, so that they have to be recomputed
next time they are used.
|
void |
setArgumentEvaluationModes(int[] evalModes)
Set the argument evaluation modes
|
void |
setBeingInlined(boolean beingInlined) |
void |
setBindingSlot(int slot)
Set the binding slot to be used.
|
void |
setFunction(UserFunction compiledFunction)
Create the reference to the function to be called
|
void |
setFunctionName(StructuredQName name)
Set the name of the function being called
|
void |
setStaticType(SequenceType type)
Set the static type
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression.
|
addExternalFunctionCallToPathMap, adjustRequiredType, checkArgumentCount, checkArguments, checkFunctionCall, computeHashCode, equals, getArg, getArguments, getArity, getDisplayName, getNetCost, getOperanda, operands, pluralArguments, preEvaluateIfConstant, setArg, setArguments, setOperanda, setOperanda, simplifyArguments, toShortString, toString
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getLocalRetainedStaticContext, getLocation, getPackageData, getParentExpression, getProperties, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStreamerName, hasCompatibleStaticContext, hashCode, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isInstruction, isLiftable, isMultiThreaded, isSameExpression, isStaticPropertiesKnown, isSubtreeExpression, isVacuousExpression, operandList, operandSparseList, optimizeChildren, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers, verifyParentPointers
public static final int NOT_TAIL_CALL
public static final int FOREIGN_TAIL_CALL
public static final int SELF_TAIL_CALL
public UserFunctionCall()
public boolean isBeingInlined()
public void setBeingInlined(boolean beingInlined)
public final void setFunctionName(StructuredQName name)
name
- the name of the functionpublic void setStaticType(SequenceType type)
type
- the static type of the result of the function callpublic void setFunction(UserFunction compiledFunction)
setFunction
in interface UserFunctionResolvable
compiledFunction
- the function being calledpublic void setBindingSlot(int slot)
setBindingSlot
in interface ComponentInvocation
slot
- the offset in the binding vector of the containing package where the target template
can be found.public int getBindingSlot()
getBindingSlot
in interface ComponentInvocation
public UserFunction getFunction()
public Component getFixedTarget()
ComponentInvocation
getFixedTarget
in interface ComponentInvocation
public boolean isTailCall()
public boolean isRecursiveTailCall()
public final StructuredQName getFunctionName()
getFunctionName
in class FunctionCall
public SymbolicName getSymbolicName()
ComponentInvocation
getSymbolicName
in interface ComponentInvocation
public Component getTarget()
public int[] getArgumentEvaluationModes()
public void setArgumentEvaluationModes(int[] evalModes)
evalModes
- the argument evaluation modes to be usedpublic Expression preEvaluate(ExpressionVisitor visitor)
preEvaluate
in class FunctionCall
visitor
- an expression visitorpublic ItemType getItemType()
getItemType
in class Expression
public UType getStaticUType(UType contextItemType)
getStaticUType
in class Expression
contextItemType
- the static type of the context itempublic int getIntrinsicDependencies()
Expression
getIntrinsicDependencies
in class Expression
public boolean isUpdatingExpression()
isUpdatingExpression
in class Expression
protected int computeSpecialProperties()
StaticProperty
. The "special" properties are properties
other than cardinality and dependencies, and most of them relate to properties of node sequences, for
example whether the nodes are in document order.computeSpecialProperties
in class Expression
public Expression copy(RebindingMap rebindings)
copy
in class Expression
rebindings
- public int computeCardinality()
computeCardinality
in class Expression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
FunctionCall
typeCheck
in class FunctionCall
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly)
absent; its static type; its streaming posture.XPathException
- if an error is discovered during this phase
(typically a type error)public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo 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 resetLocalStaticProperties()
resetLocalStaticProperties
in class Expression
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
- the PathMapNodeSet to which the paths embodied in this expression should be addedpublic int markTailFunctionCalls(StructuredQName qName, int arity)
markTailFunctionCalls
in class Expression
qName
- the name of the functionarity
- the arity (number of parameters) of the functionNOT_TAIL_CALL
if no tail call was found;
FOREIGN_TAIL_CALL
if a tail call on a different function was found;public int getImplementationMethod()
FunctionCall
getImplementationMethod
in class FunctionCall
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public Item evaluateItem(XPathContext c) throws XPathException
evaluateItem
in class Expression
c
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic SequenceIterator iterate(XPathContext c) throws XPathException
iterate
in class FunctionCall
c
- supplies the context for evaluationXPathException
- if any dynamic error occurs evaluating the
expressionpublic void evaluatePendingUpdates(XPathContext context, PendingUpdateList pul) throws XPathException
evaluatePendingUpdates
in class Expression
context
- the XPath dynamic evaluation contextpul
- the pending update list to which the results should be writtenXPathException
- if evaluation failspublic void process(XPathContext context) throws XPathException
process
in class Expression
context
- the XPath dynamic contextXPathException
public Component getTargetComponent(XPathContext context)
public UserFunction getTargetFunction(XPathContext context)
FunctionCall
getTargetFunction
in class FunctionCall
context
- the dynamic evaluation contextpublic Sequence[] evaluateArguments(XPathContext c) throws XPathException
evaluateArguments
in class FunctionCall
XPathException
public Sequence[] evaluateArguments(XPathContext c, boolean streamed) throws XPathException
XPathException
public void export(ExpressionPresenter out) throws XPathException
export
in interface ExportAgent
export
in class FunctionCall
out
- the expression presenter used to display the structureXPathException
- if the export fails, for example if an expression is found that won't work
in the target environment.public int getConstructType()
Expression
getConstructType
in class Expression
LocationKind
public java.lang.String getExpressionName()
getExpressionName
in class FunctionCall
public java.lang.Object getProperty(java.lang.String name)
getProperty
in class Expression
public StructuredQName getObjectName()
getObjectName
in class Expression
Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.