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:
    Serializable, SourceLocator, LocationProvider, SaxonLocator, BindingReference, InstructionInfo, Locator
  Direct Known Subclasses:
    GroupVariableReference

      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.VariableReference

      `binding, constantValue, staticType`

    - ### Fields inherited from class net.sf.saxon.expr.Expression

      `EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, INHERITED_CONTEXT, INSPECTION_CONTEXT, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, NAVIGATION_CONTEXT, NODE_VALUE_CONTEXT, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, W3C_CONSUMING, W3C_FREE_RANGING, W3C_GROUP_CONSUMING, W3C_MOTIONLESS, WATCH_METHOD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalVariableReference()` Create a local variable reference.
    `LocalVariableReference(Binding binding)` Create a LocalVariableReference bound to a given Binding

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `copy()` Create a clone copy of this VariableReference
    `Sequence` | `evaluateVariable(XPathContext c)` Return the value of the variable
    `ExpressionCompiler` | `getExpressionCompiler()` Return the compiler of the LocalVariableReference expression
    `int` | `getSlotNumber()` Get the slot number allocated to this local variable
    `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, equals, evaluateItem, explain, fixup, getBinding, getDisplayName, getEQName, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getItemType, getStreamability, hashCode, isFiltered, isFlattened, isInLoop, iterate, optimize, process, promote, refineVariableType, setFiltered, setFlattened, setStaticType, toString, typeCheck`

    - ### Methods inherited from class net.sf.saxon.expr.Expression

      `adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getExpressionName, getHostLanguage, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamingAdjunct, getSystemId, getSystemId, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterateEvents, iterateSubExpressionInfo, iterateSubExpressions, markTailFunctionCalls, replaceSubExpression, resetLocalStaticProperties, setContainer, setEvaluationMethod, setLocationId, simplify, staticTypeCheck, suppressValidation, toPattern, toStreamingPattern, typeError`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, 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

    - #### copy

          public Expression copy()

      Create a clone copy of this VariableReference
      Overrides:
        `copy` in class `VariableReference`
      Returns:
        the cloned copy

    - #### 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 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

    - #### getExpressionCompiler

          public ExpressionCompiler getExpressionCompiler()

      Return the compiler of the LocalVariableReference expression
      Overrides:
        `getExpressionCompiler` in class `VariableReference`
      Returns:
        the relevant ExpressionCompiler

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.