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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GlobalVariableReference.GlobalVariableReferenceElaborator
Elaborator for a global variable reference, for example$globalVar
.
-
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 VariableReferenceGroundedValue
evaluateVariable(XPathContext c)
Evaluate this variablevoid
export(ExpressionPresenter out)
Diagnostic print of expression structure.int
getBindingSlot()
Get the binding slot to be used.Elaborator
getElaborator()
Make an elaborator for this expressionjava.lang.String
getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.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 referencesComponent
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, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getItemType, getNetCost, getScopingExpression, getStaticUType, getStreamerName, getVariableName, isFiltered, isFlattened, isInLoop, iterate, optimize, process, recomputeInLoop, refineVariableType, setFiltered, setFlattened, setInLoop, setStaticType, setVariableName, supportsLazyEvaluation, toShortString, toString, typeCheck
-
Methods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dispatchTailCall, dynamicError, effectiveBooleanValue, evaluateAsString, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, 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, makeElaborator, 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, withLocation
-
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 classVariableReference
- 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 interfaceComponentInvocation
- 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 interfaceComponentInvocation
- 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 interfaceComponentInvocation
- 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 interfaceComponentInvocation
- Returns:
- the bound component if the binding has been fixed
-
evaluateVariable
public GroundedValue evaluateVariable(XPathContext c) throws XPathException
Evaluate this variable- Overrides:
evaluateVariable
in classVariableReference
- 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 interfaceExportAgent
- Overrides:
export
in classVariableReference
- 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()
-
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.
-
getElaborator
public Elaborator getElaborator()
Make an elaborator for this expression- Overrides:
getElaborator
in classExpression
- Returns:
- a suitable elaborator
-
-