net.sf.saxon.expr
Interface Binding

All Known Implementing Classes:
Assignation, EagerLetExpression, ForExpression, GeneralVariable, GlobalParam, GlobalVariable, JAXPVariable, LetExpression, LocalParam, LocalVariable, LocalVariableBinding, OuterForExpression, PositionVariable, QuantifiedExpression, UserFunctionParameter, WithParam, XPath30Parser.TemporaryXSLTVariableBinding, XPathVariable

public interface Binding

Binding is a interface used to represent the run-time properties and methods associated with a variable: specifically, a method to get the value of the variable.


Method Summary
 void addReference(boolean isLoopingReference)
          Register a variable reference that refers to the variable bound in this expression
 ValueRepresentation<? extends Item> evaluateVariable(XPathContext context)
          Evaluate the variable
 IntegerValue[] getIntegerBoundsForVariable()
          If the variable is bound to an integer, get the minimum and maximum possible values.
 int getLocalSlotNumber()
          If this is a local variable held on the local stack frame, return the corresponding slot number.
 SequenceType getRequiredType()
          Get the declared type of the variable
 StructuredQName getVariableQName()
          Get the name 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.
 

Method Detail

getRequiredType

SequenceType getRequiredType()
Get the declared type of the variable

Returns:
the declared type

getIntegerBoundsForVariable

IntegerValue[] getIntegerBoundsForVariable()
If the variable is bound to an integer, get the minimum and maximum possible values. Return null if unknown or not applicable

Returns:
a pair of integers containing the minimum and maximum values for the integer value; or null if the value is not an integer or the range is unknown

evaluateVariable

ValueRepresentation<? extends Item> evaluateVariable(XPathContext context)
                                                     throws XPathException
Evaluate the variable

Parameters:
context - the XPath dynamic evaluation context
Returns:
the result of evaluating the variable
Throws:
XPathException - if an error occurs while evaluating the variable

isGlobal

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.

Returns:
true if the binding is global

isAssignable

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.

Returns:
true if the binding is assignable

getLocalSlotNumber

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

Returns:
the slot number on the local stack frame

getVariableQName

StructuredQName getVariableQName()
Get the name of the variable

Returns:
the name of the variable, as a structured QName

addReference

void addReference(boolean isLoopingReference)
Register a variable reference that refers to the variable bound in this expression

Parameters:
isLoopingReference - - true if the reference occurs within a loop, such as the predicate of a filter expression


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.