Class StaticFunctionCall
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.FunctionCall
-
- net.sf.saxon.expr.StaticFunctionCall
-
- All Implemented Interfaces:
Callable,ExportAgent,Locatable,IdentityComparable,Traceable
- Direct Known Subclasses:
SystemFunctionCall
public class StaticFunctionCall extends FunctionCall implements Callable
A call to a function that is known statically. This is a stricter definition than "static function call" in the XPath grammar, because it excludes calls that might be re-bound to a different function as a result of XSLT overrides in a different package, calls to functions that hold dynamic context information in their closure, and so on.
-
-
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
Constructors Constructor Description StaticFunctionCall(Function target, Expression[] arguments)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sequencecall(XPathContext context, Sequence[] arguments)Call the Callable.protected intcomputeCardinality()Compute the static cardinality of this expressionExpressioncopy(RebindingMap rebindings)Copy an expression.voidexport(ExpressionPresenter out)Serialized output of expression structure.java.lang.StringgetExpressionName()Get a name identifying the kind of expression, in terms meaningful to a user.StructuredQNamegetFunctionName()Get the qualified of the function being calledItemTypegetItemType()Determine the data type of the expression, if possible.UTypegetStaticUType(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.FunctiongetTargetFunction()Get the target function to be calledFunctiongetTargetFunction(XPathContext context)Get the target function to be calledbooleanisCallOn(java.lang.Class<? extends SystemFunction> function)Ask whether this expression is a call on a particular functionExpressiontypeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)Type-check the expression.-
Methods inherited from class net.sf.saxon.expr.FunctionCall
addExternalFunctionCallToPathMap, adjustRequiredType, checkArgumentCount, checkArguments, checkFunctionCall, computeHashCode, equals, evaluateArguments, getArg, getArguments, getArity, getDisplayName, getImplementationMethod, getNetCost, getOperanda, iterate, operands, optimize, pluralArguments, preEvaluate, preEvaluateIfConstant, setArg, setArguments, setOperanda, setOperanda, simplifyArguments, toShortString, toString
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, 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
-
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 Detail
-
StaticFunctionCall
public StaticFunctionCall(Function target, Expression[] arguments)
-
-
Method Detail
-
getTargetFunction
public Function getTargetFunction()
Get the target function to be called- Returns:
- the target function
-
getTargetFunction
public Function getTargetFunction(XPathContext context)
Get the target function to be called- Specified by:
getTargetFunctionin classFunctionCall- Parameters:
context- the dynamic evaluation context (not used in this implementation)- Returns:
- the target function
-
getFunctionName
public StructuredQName getFunctionName()
Get the qualified of the function being called- Specified by:
getFunctionNamein classFunctionCall- Returns:
- the qualified name
-
isCallOn
public boolean isCallOn(java.lang.Class<? extends SystemFunction> function)
Ask whether this expression is a call on a particular function- Overrides:
isCallOnin classExpression- Parameters:
function- the implementation class of the function in question- Returns:
- true if the expression is a call on the function
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Type-check the expression. This also calls preEvaluate() to evaluate the function if all the arguments are constant; functions that do not require this behavior can override the preEvaluate method.- Overrides:
typeCheckin classFunctionCall- Parameters:
visitor- the expression visitorcontextInfo- information about the type of the context item- 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)
-
copy
public Expression copy(RebindingMap rebindings)
Copy an expression. This makes a deep copy.- Specified by:
copyin classExpression- Parameters:
rebindings- variables that need to be re-bound- Returns:
- the copy of the original expression
-
computeCardinality
protected int computeCardinality()
Compute the static cardinality of this expression- Specified by:
computeCardinalityin 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
-
getItemType
public ItemType 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:
getItemTypein classExpression- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
-
getStaticUType
public 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.- Overrides:
getStaticUTypein classExpression- Parameters:
contextItemType- the static type of the context item- Returns:
- the static item type of the expression according to the XSLT 3.0 defined rules
-
call
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException
Call the Callable.- Specified by:
callin 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
GroundedValueby calling the utility methd 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
ItemorAtomicValue.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
-
getExpressionName
public java.lang.String getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classFunctionCall- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
-
export
public void export(ExpressionPresenter out) throws XPathException
Serialized output of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
exportin interfaceExportAgent- Overrides:
exportin classFunctionCall- Parameters:
out- destination of the SEF output- Throws:
XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
-
-