public abstract class Assignation extends Expression implements LocalBinding
Modifier and Type | Field and Description |
---|---|
protected boolean |
hasLoopingReference |
protected boolean |
isIndexedVariable |
protected java.util.List<VariableReference> |
references |
protected SequenceType |
requiredType |
protected int |
slotNumber |
protected StructuredQName |
variableName |
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 and Description |
---|
Assignation() |
Modifier and Type | Method and Description |
---|---|
void |
addReference(VariableReference ref,
boolean isLoopingReference)
Register a variable reference that refers to the variable bound in this expression
|
PathMap.PathMapNodeSet |
addToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap.
|
void |
checkForUpdatingSubexpressions()
Check to ensure that this expression does not contain any inappropriate updating subexpressions.
|
int |
computeDependencies()
Compute the dependencies of an expression, as the union of the
dependencies of its sub-expressions.
|
Sequence<?> |
evaluateVariable(XPathContext context)
Get the value of the range variable
|
Expression |
getAction()
Get the action expression
|
Operand |
getActionOp() |
double |
getCost()
Return the estimated cost of evaluating an expression.
|
IntegerValue[] |
getIntegerBoundsForVariable()
If the variable is bound to an integer, get the minimum and maximum possible values.
|
int |
getLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number.
|
int |
getNominalReferenceCount()
Get the (nominal) count of the number of references to this variable
|
StructuredQName |
getObjectName() |
int |
getRequiredSlots()
Get the number of slots required.
|
SequenceType |
getRequiredType()
Get the declared type of the variable
|
Expression |
getSequence()
Get the "sequence" expression - the one to which the variable is bound
|
Operand |
getSequenceOp() |
java.lang.String |
getVariableEQName()
Get the name of the range variable as a Name or EQName.
|
java.lang.String |
getVariableName()
Get the display name of the range variable, for diagnostics only
|
StructuredQName |
getVariableQName()
Get the name of the variable
|
boolean |
hasVariableBinding(Binding binding)
Ask whether this expression is, or contains, the binding of a given variable
|
boolean |
isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign
extension element.
|
boolean |
isGlobal()
Indicate whether the binding is local or global.
|
boolean |
isIndexedVariable()
Test whether the variable bound by this let expression should be indexable
|
boolean |
isUpdatingExpression()
Determine whether this is an updating expression as defined in the XQuery update specification
|
java.lang.Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
void |
rebuildReferenceList(boolean force)
Rebuild the reference list to guide subsequent optimization.
|
void |
refineTypeInformation(ItemType type,
int cardinality,
GroundedValue<?> constantValue,
int properties,
Assignation currentExpression)
Refine the type information associated with this variable declaration.
|
protected boolean |
removeDeadReferences()
Remove dead references from the reference list of the variable; at the same time, check whether
any of the variable references is in a loop, and return true if so.
|
boolean |
replaceVariable(Expression seq)
Replace all references to the variable bound by this let expression,
that occur within the action expression, with the given expression
|
void |
setAction(Expression action)
Add the "return" or "satisfies" expression, and fix up all references to the
range variable that occur within that expression
|
void |
setIndexedVariable()
Indicate that the variable bound by this let expression should be indexable
(because it is used in an appropriate filter expression)
|
void |
setRequiredType(SequenceType requiredType)
Set the required type (declared type) of the variable
|
void |
setSequence(Expression sequence)
Set the "sequence" expression - the one to which the variable is bound
|
void |
setSlotNumber(int nr)
Set the slot number for the range variable
|
void |
setVariableQName(StructuredQName variableName)
Set the name of the variable
|
void |
suppressValidation(int validationMode)
Suppress validation on contained element constructors, on the grounds that the parent element
is already performing validation.
|
Expression |
unordered(boolean retainAllNodes,
boolean forStreaming)
Replace this expression by a simpler expression that delivers the results without regard
to order.
|
protected void |
verifyReferences()
This method recomputes the reference list by scanning the subtree rooted at this variable binding.
|
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkPermittedContents, computeCardinality, computeHashCode, computeSpecialProperties, computeStaticProperties, copy, dynamicError, effectiveBooleanValue, equals, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, export, getCardinality, getConfiguration, getConstructType, getDependencies, getEvaluationMethod, getExpressionName, getExtraProperty, getImplementationMethod, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getItemType, getLocalRetainedStaticContext, getLocation, getNetCost, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, hasCompatibleStaticContext, hashCode, hasSpecialProperty, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isVacuousExpression, iterate, markTailFunctionCalls, operandList, operandSparseList, optimize, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, toPattern, toShortString, toString, typeCheck, typeCheckChildren, typeError, verifyParentPointers
protected int slotNumber
protected StructuredQName variableName
protected SequenceType requiredType
protected boolean isIndexedVariable
protected boolean hasLoopingReference
protected java.util.List<VariableReference> references
public Operand getSequenceOp()
public Operand getActionOp()
public java.lang.Iterable<Operand> operands()
Expression
If the expression is a Callable, then it is required that the order of the operands returned by this function is the same as the order of arguments supplied to the corresponding call() method.
operands
in class Expression
public void setRequiredType(SequenceType requiredType)
requiredType
- the required typepublic void setVariableQName(StructuredQName variableName)
variableName
- the name of the variablepublic StructuredQName getVariableQName()
getVariableQName
in interface Binding
public StructuredQName getObjectName()
getObjectName
in class Expression
public SequenceType getRequiredType()
getRequiredType
in interface Binding
public IntegerValue[] getIntegerBoundsForVariable()
getIntegerBoundsForVariable
in interface Binding
public int getLocalSlotNumber()
getLocalSlotNumber
in interface LocalBinding
public int computeDependencies()
computeDependencies
in class Expression
public Sequence<?> evaluateVariable(XPathContext context) throws XPathException
evaluateVariable
in interface Binding
context
- the XPath dynamic evaluation contextXPathException
- if an error occurs while evaluating
the variablepublic void setAction(Expression action)
action
- the expression that occurs after the "return" keyword of a "for"
expression, the "satisfies" keyword of "some/every", or the ":=" operator of
a "let" expression.public final boolean isGlobal()
public final boolean isAssignable()
isAssignable
in interface Binding
public void checkForUpdatingSubexpressions() throws XPathException
checkForUpdatingSubexpressions
in class Expression
XPathException
- if the expression has a non-permitted updateing subexpressionpublic boolean isUpdatingExpression()
isUpdatingExpression
in class Expression
public Expression getAction()
public void setSequence(Expression sequence)
sequence
- the expression to which the variable is boundpublic Expression getSequence()
public void setSlotNumber(int nr)
nr
- the slot number to be usedpublic int getRequiredSlots()
public boolean hasVariableBinding(Binding binding)
Expression
hasVariableBinding
in class Expression
binding
- the variable bindingpublic 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 optimizing for streamingXPathException
- if the rewrite failspublic double getCost()
getCost
in class Expression
public void suppressValidation(int validationMode)
suppressValidation
in class Expression
validationMode
- the kind of validation being performed on the parent expressionpublic 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 java.lang.String getVariableName()
public java.lang.String getVariableEQName()
public void refineTypeInformation(ItemType type, int cardinality, GroundedValue<?> constantValue, int properties, Assignation currentExpression) throws XPathException
type
- the inferred item type of the expression to which the variable is boundcardinality
- the inferred cardinality of the expression to which the variable is boundconstantValue
- the constant value to which the variable is bound (null if there is no constant value)properties
- other static properties of the expression to which the variable is boundcurrentExpression
- the expression that binds the variableXPathException
public void addReference(VariableReference ref, boolean isLoopingReference)
addReference
in interface Binding
ref
- the variable referenceisLoopingReference
- - true if the reference occurs within a loop, such as the predicate
of a filter expressionpublic int getNominalReferenceCount()
protected boolean removeDeadReferences()
protected void verifyReferences()
public void rebuildReferenceList(boolean force)
force
- if true, the search is exhaustive. If false, the search (and therefore the attempt to
inline variables) is abandoned after a while to avoid excessive cost. This happens when
a stylesheet contains very large templates or functions.public boolean isIndexedVariable()
isIndexedVariable
in interface LocalBinding
public boolean replaceVariable(Expression seq)
seq
- the expressionpublic void setIndexedVariable()
setIndexedVariable
in interface LocalBinding
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.