Class IntegratedFunctionCall
- All Implemented Interfaces:
Callable
,ExportAgent
,Locatable
,IdentityComparable
,Traceable
ExtensionFunctionCall
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class checks that NodeInfo objects returned by an extension function were created under the right ConfigurationNested classes/interfaces inherited from class net.sf.saxon.expr.FunctionCall
FunctionCall.FunctionCallElaborator
-
Field Summary
Fields inherited from class net.sf.saxon.expr.Expression
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 Summary
ConstructorsConstructorDescriptionIntegratedFunctionCall
(StructuredQName name, ExtensionFunctionCall function) -
Method Summary
Modifier and TypeMethodDescriptioncall
(XPathContext context, Sequence[] arguments) Call the Callable.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.protected int
Compute the static cardinality of this expressionprotected int
Compute the special properties of this expression.copy
(RebindingMap rebindings) Copy an expression.boolean
effectiveBooleanValue
(XPathContext context) Get the effective boolean value of the expression.evaluateItem
(XPathContext context) Evaluate an expression as a single item.void
Diagnostic print of expression structure.Get the ExtensionFunctionCall object supplied by the applicationGet the qualified of the function being calledint
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions.Determine the data type of the expression, if possible.getTargetFunction
(XPathContext context) Get the target function to be callediterate
(XPathContext context) Return an Iterator to iterate over the values of a sequence.preEvaluate
(ExpressionVisitor visitor) Pre-evaluate a function at compile time.void
setResultType
(SequenceType resultType) Set the result type of the functiontypeCheck
(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Type-check the expression.Methods inherited from class net.sf.saxon.expr.FunctionCall
addExternalFunctionCallToPathMap, adjustRequiredType, checkArgumentCount, checkFunctionCall, computeHashCode, equals, getArg, getArguments, getArity, getDisplayName, getExpressionName, getImplementationMethod, getNetCost, getOperanda, operands, optimize, plural, preEvaluateIfConstant, setArg, setArguments, setOperanda, setOperanda, simplifyArguments, toShortString, toString
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getElaborator, getEvaluationMethod, getExtraProperty, getIntegerBounds, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, makeElaborator, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers, withLocation
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
Constructor Details
-
IntegratedFunctionCall
-
-
Method Details
-
setResultType
Set the result type of the function- Parameters:
resultType
- the result type
-
getFunctionName
Get the qualified of the function being called- Specified by:
getFunctionName
in classFunctionCall
- Returns:
- the qualified name
-
getTargetFunction
Get the target function to be called- Specified by:
getTargetFunction
in classFunctionCall
- Parameters:
context
- the dynamic evaluation context- Returns:
- the target function, or null if unknown
-
getFunction
Get the ExtensionFunctionCall object supplied by the application- Returns:
- the ExtensionFunctionCall object
-
checkArguments
Method supplied by each class of function to check arguments during parsing, when all the argument expressions have been read. This implementation of the method checks the arguments of the supplied function call against the argument types declared as part of the extension function definition, and generates code to do the conversion if necessary.- Overrides:
checkArguments
in classFunctionCall
- Parameters:
visitor
- the expression visitor- Throws:
XPathException
- if the arguments are statically determined to be incompatible with the declared argument types of the function.
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Type-check the expression.- Overrides:
typeCheck
in classFunctionCall
- Parameters:
visitor
- an expression visitorcontextInfo
- Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.- Returns:
- the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
- Throws:
XPathException
- if an error is discovered during this phase (typically a type error)
-
preEvaluate
Pre-evaluate a function at compile time. This function does not allow pre-evaluation, so the method returns null.- Overrides:
preEvaluate
in classFunctionCall
- Parameters:
visitor
- an expression visitor- Returns:
- for this class: always null
-
getItemType
Determine the data type of the expression, if possible. All expression return sequences, in general; this method determines the type of the items within the sequence, assuming that (a) this is known in advance, and (b) it is the same for all items in the sequence.This method should always return a result, though it may be the best approximation that is available at the time.
- Specified by:
getItemType
in classExpression
- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
-
computeCardinality
protected int computeCardinality()Compute the static cardinality of this expression- Specified by:
computeCardinality
in classExpression
- Returns:
- the computed cardinality, as one of the values
StaticProperty.ALLOWS_ZERO_OR_ONE
,StaticProperty.EXACTLY_ONE
,StaticProperty.ALLOWS_ONE_OR_MORE
,StaticProperty.ALLOWS_ZERO_OR_MORE
-
getIntrinsicDependencies
public int getIntrinsicDependencies()Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. For example, position() has an intrinsic dependency on the context position, while (position()+1) does not. The default implementation of the method returns 0, indicating "no dependencies".- Overrides:
getIntrinsicDependencies
in classExpression
- Returns:
- a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
-
computeSpecialProperties
protected int computeSpecialProperties()Compute the special properties of this expression. These properties are denoted by a bit-significant integer, possible values are in classStaticProperty
. 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.- Overrides:
computeSpecialProperties
in classExpression
- Returns:
- the special properties, as a bit-significant integer
-
copy
Copy an expression. This makes a deep copy.- Specified by:
copy
in classExpression
- Parameters:
rebindings
- Variables that need to be re-bound- Returns:
- the copy of the original expression
-
export
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
export
in interfaceExportAgent
- Overrides:
export
in classFunctionCall
- Parameters:
out
- the expression presenter used to display the structure- Throws:
XPathException
- if the export fails, for example if an expression is found that won't work in the target environment.
-
iterate
Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.- Overrides:
iterate
in classFunctionCall
- Parameters:
context
- supplies the context for evaluation- Returns:
- a SequenceIterator that can be used to iterate over the result of the expression
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
evaluateItem
Description copied from class:Expression
Evaluate an expression as a single item. This always returns either a single Item or null (denoting the empty sequence). No conversion is done. This method should not be used unless the static type of the expression is a subtype of "item" or "item?": that is, it should not be called if the expression may return a sequence. There is no guarantee that this condition will be detected.- Overrides:
evaluateItem
in classFunctionCall
- Parameters:
context
- The context in which the expression is to be evaluated- Returns:
- the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
effectiveBooleanValue
Get the effective boolean value of the expression. This returns false if the value is the empty sequence, a zero-length string, a number equal to zero, or the boolean false. Otherwise it returns true.- Overrides:
effectiveBooleanValue
in classExpression
- Parameters:
context
- The context in which the expression is to be evaluated- Returns:
- the effective boolean value
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
call
Description copied from interface:Callable
Call the Callable.- Specified by:
call
in interfaceCallable
- Parameters:
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
orAtomicValue
.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.
- Returns:
- the result of the evaluation, in the form of a Sequence. It is the responsibility of the callee to ensure that the type of result conforms to the expected result type.
- Throws:
XPathException
- if a dynamic error occurs during the evaluation of the expression
-