net.sf.saxon.expr

Class Assignation

public abstract class Assignation extends ComputedExpression implements Binding

Assignation is an abstract superclass for the kinds of expression that declare range variables: for, some, and every.
Field Summary
protected Expressionaction
protected RangeVariableDeclarationdeclaration
protected intnameCode
protected Expressionsequence
protected intslotNumber
protected StringvariableName
Method Summary
ValueRepresentationevaluateVariable(XPathContext context)
Get the value of the range variable
protected Binding[]extendBindingList(Binding[] in)
Extend an array of variable bindings to include the binding(s) defined in this expression
ExpressiongetAction()
Get the action expression
intgetLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number.
intgetRequiredSlots()
Get the number of slots required.
RangeVariableDeclarationgetVariableDeclaration()
Get the variable declaration
intgetVariableFingerprint()
StringgetVariableName(NamePool pool)
Get the display name of the range variable, for diagnostics only
intgetVariableNameCode()
booleanisAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign extension element.
booleanisGlobal()
Indicate whether the binding is local or global.
IteratoriterateSubExpressions()
Get the immediate subexpressions of this expression
Expressionpromote(PromotionOffer offer)
Promote this expression if possible
protected ExpressionpromoteWhereClause(Binding positionBinding)
Promote a WHERE clause whose condition doesn't depend on the variable being bound.
voidsetAction(Expression action)
Add the "return" or "satisfies" expression, and fix up all references to the range variable that occur within that expression
voidsetSequence(Expression sequence)
Set the "sequence" expression - the one to which the variable is bound
voidsetSlotNumber(int nr)
Set the slot number for the range variable
voidsetVariableDeclaration(RangeVariableDeclaration decl)
Set the reference to the variable declaration
Expressionsimplify(StaticContext env)
Simplify the expression
voidsuppressValidation(int validationMode)
Suppress validation on contained element constructors, on the grounds that the parent element is already performing validation.

Field Detail

action

protected Expression action

declaration

protected transient RangeVariableDeclaration declaration

nameCode

protected int nameCode

sequence

protected Expression sequence

slotNumber

protected int slotNumber

variableName

protected String variableName

Method Detail

evaluateVariable

public ValueRepresentation evaluateVariable(XPathContext context)
Get the value of the range variable

extendBindingList

protected Binding[] extendBindingList(Binding[] in)
Extend an array of variable bindings to include the binding(s) defined in this expression

getAction

public Expression getAction()
Get the action expression

getLocalSlotNumber

public int getLocalSlotNumber()
If this is a local variable held on the local stack frame, return the corresponding slot number. In other cases, return -1.

getRequiredSlots

public int getRequiredSlots()
Get the number of slots required. Normally 1, except for a FOR expression with an AT clause, where it is 2.

getVariableDeclaration

public RangeVariableDeclaration getVariableDeclaration()
Get the variable declaration

getVariableFingerprint

public int getVariableFingerprint()

getVariableName

public String getVariableName(NamePool pool)
Get the display name of the range variable, for diagnostics only

getVariableNameCode

public int getVariableNameCode()

isAssignable

public final boolean isAssignable()
Test whether it is permitted to assign to the variable using the saxon:assign extension element. This will only be for an XSLT global variable where the extra attribute saxon:assignable="yes" is present.

isGlobal

public final boolean isGlobal()
Indicate whether the binding is local or global. A global binding is one that has a fixed value for the life of a query or transformation; any other binding is local.

iterateSubExpressions

public Iterator iterateSubExpressions()
Get the immediate subexpressions of this expression

promote

public Expression promote(PromotionOffer offer)
Promote this expression if possible

promoteWhereClause

protected Expression promoteWhereClause(Binding positionBinding)
Promote a WHERE clause whose condition doesn't depend on the variable being bound. This rewrites an expression of the form

let $i := SEQ return if (C) then R else ()

to the form:

if (C) then (let $i := SEQ return R) else ()

setAction

public void setAction(Expression action)
Add the "return" or "satisfies" expression, and fix up all references to the range variable that occur within that expression

Parameters: action the expression that occurs after the "return" keyword of a "for" expression, the "satisfies" keyword of "some/every", or the ":=" operator of a "let" expression.

This method must be called after calling setVariableDeclaration()

setSequence

public void setSequence(Expression sequence)
Set the "sequence" expression - the one to which the variable is bound

setSlotNumber

public void setSlotNumber(int nr)
Set the slot number for the range variable

setVariableDeclaration

public void setVariableDeclaration(RangeVariableDeclaration decl)
Set the reference to the variable declaration

simplify

public Expression simplify(StaticContext env)
Simplify the expression

suppressValidation

public void suppressValidation(int validationMode)
Suppress validation on contained element constructors, on the grounds that the parent element is already performing validation. The default implementation does nothing.