Class 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.
  • Constructor Details Link icon

    • LocalVariableReference Link icon

      public LocalVariableReference(StructuredQName name)
      Create a local variable reference. The binding and slot number will be supplied later
      Parameters:
      name - the name of the local variable
    • LocalVariableReference Link icon

      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 Details Link icon

    • copy Link icon

      public Expression copy(RebindingMap rebindings)
      Create a clone copy of this VariableReference
      Specified by:
      copy in class VariableReference
      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 Link icon

      public void setBinding(LocalBinding binding)
    • getBinding Link icon

      public LocalBinding getBinding()
      Description copied from class: VariableReference
      Get the object bound to the variable
      Overrides:
      getBinding in class VariableReference
      Returns:
      the Binding which declares this variable and associates it with a value
    • setSlotNumber Link icon

      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 Link icon

      public int getSlotNumber()
      Get the slot number allocated to this local variable
      Returns:
      the slot number
    • evaluateVariable Link icon

      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
    • getExpressionName Link icon

      public String getExpressionName()
      Get a name identifying the kind of expression, in terms meaningful to a user.
      Overrides:
      getExpressionName in class VariableReference
      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.
    • getElaborator Link icon

      public Elaborator getElaborator()
      Make an elaborator for this expression
      Overrides:
      getElaborator in class Expression
      Returns:
      a suitable elaborator