net.sf.saxon.expr

Class SuppliedParameterReference

public class SuppliedParameterReference extends Expression

Supplied parameter reference: this is an internal expression used to refer to the value of the n'th parameter supplied on a template call (apply-templates). It is used within a type-checking expression designed to check the consistency of the supplied value with the required type. This type checking is all done at run-time, because the binding of apply-templates to actual template rules is entirely dynamic.
Field Summary
intslotNumber
SequenceTypetype
Constructor Summary
SuppliedParameterReference(int slot)
Constructor
Method Summary
intcomputeCardinality()
Get the static cardinality
Expressioncopy()
Copy an expression.
ItemevaluateItem(XPathContext context)
Evaluate an expression as a single item.
ValueRepresentationevaluateVariable(XPathContext c)
Get the value of this expression in a given context.
voidexplain(ExpressionPresenter destination)
Diagnostic print of expression structure.
intgetIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression, if possible.
SequenceIteratoriterate(XPathContext c)
Get the value of this expression in a given context.
Expressionoptimize(ExpressionVisitor visitor, ItemType contextItemType)
voidsetSuppliedType(SequenceType type)
Set the type of the supplied value if known
StringtoString()
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.
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)

Field Detail

slotNumber

int slotNumber

type

SequenceType type

Constructor Detail

SuppliedParameterReference

public SuppliedParameterReference(int slot)
Constructor

Parameters: slot identifies this parameter

Method Detail

computeCardinality

public int computeCardinality()
Get the static cardinality

Returns: ZERO_OR_MORE, unless we know the type of the supplied value in advance.

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate an expression as a single item. This always returns either a single Item or null (denoting the empty sequence). No conversion is done. This method should not be used unless the static type of the expression is a subtype of "item" or "item?": that is, it should not be called if the expression may return a sequence. There is no guarantee that this condition will be detected.

Parameters: context The context in which the expression is to be evaluated

Returns: the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence

Throws: net.sf.saxon.trans.XPathException if any dynamic error occurs evaluating the expression

evaluateVariable

public ValueRepresentation evaluateVariable(XPathContext c)
Get the value of this expression in a given context.

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

explain

public void explain(ExpressionPresenter destination)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

getIntrinsicDependencies

public int getIntrinsicDependencies()
Determine the intrinsic dependencies of an expression, that is, those which are not derived from the dependencies of its subexpressions. For example, position() has an intrinsic dependency on the context position, while (position()+1) does not. The default implementation of the method returns 0, indicating "no dependencies".

Returns: a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression, if possible.

Parameters: th the type hierarchy cache

Returns: Type.ITEM, because we don't know the type of the supplied value in advance.

iterate

public SequenceIterator iterate(XPathContext c)
Get the value of this expression in a given context.

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

optimize

public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType)

setSuppliedType

public void setSuppliedType(SequenceType type)
Set the type of the supplied value if known

Parameters: type of the supplied value

toString

public 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. In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax

Returns: a representation of the expression as a string

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)