Package net.sf.saxon.expr
Class ContextValueSetter
java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.expr.BinaryExpression
net.sf.saxon.expr.ContextValueSetter
- All Implemented Interfaces:
ContextOriginator,ContextSwitchingExpression,ExportAgent,Locatable,IdentityComparable,Traceable
Abstract 4.0 expression of the form "A -> B".
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classElaborator for a context value setter expression. -
Field Summary
Fields inherited from class net.sf.saxon.expr.BinaryExpression
operatorFields 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, UPDATE_METHOD, WATCH_METHOD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intDetermine the static cardinality of the expressionprotected intGet hashCode for comparing two expressionsprotected intGet the static properties of this expression (other than its type).copy(RebindingMap rebindings) Copy an expression.booleanIs this expression the same as another expression?evaluateItem(XPathContext context) Evaluate an expression as a single item.voidexport(ExpressionPresenter destination) Export expression structure to SEF file.Get the step expression (the right-hand operand)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().final ItemTypeDetermine the data type of the items returned by this expressionprotected OperandRolegetOperandRole(int arg) Get the operand roleGet the start expression (the left-hand operand)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.iterate(XPathContext context) Return an Iterator to iterate over the values of a sequence.optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) Perform optimisation of an expression and its subexpressions.typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) Type-check the expressionMethods inherited from class net.sf.saxon.expr.BinaryExpression
displayOperator, explainExtraAttributes, getLhs, getLhsExpression, getOperator, getRhs, getRhsExpression, isAssociative, isCommutative, isInverse, operands, setFlattened, setLhsExpression, setRhsExpression, tag, toShortString, toStringMethods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, 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, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, supportsLazyEvaluation, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers, warning, 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
-
ContextValueSetter
Constructor- Parameters:
start- The left hand operand (which must always select a sequence of nodes).step- The step to be followed from each node in the start expression to yield a new sequence; this may return either nodes or atomic values (but not a mixture of the two)
-
-
Method Details
-
getOperandRole
Description copied from class:BinaryExpressionGet the operand role- Overrides:
getOperandRolein classBinaryExpression- Parameters:
arg- which argument: 0 for the lhs, 1 for the rhs- Returns:
- the operand role
-
getExpressionName
Description copied from class:ExpressionGet 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.
-
getSelectExpression
Get the start expression (the left-hand operand)- Specified by:
getSelectExpressionin interfaceContextSwitchingExpression- Returns:
- the first operand
-
getActionExpression
Get the step expression (the right-hand operand)- Specified by:
getActionExpressionin interfaceContextSwitchingExpression- Returns:
- the second operand
-
getItemType
Determine the data type of the items returned by this expression- Specified by:
getItemTypein classExpression- Returns:
- the type of the start expression
-
getStaticUType
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
-
typeCheck
public Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Type-check the expression- Overrides:
typeCheckin classBinaryExpression- 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)
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException Description copied from class:BinaryExpressionPerform optimisation of an expression and its subexpressions.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.
- Overrides:
optimizein classBinaryExpression- Parameters:
visitor- an expression visitorcontextItemType- 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 toType.ITEM_TYPE- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
XPathException- if an error is discovered during this phase (typically a type error)
-
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.- Overrides:
getImplementationMethodin classBinaryExpression- Returns:
- the implementation method, for example
Expression.ITERATE_METHODorExpression.EVALUATE_METHODorExpression.PROCESS_METHOD
-
copy
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
-
computeSpecialProperties
protected int computeSpecialProperties()Get the static properties of this expression (other than its type). The result is bit-significant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.- Overrides:
computeSpecialPropertiesin classBinaryExpression- Returns:
StaticProperty.NO_NODES_NEWLY_CREATED. This is overridden for some subclasses.
-
computeCardinality
protected int computeCardinality()Determine the static cardinality of the expression- Overrides:
computeCardinalityin classBinaryExpression- 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. May also returnStaticProperty.ALLOWS_ZEROif the result is known to be an empty sequence, orStaticProperty.ALLOWS_MANYif if is known to return a sequence of length two or more.
-
equals
Is this expression the same as another expression?- Overrides:
equalsin classBinaryExpression- Parameters:
other- the other operand; the result is false if this is not an Expression- Returns:
- true if the other operand is an expression and if it can be determined that the two expressions are equivalent, in the sense that they will always return the same result.
-
computeHashCode
protected int computeHashCode()Get hashCode for comparing two expressions- Overrides:
computeHashCodein classBinaryExpression- Returns:
- a computed hash code
-
export
Export expression structure to SEF file. The abstract expression tree is written to the supplied output destination.- Specified by:
exportin interfaceExportAgent- Overrides:
exportin classBinaryExpression- Parameters:
destination- the output destination for the displayed expression tree- Throws:
XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
-
evaluateItem
Description copied from class:ExpressionEvaluate 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
-
iterate
Description copied from class:ExpressionReturn 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:
iteratein classExpression- 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
-
getElaborator
Make an elaborator for this expression- Overrides:
getElaboratorin classExpression- Returns:
- a suitable elaborator
-