Package net.sf.saxon.expr

## Class GlobalVariableReference

- java.lang.Object
- - net.sf.saxon.expr.Expression
  - - net.sf.saxon.expr.VariableReference
    - - net.sf.saxon.expr.GlobalVariableReference

- All Implemented Interfaces:
    `BindingReference`, `ComponentInvocation`, `ExportAgent`, `Locatable`, `IdentityComparable`, `Traceable`

      public class GlobalVariableReference
      extends VariableReference
      implements ComponentInvocation

  A reference to a global variable

- - ### 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
    --- | ---
    `GlobalVariableReference​(GlobalVariable var)` |
    `GlobalVariableReference​(StructuredQName name)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Expression` | `copy​(RebindingMap rebindings)` | Create a clone copy of this VariableReference
    `GroundedValue` | `evaluateVariable​(XPathContext c)` | Evaluate this variable
    `void` | `export​(ExpressionPresenter out)` | Diagnostic print of expression structure.
    `int` | `getBindingSlot()` | Get the binding slot to be used.
    `Component` | `getFixedTarget()` | Get the target component if this is known in advance, that is, if the target component is private or final, or in some other cases such as xsl:original.
    `java.util.Set<Expression>` | `getPreconditions()` |
    `SymbolicName` | `getSymbolicName()` | Get the symbolic name of the component that this invocation references
    `Component` | `getTarget()` |
    `void` | `setBindingSlot​(int slot)` | Set the binding slot to be used.
    `void` | `setTarget​(Component target)` |

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

      `addToPathMap, computeCardinality, computeHashCode, computeSpecialProperties, copyFrom, equals, evaluateItem, fixup, getBinding, getDisplayName, getEQName, getExpressionName, 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

    - #### GlobalVariableReference

          public GlobalVariableReference​(StructuredQName name)

    - #### GlobalVariableReference

          public GlobalVariableReference​(GlobalVariable var)

  - ### Method Detail

    - #### copy

          public Expression copy​(RebindingMap rebindings)

      Description copied from class: `VariableReference`
      Create a clone copy of this VariableReference
      Specified by:
        `copy` in class `VariableReference`
      Parameters:
        `rebindings` - variables that need to switch to new bindings
      Returns:
        the cloned copy

    - #### setBindingSlot

          public void setBindingSlot​(int slot)

      Set the binding slot to be used. This is the offset within the binding vector of the containing component where the actual target component is to be found. The target template is not held directly in the invocation instruction/expression itself because it can be overridden in a using package.
      Specified by:
        `setBindingSlot` in interface `ComponentInvocation`
      Parameters:
        `slot` - the offset in the binding vector of the containing package where the target component can be found.

    - #### getBindingSlot

          public int getBindingSlot()

      Get the binding slot to be used. This is the offset within the binding vector of the containing component where the actual target component is to be found.
      Specified by:
        `getBindingSlot` in interface `ComponentInvocation`
      Returns:
        the offset in the binding vector of the containing package where the target component can be found.

    - #### getSymbolicName

          public SymbolicName getSymbolicName()

      Get the symbolic name of the component that this invocation references
      Specified by:
        `getSymbolicName` in interface `ComponentInvocation`
      Returns:
        the symbolic name of the target component

    - #### setTarget

          public void setTarget​(Component target)

    - #### getTarget

          public Component getTarget()

    - #### getFixedTarget

          public Component getFixedTarget()

      Description copied from interface: `ComponentInvocation`
      Get the target component if this is known in advance, that is, if the target component is private or final, or in some other cases such as xsl:original. Otherwise, return null.
      Specified by:
        `getFixedTarget` in interface `ComponentInvocation`
      Returns:
        the bound component if the binding has been fixed

    - #### evaluateVariable

          public GroundedValue evaluateVariable​(XPathContext c)
                                         throws XPathException

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

    - #### export

          public void export​(ExpressionPresenter out)
                      throws XPathException

      Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.
      Specified by:
        `export` in interface `ExportAgent`
      Overrides:
        `export` in class `VariableReference`
      Parameters:
        `out` - the expression presenter used to display the structure
      Throws:
        `XPathException` - if the export fails, for example if an expression is found that won't work in the target environment.

    - #### getPreconditions

          public java.util.Set<Expression> getPreconditions()