public class SystemFunctionCall extends StaticFunctionCall implements Negatable
SystemFunction
)Modifier and Type | Class and Description |
---|---|
static class |
SystemFunctionCall.Optimized
Subclass representing a system function call that has been optimized; this overrides the
optimize() method to do nothing, thus ensuring that optimization converges.
|
Modifier and Type | Field and Description |
---|---|
Evaluator[] |
argumentEvaluators |
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 |
---|
SystemFunctionCall(SystemFunction target,
Expression[] arguments) |
Modifier and Type | Method and Description |
---|---|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
|
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.
|
Sequence[] |
evaluateArguments(XPathContext context) |
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
java.lang.String |
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.
|
IntegerValue[] |
getIntegerBounds()
For an expression that returns an integer or a sequence of integers, get
a lower and upper bound on the values of the integers that may be returned, from
static analysis.
|
int |
getIntrinsicDependencies()
Compute the dependencies of an expression, as the union of the
dependencies of its subexpressions.
|
ItemType |
getItemType()
Determine the data type of the expression, if possible.
|
int |
getNetCost()
Return the estimated cost of evaluating an expression.
|
Expression |
getScopingExpression()
Get the innermost scoping expression of this expression, for expressions that directly
depend on something in the dynamic context.
|
SystemFunction |
getTargetFunction()
Get the target function to be called
|
boolean |
isLiftable(boolean forStreaming)
Ask whether the expression can be lifted out of a loop, assuming it has no dependencies
on the controlling variable/focus of the loop
|
boolean |
isNegatable(TypeHierarchy th)
Check whether this specific instance of the expression is negatable
|
boolean |
isVacuousExpression()
Determine whether this is a vacuous expression as defined in the XQuery update specification
|
Expression |
negate()
Create an expression that returns the negation of this expression
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Perform optimisation of an expression and its subexpressions.
|
Expression |
preEvaluate(ExpressionVisitor visitor)
Pre-evaluate a function at compile time.
|
void |
resetLocalStaticProperties()
Reset the static properties of the expression to -1, so that they have to be recomputed
next time they are used.
|
void |
setRetainedStaticContext(RetainedStaticContext rsc)
Set the retained static context
|
Pattern |
toPattern(Configuration config,
boolean is30)
Convert this expression to an equivalent XSLT pattern
|
Expression |
typeCheck(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Type-check the expression.
|
Expression |
unordered(boolean retainAllNodes,
boolean forStreaming)
Replace this expression by a simpler expression that delivers the results without regard
to order.
|
call, getFunctionName, getStaticUType, getTargetFunction, isCallOn, isCallOnSystemFunction
addExternalFunctionCallToPathMap, adjustRequiredType, checkArgumentCount, checkArguments, checkFunctionCall, computeHashCode, equals, getArg, getArguments, getArity, getDisplayName, getImplementationMethod, getOperanda, iterate, operands, pluralArguments, preEvaluateIfConstant, setArg, setArguments, setOperanda, setOperanda, simplifyArguments, toShortString, toString
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getConstructType, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getInterpretedExpression, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStreamerName, hasCompatibleStaticContext, hashCode, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isIdentical, isInstruction, isMultiThreaded, isSameExpression, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, process, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, typeCheckChildren, typeError, verifyParentPointers, verifyParentPointers
public Evaluator[] argumentEvaluators
public SystemFunctionCall(SystemFunction target, Expression[] arguments)
public void setRetainedStaticContext(RetainedStaticContext rsc)
setRetainedStaticContext
in class Expression
rsc
- the static context to be retainedpublic Expression preEvaluate(ExpressionVisitor visitor) throws XPathException
preEvaluate
in class FunctionCall
visitor
- an expression visitorXPathException
- if evaluation failspublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
typeCheck
in class StaticFunctionCall
visitor
- the expression visitorcontextInfo
- information about the type of the context itemXPathException
- if an error is discovered during this phase
(typically a type error)public SystemFunction getTargetFunction()
StaticFunctionCall
getTargetFunction
in class StaticFunctionCall
public int getIntrinsicDependencies()
getIntrinsicDependencies
in class Expression
protected int computeCardinality()
computeCardinality
in class StaticFunctionCall
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
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 int getNetCost()
getNetCost
in class FunctionCall
public Expression getScopingExpression()
Expression
getScopingExpression
in class Expression
public boolean isLiftable(boolean forStreaming)
isLiftable
in class Expression
forStreaming
- true if the expression is being optimized for streamingpublic Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
FunctionCall
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 FunctionCall
visitor
- an expression visitorcontextInfo
- 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 boolean isVacuousExpression()
Expression
isVacuousExpression
in class Expression
public 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 StaticFunctionCall
public Expression copy(RebindingMap rebindings)
copy
in class StaticFunctionCall
rebindings
- public IntegerValue[] getIntegerBounds()
getIntegerBounds
in class Expression
public boolean isNegatable(TypeHierarchy th)
isNegatable
in interface Negatable
th
- the TypeHierarchy (in case it's needed)public Expression negate()
public Expression unordered(boolean retainAllNodes, boolean forStreaming) throws XPathException
unordered
in class Expression
retainAllNodes
- set to true if the result must contain exactly the same nodes as the
original; set to false if the result can eliminate (or introduce) duplicates.forStreaming
- set to true if the result is to be optimized for streamingXPathException
- if the rewrite failspublic PathMap.PathMapNodeSet addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
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.
addToPathMap
in class Expression
pathMap
- the PathMap to which the expression should be addedpathMapNodeSet
- the PathMapNodeSet to which the paths embodied in this expression should be addedpublic Pattern toPattern(Configuration config, boolean is30) throws XPathException
toPattern
in class Expression
config
- the Saxon configurationis30
- true if this is XSLT 3.0XPathException
- if conversion is not possiblepublic Sequence[] evaluateArguments(XPathContext context) throws XPathException
evaluateArguments
in class FunctionCall
XPathException
public void resetLocalStaticProperties()
Expression
resetLocalStaticProperties
in class Expression
public java.lang.String getExpressionName()
getExpressionName
in class StaticFunctionCall
public void export(ExpressionPresenter out) throws XPathException
export
in interface ExportAgent
export
in class StaticFunctionCall
out
- XPathException
- if the export fails, for example if an expression is found that won't work
in the target environment.Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.