Package net.sf.saxon.expr
Class LocalVariableReference
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.VariableReference
-
- net.sf.saxon.expr.LocalVariableReference
-
- All Implemented Interfaces:
BindingReference
,ExportAgent
,Locatable
,IdentityComparable
,Traceable
public class LocalVariableReference extends VariableReference
Variable reference: a reference to a local variable. This subclass of VariableReference bypasses the Binding object to get the value directly from the relevant slot in the local stackframe.
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.VariableReference
binding, constantValue, staticType
-
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 LocalVariableReference(LocalBinding binding)
Create a LocalVariableReference bound to a given BindingLocalVariableReference(StructuredQName name)
Create a local variable reference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
copy(RebindingMap rebindings)
Create a clone copy of this VariableReferenceSequence
evaluateVariable(XPathContext c)
Return the value of the variableLocalBinding
getBinding()
Get the object bound to the variablejava.lang.String
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.int
getSlotNumber()
Get the slot number allocated to this local variablevoid
setBinding(LocalBinding binding)
void
setSlotNumber(int slotNumber)
Set the slot number for this local variable, that is, its position in the local stack frame-
Methods inherited from class net.sf.saxon.expr.VariableReference
addToPathMap, computeCardinality, computeHashCode, computeSpecialProperties, copyFrom, equals, evaluateItem, export, fixup, getDisplayName, getEQName, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getItemType, getNetCost, getScopingExpression, getStaticUType, getStreamerName, getVariableName, isFiltered, isFlattened, isInLoop, iterate, optimize, process, recomputeInLoop, refineVariableType, setFiltered, setFlattened, setInLoop, setStaticType, setVariableName, toShortString, toString, typeCheck
-
Methods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getInterpretedExpression, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operands, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers
-
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
-
LocalVariableReference
public LocalVariableReference(StructuredQName name)
Create a local variable reference. The binding and slot number will be supplied later
-
LocalVariableReference
public LocalVariableReference(LocalBinding binding)
Create a LocalVariableReference bound to a given Binding- Parameters:
binding
- the binding (that is, the declaration of this local variable)
-
-
Method Detail
-
copy
public Expression copy(RebindingMap rebindings)
Create a clone copy of this VariableReference- Specified by:
copy
in classVariableReference
- Parameters:
rebindings
- a mutable list of (old binding, new binding) pairs that is used to update the bindings held in any local variable references that are copied.- Returns:
- the cloned copy
-
setBinding
public void setBinding(LocalBinding binding)
-
getBinding
public LocalBinding getBinding()
Description copied from class:VariableReference
Get the object bound to the variable- Overrides:
getBinding
in classVariableReference
- Returns:
- the Binding which declares this variable and associates it with a value
-
setSlotNumber
public void setSlotNumber(int slotNumber)
Set the slot number for this local variable, that is, its position in the local stack frame- Parameters:
slotNumber
- the slot number to be used
-
getSlotNumber
public int getSlotNumber()
Get the slot number allocated to this local variable- Returns:
- the slot number
-
evaluateVariable
public Sequence evaluateVariable(XPathContext c) throws XPathException
Return the value of the variable- Overrides:
evaluateVariable
in classVariableReference
- Parameters:
c
- the XPath dynamic context- Returns:
- the value of the variable
- Throws:
XPathException
- if any dynamic error occurs while evaluating the variable
-
getExpressionName
public java.lang.String getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionName
in classVariableReference
- 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.
-
-