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.
-
-
Nested Class Summary
-
Nested 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
Constructors Constructor Description StaticFunctionCall(FunctionItem target, Expression[] arguments)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sequence
call(XPathContext context, Sequence[] arguments)
Call the Callable.protected int
computeCardinality()
Compute the static cardinality of this expressionExpression
copy(RebindingMap rebindings)
Copy an expression.void
export(ExpressionPresenter out)
Serialized output of expression structure.Elaborator
getElaborator()
Make an elaborator for this expressionjava.lang.String
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.StructuredQName
getFunctionName()
Get the qualified of the function being calledItemType
getItemType()
Determine the data type of the expression, if possible.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.FunctionItem
getTargetFunction()
Get the target function to be calledFunctionItem
getTargetFunction(XPathContext context)
Get the target function to be calledboolean
isCallOn(java.lang.Class<? extends SystemFunction> function)
Ask whether this expression is a call on a particular functionExpression
typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)
Type-check the expression.-
Methods inherited from class net.sf.saxon.expr.FunctionCall
addExternalFunctionCallToPathMap, adjustRequiredType, checkArgumentCount, checkArguments, checkFunctionCall, computeHashCode, equals, evaluateItem, getArg, getArguments, getArity, getDisplayName, getImplementationMethod, getNetCost, getOperanda, iterate, operands, optimize, plural, 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, dispatchTailCall, dynamicError, effectiveBooleanValue, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, 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, 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 Detail
-
StaticFunctionCall
public StaticFunctionCall(FunctionItem target, Expression[] arguments)
-
-
Method Detail
-
getTargetFunction
public FunctionItem getTargetFunction()
Get the target function to be called- Returns:
- the target function
-
getTargetFunction
public FunctionItem getTargetFunction(XPathContext context)
Get the target function to be called- Specified by:
getTargetFunction
in 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:
getFunctionName
in 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:
isCallOn
in 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:
typeCheck
in 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:
copy
in 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:
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
-
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:
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)
-
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:
getStaticUType
in 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:
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 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
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
-
getExpressionName
public java.lang.String getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionName
in 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:
export
in interfaceExportAgent
- Overrides:
export
in 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.
-
getElaborator
public Elaborator getElaborator()
Description copied from class:Expression
Make an elaborator for this expression- Overrides:
getElaborator
in classExpression
- Returns:
- an appropriate
Elaborator
-
-