public abstract class GeneralVariable extends Object implements Binding, SourceLocator
Modifier and Type | Field and Description |
---|---|
protected int |
evaluationMode |
protected int |
referenceCount |
protected int |
slotNumber |
protected StructuredQName |
variableQName |
Constructor and Description |
---|
GeneralVariable()
Create a general variable
|
Modifier and Type | Method and Description |
---|---|
void |
addReference(boolean isLoopingReference)
Register a variable reference that refers to the variable bound in this expression
|
void |
checkAgainstRequiredType(ExpressionVisitor visitor)
Check the select expression against the required type.
|
void |
computeEvaluationMode() |
Expression |
copy()
Copy an expression.
|
void |
explain(ExpressionPresenter out)
Diagnostic print of expression structure.
|
int |
getCardinality()
Get the cardinality of the result of this instruction.
|
int |
getColumnNumber()
Get the column number of the expression
|
Container |
getContainer()
Get the container in which this expression is located.
|
int |
getEvaluationMode()
Get the evaluation mode of the variable
|
Executable |
getExecutable()
Get the executable containing this expression
|
int |
getInstructionNameCode()
Get the name of this instruction (that is xsl:variable, xsl:param etc) for diagnostics
|
IntegerValue[] |
getIntegerBoundsForVariable()
If the variable is bound to an integer, get the minimum and maximum possible values.
|
int |
getLineNumber()
Get the line number of the expression
|
int |
getLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number.
|
int |
getLocationId()
Get the location ID of the expression
|
LocationProvider |
getLocationProvider()
Get the LocationProvider allowing location identifiers to be resolved.
|
String |
getPublicId()
Get the publicId of the module containing the expression (to satisfy the SourceLocator interface)
|
SequenceType |
getRequiredType()
Get the required type of this variable
|
Expression |
getSelectExpression()
Get the expression to which this variable is bound
|
Sequence |
getSelectValue(XPathContext context)
Evaluate the variable.
|
int |
getSlotNumber()
Get the slot number allocated to this variable
|
String |
getSystemId()
Get the systemId of the module containing the expression
|
String |
getSystemId(long locationId) |
StructuredQName |
getVariableQName()
Get the name of this variable
|
void |
init(Expression select,
StructuredQName qName)
Initialize the properties of the variable
|
boolean |
isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign
extension element.
|
boolean |
isGlobal()
Indicate whether the binding is local or global.
|
boolean |
isImplicitlyRequiredParam()
Ask whether this variable represents a parameter that is implicitly required, because there is no usable
default value
|
boolean |
isRequiredParam()
Ask whether this variable represents a required parameter
|
boolean |
isTunnelParam()
Ask whether this variable represents a tunnel parameter
|
Iterator<Expression> |
iterateSubExpressions()
Get all the XPath expressions associated with this instruction
(in XSLT terms, the expression present on attributes of the instruction,
as distinct from the child instructions in a sequence construction)
|
void |
optimize(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType) |
boolean |
replaceSubExpression(Expression original,
Expression replacement)
Replace one subexpression by a replacement subexpression
|
void |
setContainer(Container container)
Mark a variable as being in a given Container.
|
void |
setImplicitlyRequiredParam(boolean requiredParam)
Indicate that this variable represents a parameter that is implicitly required (because there is no
usable default value)
|
void |
setLocationId(int id)
Set the location ID on an expression.
|
void |
setReferenceCount(int refCount)
Set the nominal number of references to this variable
|
void |
setRequiredParam(boolean requiredParam)
Indicate that this variable represents a required parameter
|
void |
setRequiredType(SequenceType required)
Set the required type of this variable
|
void |
setSelectExpression(Expression select)
Set the expression to which this variable is bound
|
void |
setSlotNumber(int s)
Set the slot number of this variable
|
void |
setTunnel(boolean tunnel)
Indicate whether this variable represents a tunnel parameter
|
void |
setVariableQName(StructuredQName s)
Set the name of the variable
|
void |
simplify(ExpressionVisitor visitor)
Simplify this variable
|
void |
typeCheck(ExpressionVisitor visitor,
ExpressionVisitor.ContextItemType contextItemType) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
evaluateVariable
protected StructuredQName variableQName
protected int slotNumber
protected int referenceCount
protected int evaluationMode
public void init(Expression select, StructuredQName qName)
select
- the expression to which the variable is boundqName
- the name of the variablepublic void setContainer(Container container)
This affects the expression and all its subexpressions. Any subexpressions that are not in the same container are marked with the new container, and this proceeds recursively. However, any subexpression that is already in the correct container is not modified.
container
- The container of this expression.public Container getContainer()
public void setLocationId(int id)
id
- the location idpublic final int getLocationId()
public int getLineNumber()
getLineNumber
in interface SourceLocator
public int getColumnNumber()
getColumnNumber
in interface SourceLocator
public String getSystemId()
getSystemId
in interface SourceLocator
public final String getPublicId()
getPublicId
in interface SourceLocator
public Executable getExecutable()
public LocationProvider getLocationProvider()
public String getSystemId(long locationId)
public void setSelectExpression(Expression select)
select
- the initializing expressionpublic Expression getSelectExpression()
public void setRequiredType(SequenceType required)
required
- the required typepublic SequenceType getRequiredType()
getRequiredType
in interface Binding
public IntegerValue[] getIntegerBoundsForVariable()
getIntegerBoundsForVariable
in interface Binding
public void setRequiredParam(boolean requiredParam)
requiredParam
- true if this is a required parameterpublic void setImplicitlyRequiredParam(boolean requiredParam)
requiredParam
- true if this is an implicitly required parameterpublic void setTunnel(boolean tunnel)
tunnel
- true if this is a tunnel parameterpublic void setReferenceCount(int refCount)
refCount
- the nominal number of referencespublic int getEvaluationMode()
ExpressionTool
public int getCardinality()
public boolean isAssignable()
Binding
isAssignable
in interface Binding
public boolean isGlobal()
Binding
public int getLocalSlotNumber()
getLocalSlotNumber
in interface Binding
public final boolean isRequiredParam()
public final boolean isImplicitlyRequiredParam()
public final boolean isTunnelParam()
public int getInstructionNameCode()
public void simplify(ExpressionVisitor visitor) throws XPathException
visitor
- an expressionXPathException
- if a failure occurspublic void typeCheck(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
XPathException
public void optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) throws XPathException
XPathException
public void computeEvaluationMode()
public Expression copy()
public void addReference(boolean isLoopingReference)
Binding
addReference
in interface Binding
isLoopingReference
- - true if the reference occurs within a loop, such as the predicate
of a filter expressionpublic void checkAgainstRequiredType(ExpressionVisitor visitor) throws XPathException
visitor
- an expression visitorXPathException
- if the check failspublic Sequence getSelectValue(XPathContext context) throws XPathException
context
- the XPath dynamic contextXPathException
- if evaluation of the select expression fails
with a dynamic errorpublic Iterator<Expression> iterateSubExpressions()
public boolean replaceSubExpression(Expression original, Expression replacement)
original
- the original subexpressionreplacement
- the replacement subexpressionpublic void explain(ExpressionPresenter out)
out
- the object used to present the outputpublic int getSlotNumber()
public void setSlotNumber(int s)
s
- the slot number, that is, the position allocated to this variable on its stack framepublic void setVariableQName(StructuredQName s)
s
- the name of the variable (a QName)public StructuredQName getVariableQName()
getVariableQName
in interface Binding
Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.