net.sf.saxon.expr
public class VariableReference extends Expression implements BindingReference
Field Summary | |
---|---|
protected Binding | binding |
protected Value | constantValue |
String | displayName |
protected SequenceType | staticType |
Constructor Summary | |
---|---|
VariableReference()
Create a Variable Reference | |
VariableReference(Binding binding)
Create a Variable Reference |
Method Summary | |
---|---|
PathMap.PathMapNodeSet | addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Add a representation of this expression to a PathMap. |
int | computeCardinality()
Get the static cardinality |
int | computeSpecialProperties()
Determine the special properties of this expression
|
Expression | copy()
Create a clone copy of this VariableReference |
boolean | equals(Object other)
Test if this expression is the same as another expression.
|
Item | evaluateItem(XPathContext c) |
ValueRepresentation | evaluateVariable(XPathContext c)
Evaluate this variable |
void | explain(ExpressionPresenter destination)
Diagnostic print of expression structure. |
void | fixup(Binding binding)
Fix up this variable reference to a Binding object, which enables the value of the variable
to be located at run-time. |
Binding | getBinding()
Get the object bound to the variable |
String | getDisplayName()
Get the display name of the variable. |
int | getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
int | getIntrinsicDependencies() |
ItemType | getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible
|
int | hashCode()
get HashCode for comparing two expressions |
boolean | isFiltered()
Determine whether this variable reference is filtered |
boolean | isFlattened()
Test whether this variable reference is flattened - that is, whether it is atomized etc |
boolean | isInLoop()
Determine whether this variable reference appears in a loop relative to its declaration.
|
SequenceIterator | iterate(XPathContext c)
Get the value of this variable in a given context.
|
Expression | optimize(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression. |
void | process(XPathContext c) |
Expression | promote(PromotionOffer offer, Expression parent)
Promote this expression if possible |
void | refineVariableType(ItemType type, int cardinality, Value constantValue, int properties, ExpressionVisitor visitor)
Provide additional information about the type of the variable, typically derived by analyzing
the initializer of the variable binding |
void | setFiltered(boolean filtered)
Mark an expression as filtered: that is, it appears as the base expression in a filter expression.
|
void | setFlattened(boolean flattened)
Mark an expression as being "flattened". |
void | setStaticType(SequenceType type, Value value, int properties)
Set static type. |
String | toString()
The toString() method for an expression attempts to give a representation of the expression
in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath.
|
Expression | typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression. |
Parameters: binding the variable binding to which this variable refers
The default implementation of this method assumes that an expression does no navigation other than the navigation done by evaluating its subexpressions, and that the subexpressions are evaluated in the same context as the containing expression. The method must be overridden for any expression where these assumptions do not hold. For example, implementations exist for AxisExpression, ParentExpression, and RootExpression (because they perform navigation), and for the doc(), document(), and collection() functions because they create a new navigation root. Implementations also exist for PathExpression and FilterExpression because they have subexpressions that are evaluated in a different context from the calling expression.
Parameters: pathMap the PathMap to which the expression should be added pathMapNodeSet the PathMapNodeSet to which the paths embodied in this expression should be added
Returns: the pathMapNodeSet representing the points in the source document that are both reachable by this expression, and that represent possible results of this expression. For an expression that does navigation, it represents the end of the arc in the path map that describes the navigation route. For other expressions, it is the same as the input pathMapNode.
Returns: NON_CREATIVE (unless the variable is assignable using saxon:assign)
Returns: the cloned copy
Parameters: c the XPath dynamic context
Returns: the value of the variable
Throws: XPathException if any error occurs
Returns: the Binding which declares this variable and associates it with a value
Returns: the display name (a lexical QName
Parameters: th the type hierarchy cache
Returns: the type of the variable, if this can be determined statically; otherwise Type.ITEM (meaning not known in advance)
Returns: true if the value of the variable is filtered by a predicate
Returns: true if the value of the variable is atomized, or converted to a string or number
Returns: true if this variable reference occurs in a loop, where the variable declaration is outside the loop
Parameters: c the XPathContext which contains the relevant variable bindings
Returns: the value of the variable, if it is defined
Throws: XPathException if the variable is undefined
Parameters: type the item type of the variable cardinality the cardinality of the variable constantValue the actual value of the variable, if this is known statically, otherwise null properties additional static properties of the variable's initializer visitor an ExpressionVisitor
Parameters: type the static type of the variable value the value of the variable if this is a compile-time constant properties static properties of the expression to which the variable is bound