net.sf.saxon.expr
Class LocalVariableReference

java.lang.Object
  extended by net.sf.saxon.expr.Expression
      extended by net.sf.saxon.expr.VariableReference
          extended by net.sf.saxon.expr.LocalVariableReference
All Implemented Interfaces:
Serializable, SourceLocator, BindingReference, EvaluableItem, SequenceIterable, InstructionInfoProvider

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.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD
 
Constructor Summary
LocalVariableReference()
          Create a local variable reference.
LocalVariableReference(Binding binding)
          Create a LocalVariableReference bound to a given Binding
 
Method Summary
 ValueRepresentation evaluateVariable(XPathContext c)
          Return the value of the variable
 int getSlotNumber()
          Get the slot number allocated to this local variable
 void refineVariableReference()
          Replace this VariableReference where appropriate by a more efficient implementation.
 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, computeSpecialProperties, copy, equals, evaluateItem, explain, fixup, getBinding, getDisplayName, getImplementationMethod, getIntrinsicDependencies, getItemType, hashCode, isFiltered, isFlattened, isInLoop, iterate, optimize, process, promote, refineVariableReference, refineVariableType, setFiltered, setFlattened, setStaticType, toString, typeCheck
 
Methods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, display, doPromotion, effectiveBooleanValue, evaluateAsString, explain, findParentOf, getCardinality, getColumnNumber, getContainer, getDependencies, getExecutable, getHostLanguage, getInstructionInfo, getLineNumber, getLocationId, getLocationProvider, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, iterateEvents, iterateSubExpressions, markTailFunctionCalls, replaceSubExpression, setContainer, setLocationId, simplify, staticTypeCheck, suppressValidation
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalVariableReference

public LocalVariableReference()
Create a local variable reference. The binding and slot number will be supplied later


LocalVariableReference

public LocalVariableReference(Binding binding)
Create a LocalVariableReference bound to a given Binding

Parameters:
binding - the binding (that is, the declaration of this local variable)
Method Detail

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 ValueRepresentation evaluateVariable(XPathContext c)
                                     throws XPathException
Return the value of the variable

Overrides:
evaluateVariable in class VariableReference
Parameters:
c - the XPath dynamic context
Returns:
the value of the variable
Throws:
XPathException - if any dynamic error occurs while evaluating the variable

refineVariableReference

public void refineVariableReference()
Replace this VariableReference where appropriate by a more efficient implementation.



Copyright (C) Michael H. Kay. All rights reserved.