public class GlobalVariable extends GeneralVariable implements Container, Declaration, InstructionInfo
| Modifier and Type | Field and Description |
|---|---|
protected List<BindingReference> |
references |
evaluationMode, referenceCount, slotNumber, variableQName| Constructor and Description |
|---|
GlobalVariable()
Create a global variable
|
| Modifier and Type | Method and Description |
|---|---|
protected Sequence |
actuallyEvaluate(XPathContext context)
Evaluate the global variable, and save its value for use in subsequent references.
|
void |
compile(Executable exec,
int slot)
Create a compiled representation of this global variable
|
Sequence |
evaluateVariable(XPathContext context)
Evaluate the variable
|
int |
getColumnNumber(long locationId)
Get the column number within the document, entity, or module containing a particular location
|
int |
getConstructType()
Get the type of construct.
|
Container |
getContainer()
Get the container in which this expression is located.
|
int |
getContainerGranularity()
Get the granularity of the container.
|
Executable |
getExecutable()
Get the executable containing this global variable
|
int |
getHostLanguage()
Get the host language (XSLT, XQuery, XPath) used to implement the code in this container
|
int |
getLineNumber()
Get the line number where the declaration appears
|
int |
getLineNumber(long locationId)
Get the line number within the document, entity or module containing a particular location
|
StructuredQName |
getObjectName()
Get a name identifying the object of the expression, for example a function name, template name,
variable name, key name, element name, etc.
|
GlobalVariable |
getOriginalVariable()
Get the original declaration of this variable
|
Iterator<String> |
getProperties()
Get an iterator over all the properties available.
|
Object |
getProperty(String name)
Get the value of a particular property of the instruction.
|
Sequence |
getSelectValue(XPathContext context)
Evaluate the variable.
|
String |
getSystemId()
Get the system ID of the module containing the variable declaration
|
GlobalVariable |
getUltimateOriginalVariable()
Get the original declaration of this variable, or its original declaration, transitively
|
boolean |
isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign
extension element.
|
boolean |
isGlobal()
Is this a global variable?
|
boolean |
isIndexedVariable()
Ask whether this is an indexed variable
|
boolean |
isPrivate()
Ask whether this global variable is private
|
Iterator |
iterateReferences()
Iterate over the references to this variable
|
void |
lookForCycles(Stack<Container> referees,
XQueryFunctionLibrary globalFunctionLibrary)
Check for cycles in this variable definition
|
void |
registerReference(BindingReference ref)
Register a variable reference that refers to this global variable
|
void |
setAssignable(boolean assignable)
Indicate whether this variable is assignable using saxon:assign
|
void |
setContainsLocals(SlotManager map)
The expression that initializes a global variable may itself use local variables.
|
protected static void |
setDependencies(Bindery bindery,
GlobalVariable var,
XPathContext context)
Get the variable that is immediately dependent on this one, and register the dependency, so
that circularities can be detected across threads.
|
void |
setExecutable(Executable executable)
Set the containing executable
|
void |
setIndexedVariable()
Mark this as an indexed variable, to allow fast searching
|
void |
setLineNumber(int lineNumber)
Set the line number where the variable declaration appears in the source
|
void |
setOriginalVariable(GlobalVariable var)
Say that this (XQuery) variable is a copy of some originally declared variable.
|
void |
setPrivate(boolean b)
Say whether this global variable is a "parameter" (an external variable, in XQuery terminology)
|
void |
setSystemId(String systemId)
Set the system ID of the module where the variable declaration appears
|
void |
typeCheck(ExpressionVisitor visitor)
Type check the compiled representation of this global variable
|
addReference, checkAgainstRequiredType, computeEvaluationMode, copy, explain, getCardinality, getColumnNumber, getEvaluationMode, getInstructionNameCode, getIntegerBoundsForVariable, getLocalSlotNumber, getLocationId, getLocationProvider, getPublicId, getRequiredType, getSelectExpression, getSlotNumber, getSystemId, getVariableQName, init, isImplicitlyRequiredParam, isRequiredParam, isTunnelParam, iterateSubExpressions, optimize, replaceSubExpression, setContainer, setImplicitlyRequiredParam, setLocationId, setReferenceCount, setRequiredParam, setRequiredType, setSelectExpression, setSlotNumber, setTunnel, setVariableQName, simplify, typeCheckclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetLocationProvidergetColumnNumber, getPublicIdgetColumnNumber, getPublicIdgetSystemIdprotected List<BindingReference> references
public Executable getExecutable()
getExecutable in interface ContainergetExecutable in class GeneralVariablepublic void setExecutable(Executable executable)
executable - the executable that contains this global variablepublic void setOriginalVariable(GlobalVariable var)
var - the variable in the imported module from which this variable is derivedpublic GlobalVariable getOriginalVariable()
public GlobalVariable getUltimateOriginalVariable()
public void setLineNumber(int lineNumber)
lineNumber - the line numberpublic int getLineNumber()
getLineNumber in interface SourceLocatorgetLineNumber in interface InstructionInfogetLineNumber in interface LocatorgetLineNumber in class GeneralVariablepublic int getLineNumber(long locationId)
LocationProvidergetLineNumber in interface LocationProviderlocationId - identifier of the location in question (as passed down the Receiver pipeline)public void setSystemId(String systemId)
systemId - the System ID (base URI)public String getSystemId()
getSystemId in interface SourceLocatorgetSystemId in interface InstructionInfogetSystemId in interface LocatorgetSystemId in class GeneralVariablepublic int getColumnNumber(long locationId)
getColumnNumber in interface LocationProviderlocationId - identifier of the location in question (as passed down the Receiver pipeline)public boolean isPrivate()
public void setPrivate(boolean b)
b - true if this variable is externalpublic void setAssignable(boolean assignable)
assignable - true if this variable is assignablepublic final boolean isAssignable()
isAssignable in interface BindingisAssignable in class GeneralVariablepublic int getConstructType()
StandardNames: all less than 1024)
or it will be a constant in class Location.getConstructType in interface InstructionInfopublic StructuredQName getObjectName()
getObjectName in interface InstructionInfopublic Object getProperty(String name)
getProperty in interface InstructionInfoname - The name of the required propertypublic Iterator<String> getProperties()
getProperties in interface InstructionInfopublic Container getContainer()
getContainer in class GeneralVariablepublic int getHostLanguage()
getHostLanguage in interface ContainerConfiguration.XSLT or Configuration.XQUERYpublic void setIndexedVariable()
public boolean isIndexedVariable()
public int getContainerGranularity()
getContainerGranularity in interface Containerpublic void setContainsLocals(SlotManager map)
map - The stack frame map for local variables used while evaluating this global
variable.public boolean isGlobal()
isGlobal in interface BindingisGlobal in class GeneralVariablepublic void registerReference(BindingReference ref)
ref - the variable referencepublic Iterator iterateReferences()
VariableReferencepublic void compile(Executable exec, int slot) throws XPathException
exec - the executableslot - the slot number allocated to this variableXPathException - if compile-time errors are found.public void typeCheck(ExpressionVisitor visitor) throws XPathException
visitor - an expression visitorXPathException - if compile-time errors are found.public void lookForCycles(Stack<Container> referees, XQueryFunctionLibrary globalFunctionLibrary) throws XPathException
referees - the calls leading up to this one; it's an error if this variable is on the
stack, because that means it calls itself directly or indirectly. The stack may contain
variable definitions (GlobalVariable objects) and user-defined functions (UserFunction objects).
It will never contain the same object more than once.globalFunctionLibrary - the library containing all global functionsXPathException - if cycles are foundpublic Sequence getSelectValue(XPathContext context) throws XPathException
getSelectValue in class GeneralVariablecontext - the XPath dynamic contextXPathException - if evaluation of the select expression fails
with a dynamic errorpublic Sequence evaluateVariable(XPathContext context) throws XPathException
evaluateVariable in interface Bindingcontext - the XPath dynamic evaluation contextXPathException - if an error occurs while evaluating
the variableprotected Sequence actuallyEvaluate(XPathContext context) throws XPathException
context - the XPath dynamic contextXPathException - if evaluation failsprotected static void setDependencies(Bindery bindery, GlobalVariable var, XPathContext context) throws XPathException
bindery - the Binderyvar - the global variable or parameter being evaluatedcontext - the dynamic evaluation contextXPathExceptionCopyright (c) 2004-2013 Saxonica Limited. All rights reserved.