public class IntegratedFunctionCall extends FunctionCall implements Callable
ExtensionFunctionCall
Modifier and Type | Class and Description |
---|---|
static class |
IntegratedFunctionCall.ConfigurationCheckingFunction
This class checks that NodeInfo objects returned by an extension function were created
under the right Configuration
|
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
Constructor and Description |
---|
IntegratedFunctionCall(StructuredQName name,
ExtensionFunctionCall function) |
Modifier and Type | Method and Description |
---|---|
Sequence<?> |
call(XPathContext context,
Sequence[] arguments)
Call the Callable.
|
void |
checkArguments(ExpressionVisitor visitor)
Method supplied by each class of function to check arguments during parsing, when all
the argument expressions have been read.
|
protected int |
computeCardinality()
Compute the static cardinality of this expression
|
protected int |
computeSpecialProperties()
Compute the special properties of this expression.
|
Expression |
copy(RebindingMap rebindings)
Copy an expression.
|
boolean |
effectiveBooleanValue(XPathContext context)
Get the effective boolean value of the expression.
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
ExtensionFunctionCall |
getFunction()
Get the ExtensionFunctionCall object supplied by the application
|
StructuredQName |
getFunctionName()
Get the qualified of the function being called
|
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.
|
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.
|
Expression |
preEvaluate(ExpressionVisitor visitor)
Pre-evaluate a function at compile time.
|
void |
setResultType(SequenceType resultType)
Set the result type of the function
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression.
|
addExternalFunctionCallToPathMap, adjustRequiredType, checkArgumentCount, checkFunctionCall, computeHashCode, equals, evaluateArguments, getArg, getArguments, getArity, getDisplayName, getExpressionName, getImplementationMethod, getNetCost, getOperanda, operands, optimize, pluralArguments, preEvaluateIfConstant, setArg, setArguments, setOperanda, setOperanda, simplifyArguments, toShortString, toString
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers
public IntegratedFunctionCall(StructuredQName name, ExtensionFunctionCall function)
public void setResultType(SequenceType resultType)
resultType
- the result typepublic StructuredQName getFunctionName()
getFunctionName
in class FunctionCall
public Function getTargetFunction(XPathContext context)
getTargetFunction
in class FunctionCall
context
- the dynamic evaluation contextpublic ExtensionFunctionCall getFunction()
public void checkArguments(ExpressionVisitor visitor) throws XPathException
checkArguments
in class FunctionCall
visitor
- the expression visitorXPathException
- if the arguments are statically determined to be incompatible
with the declared argument types of the function.public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
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 preEvaluate(ExpressionVisitor visitor)
preEvaluate
in class FunctionCall
visitor
- an expression visitorpublic ItemType getItemType()
This method should always return a result, though it may be the best approximation that is available at the time.
getItemType
in class Expression
protected 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 int getIntrinsicDependencies()
getIntrinsicDependencies
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
- Variables that need to be re-boundpublic 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 SequenceIterator<?> iterate(XPathContext context) throws XPathException
iterate
in class FunctionCall
context
- supplies the context for evaluationXPathException
- if any dynamic error occurs evaluating the
expressionpublic boolean effectiveBooleanValue(XPathContext context) throws XPathException
effectiveBooleanValue
in class Expression
context
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic Sequence<?> call(XPathContext context, Sequence[] arguments) throws XPathException
Callable
call
in interface Callable
context
- the dynamic evaluation contextarguments
- the values of the arguments, supplied as Sequences.
Generally it is advisable, if calling iterate() to process a supplied sequence, to
call it only once; if the value is required more than once, it should first be converted
to a GroundedValue
by calling the utility method
SequenceTool.toGroundedValue().
If the expected value is a single item, the item should be obtained by calling
Sequence.head(): it cannot be assumed that the item will be passed as an instance of
Item
or AtomicValue
.
It is the caller's responsibility to perform any type conversions required to convert arguments to the type expected by the callee. An exception is where this Callable is explicitly an argument-converting wrapper around the original Callable.
XPathException
- if a dynamic error occurs during the evaluation of the expressionCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.