Package net.sf.saxon.expr
Class ConsumingOperand
java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.expr.UnaryExpression
net.sf.saxon.expr.ConsumingOperand
- All Implemented Interfaces:
ExportAgent,Locatable,IdentityComparable,Traceable
This expression is used as a proxy for the consuming operand of an expression such as an
arithmetic expression for which there is no explicit streaming support. The actual subexpression
is retained, so that it is accessible to compile time operations that walk the expression tree;
but at evaluation time, the subexpression is not evaluated in the conventional (pull) way,
rather its value is pushed up the tree as a consequence of template inversion.
Previously (until 9.6) a SuppliedParameterReference was used for the purpose; but this caused
problems with allocation of local variable slots: see bug 2320.
-
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected intGet the static cardinalitycopy(RebindingMap rebindings) Copy an expression.Get the value of this expression in a given context.evaluateItem(XPathContext context) Evaluate an expression as a single item.voidexport(ExpressionPresenter destination) Diagnostic print of expression structure.Make an elaborator for this expressionGet a name identifying the kind of expression, in terms meaningful to a user.intAn implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().intDetermine 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.protected OperandRoleGet the usage (in terms of streamability analysis) of the single operanditerate(XPathContext context) Get the value of this expression in a given context.Produce a short string identifying the expression for use in error messagestoString()The toString() method for an expression attempts to give a representation of the expression in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.Methods inherited from class net.sf.saxon.expr.UnaryExpression
computeHashCode, computeSpecialProperties, displayOperator, emitExtraAttributes, equals, getBaseExpression, getOperand, operands, optimize, setBaseExpression, typeCheckMethods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getLocalRetainedStaticContext, getLocation, getNetCost, 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, withLocationMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
Constructor Details
-
ConsumingOperand
Constructor- Parameters:
subExpression- identifies the expression for which this is a proxy.
-
-
Method Details
-
getOperandRole
Get the usage (in terms of streamability analysis) of the single operand- Specified by:
getOperandRolein classUnaryExpression- Returns:
- the operand usage
-
getItemType
Determine the data type of the expression, if possible.- Overrides:
getItemTypein classUnaryExpression- Returns:
- Type.ITEM, because we don't know the type of the supplied value in advance.
-
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:
getIntrinsicDependenciesin classExpression- Returns:
- a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
-
computeCardinality
protected int computeCardinality()Get the static cardinality- Overrides:
computeCardinalityin classUnaryExpression- Returns:
- ZERO_OR_MORE, unless we know the type of the supplied value in advance.
-
copy
Copy an expression. This makes a deep copy.- Specified by:
copyin classExpression- Parameters:
rebindings- variables that must be re-bound- Returns:
- the copy of the original expression
-
getImplementationMethod
public int getImplementationMethod()An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.- Specified by:
getImplementationMethodin classExpression- Returns:
- the implementation method, for example
Expression.ITERATE_METHODorExpression.EVALUATE_METHODorExpression.PROCESS_METHOD
-
evaluate
Get the value of this expression in a given context.- Parameters:
c- the XPathContext which contains the relevant variable bindings- Returns:
- the value of the variable, if it is defined
- Throws:
XPathException- if the variable is undefined
-
iterate
Get the value of this expression in a given context.- Overrides:
iteratein classExpression- Parameters:
context- the XPathContext which contains the relevant variable bindings- Returns:
- the value of the variable, if it is defined
- Throws:
XPathException- if the variable is undefined
-
evaluateItem
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:
evaluateItemin classExpression- 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
-
getExpressionName
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classExpression- 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 export() output displaying the expression.
-
export
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
exportin interfaceExportAgent- Overrides:
exportin classUnaryExpression- Parameters:
destination- 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.
-
toString
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax- Overrides:
toStringin classUnaryExpression- Returns:
- a representation of the expression as a string
-
toShortString
Description copied from class:ExpressionProduce a short string identifying the expression for use in error messages- Overrides:
toShortStringin classUnaryExpression- Returns:
- a short string, sufficient to identify the expression
-
getElaborator
Description copied from class:ExpressionMake an elaborator for this expression- Overrides:
getElaboratorin classExpression- Returns:
- an appropriate
Elaborator
-