public abstract class FunctionCall extends Expression
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 |
---|
FunctionCall() |
Modifier and Type | Method and Description |
---|---|
PathMap.PathMapNodeSet |
addExternalFunctionCallToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodes)
Add a representation of this expression to a PathMap.
|
boolean |
adjustRequiredType(JavaExternalObjectType requiredType)
When a call to a Java extension function appears in a context where there the required type
is a Java external object (typically an xsl:variable with a declared type, or as an argument
to another Java extension function), notify this required type so that the process of converting
the result to an XDM value can be short-circuited.
|
protected int |
checkArgumentCount(int min,
int max)
Check number of arguments.
|
protected void |
checkArguments(ExpressionVisitor visitor)
Method supplied by each class of function to check arguments during parsing, when all
the argument expressions have been read
|
void |
checkFunctionCall(Function target,
ExpressionVisitor visitor)
Check the function call against the declared function signature, applying the
function conversion rules to each argument as necessary
|
int |
computeHashCode()
Get hashCode in support of equals() method
|
boolean |
equals(java.lang.Object o)
Determine whether two expressions are equivalent
|
Sequence[] |
evaluateArguments(XPathContext context) |
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
Expression |
getArg(int n)
Get the expression supplied as the Nth argument
|
Expression[] |
getArguments()
Get the expressions supplied as actual arguments to the function
|
int |
getArity()
Determine the number of actual arguments supplied in the function call
|
java.lang.String |
getDisplayName()
Get the name of the function for display in messages
|
java.lang.String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
abstract 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 |
getNetCost()
Return the estimated cost of evaluating an expression.
|
OperandArray |
getOperanda()
Get the data structure holding the operands of this expression.
|
abstract Function |
getTargetFunction(XPathContext context)
Get the target function to be called
|
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.
|
java.lang.Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
static java.lang.String |
pluralArguments(int num)
Utility routine used in constructing error messages: get the word "argument" or "arguments"
|
Expression |
preEvaluate(ExpressionVisitor visitor)
Pre-evaluate a function at compile time.
|
protected Expression |
preEvaluateIfConstant(ExpressionVisitor visitor) |
void |
setArg(int n,
Expression child)
Set the expression to be used as the Nth argument
|
void |
setArguments(Expression[] args)
Method called by the expression parser when all arguments have been supplied
|
protected void |
setOperanda(Expression[] args,
OperandRole[] roles) |
protected void |
setOperanda(OperandArray operanda)
Set the data structure for the operands of this expression.
|
protected Expression |
simplifyArguments(StaticContext env)
Simplify the arguments of the function.
|
java.lang.String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
java.lang.String |
toString()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression.
|
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeCardinality, computeDependencies, computeSpecialProperties, computeStaticProperties, copy, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getItemType, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, hasCompatibleStaticContext, hashCode, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isCallOnSystemFunction, isIdentical, isInstruction, isLiftable, isMultiThreaded, isSameExpression, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers, verifyParentPointers
protected void setOperanda(OperandArray operanda)
operanda
- the data structure for expression operandspublic OperandArray getOperanda()
public java.lang.Iterable<Operand> operands()
Expression
If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.
operands
in class Expression
public abstract Function getTargetFunction(XPathContext context) throws XPathException
context
- the dynamic evaluation contextXPathException
- if the target function cannot be determinedpublic abstract StructuredQName getFunctionName()
public final int getArity()
public void setArguments(Expression[] args)
args
- the expressions contained in the argument list of the function callprotected void setOperanda(Expression[] args, OperandRole[] roles)
public Expression[] getArguments()
public Expression getArg(int n)
n
- the required argument, zero-basedjava.lang.IllegalArgumentException
- if the value of n is out of rangepublic void setArg(int n, Expression child)
n
- the required argument, zero-basedchild
- the expression to be used in the relevant positionjava.lang.IllegalArgumentException
- if the value of n is out of rangeprotected final Expression simplifyArguments(StaticContext env) throws XPathException
env
- the static contextXPathException
- if an error occurspublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck
in class Expression
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)protected Expression preEvaluateIfConstant(ExpressionVisitor visitor) throws XPathException
XPathException
public void checkFunctionCall(Function target, ExpressionVisitor visitor) throws XPathException
target
- the function being calledvisitor
- an expression visitorXPathException
- if there is a type errorpublic Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
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 Expression
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 int getNetCost()
getNetCost
in class Expression
public Expression preEvaluate(ExpressionVisitor visitor) throws XPathException
visitor
- an expression visitorXPathException
- if evaluation failsprotected void checkArguments(ExpressionVisitor visitor) throws XPathException
visitor
- the expression visitorXPathException
- if the arguments are incorrectprotected int checkArgumentCount(int min, int max) throws XPathException
min
- the minimum number of arguments allowedmax
- the maximum number of arguments allowedXPathException
- if the number of arguments is out of rangepublic int getImplementationMethod()
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public static java.lang.String pluralArguments(int num)
num
- the number of argumentspublic PathMap.PathMapNodeSet addExternalFunctionCallToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodes)
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.
pathMap
- the PathMap to which the expression should be addedpathMapNodes
- the node in the PathMap representing the focus at the point where this expression
is called. Set to null if this expression appears at the top level, in which case the expression, if it
is registered in the path map at all, must create a new path map root.public java.lang.String getExpressionName()
getExpressionName
in class Expression
public final java.lang.String getDisplayName()
public java.lang.String toString()
toString
in class Expression
public java.lang.String toShortString()
toShortString
in class Expression
public void export(ExpressionPresenter out) throws XPathException
export
in interface ExportAgent
export
in class Expression
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 boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int computeHashCode()
computeHashCode
in class Expression
public SequenceIterator iterate(XPathContext context) throws XPathException
iterate
in class Expression
context
- supplies the context for evaluationXPathException
- if any dynamic error occurs evaluating the
expressionpublic Sequence[] evaluateArguments(XPathContext context) throws XPathException
XPathException
public boolean adjustRequiredType(JavaExternalObjectType requiredType) throws XPathException
requiredType
- the required type of the result of the function, determined by the context
in which the function call appearsXPathException
- if the required return type is incompatible with the type actually returned
by the Java methodCopyright (c) 2004-2018 Saxonica Limited. All rights reserved.