net.sf.saxon.expr
Class Assignation

java.lang.Object
  extended bynet.sf.saxon.expr.ComputedExpression
      extended bynet.sf.saxon.expr.Assignation
All Implemented Interfaces:
Binding, Expression, Serializable
Direct Known Subclasses:
ForExpression, LetExpression, QuantifiedExpression

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.

See Also:
Serialized Form

Field Summary
protected  Expression action
           
protected  RangeVariableDeclaration declaration
           
protected  Expression sequence
           
protected  int slotNumber
           
protected  String variableName
           
 
Fields inherited from class net.sf.saxon.expr.ComputedExpression
lineNumber, NO_ARGUMENTS, staticProperties
 
Constructor Summary
Assignation()
           
 
Method Summary
 Value evaluateVariable(XPathContext context)
          Get the value of the range variable
 SequenceType getRequiredType()
          Get data type of the range variable (part of the Binding interface)
 Expression[] getSubExpressions()
          Get the immediate subexpressions of this expression
 String getVariableName()
          Get the display name of the range variable, for diagnostics only
 Expression promote(PromotionOffer offer)
          Promote this expression if possible
 void setAction(Expression action)
          Add the "return" or "satisfies" expression, and fix up all references to the range variable that occur within that expression
 void setSequence(Expression sequence)
          Set the "sequence" expression - the one to which the variable is bound
 void setSlotNumber(int nr)
          Set the slot number for the range variable
 void setVariableDeclaration(RangeVariableDeclaration decl)
          Set the reference to the variable declaration
 Expression simplify()
          Simplify the expression
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
computeCardinality, computeDependencies, computeSpecialProperties, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getDependencies, getIntrinsicDependencies, getLineNumber, getSpecialProperties, iterate, markTailFunctionCalls, setLineNumber, typeError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.saxon.expr.Expression
analyze, display, getItemType
 

Field Detail

slotNumber

protected int slotNumber

sequence

protected Expression sequence

action

protected Expression action

variableName

protected String variableName

declaration

protected transient RangeVariableDeclaration declaration
Constructor Detail

Assignation

public Assignation()
Method Detail

setVariableDeclaration

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


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


simplify

public Expression simplify()
                    throws XPathException
Simplify the expression

Specified by:
simplify in interface Expression
Overrides:
simplify in class ComputedExpression
Returns:
the simplified expression
Throws:
XPathException - if an error is discovered during expression rewriting

promote

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

Specified by:
promote in interface Expression
Overrides:
promote in class ComputedExpression
Parameters:
offer - details of the offer, for example the offer to move expressions that don't depend on the context to an outer level in the containing expression
Returns:
if the offer is not accepted, return this expression unchanged. Otherwise return the result of rewriting the expression to promote this subexpression
Throws:
XPathException - if any error is detected

getSubExpressions

public Expression[] getSubExpressions()
Get the immediate subexpressions of this expression

Specified by:
getSubExpressions in interface Expression
Overrides:
getSubExpressions in class ComputedExpression
Returns:
an array containing the sub-expressions of this expression

getRequiredType

public SequenceType getRequiredType()
Get data type of the range variable (part of the Binding interface)

Specified by:
getRequiredType in interface Binding

getVariableName

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

Specified by:
getVariableName in interface Binding

evaluateVariable

public Value evaluateVariable(XPathContext context)
                       throws XPathException
Get the value of the range variable

Specified by:
evaluateVariable in interface Binding
Throws:
XPathException