net.sf.saxon.expr

Class TailCallLoop

public final class TailCallLoop extends UnaryExpression

A TailCallLoop wraps the body of a function that contains tail-recursive function calls. On completion of the "real" body of the function it tests whether the function has executed a tail call, and if so, iterates to evaluate the tail call.
Field Summary
UserFunctioncontainingFunction
Constructor Summary
TailCallLoop(UserFunction function)
Constructor - create a TailCallLoop
Method Summary
Expressioncopy()
Copy an expression.
protected StringdisplayExpressionName()
Give a string representation of the expression name for use in diagnostics
ItemevaluateItem(XPathContext context)
Evaluate as an Item.
UserFunctiongetContainingFunction()
Get the containing function
intgetImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression
SequenceIteratoriterate(XPathContext context)
Iterate over the sequence of values
voidprocess(XPathContext context)
Process the function body
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression

Field Detail

containingFunction

UserFunction containingFunction

Constructor Detail

TailCallLoop

public TailCallLoop(UserFunction function)
Constructor - create a TailCallLoop

Parameters: function the function in which this tail call loop appears

Method Detail

copy

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

Returns: the copy of the original expression

displayExpressionName

protected String displayExpressionName()
Give a string representation of the expression name for use in diagnostics

Returns: the expression name, as a string

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate as an Item.

getContainingFunction

public UserFunction getContainingFunction()
Get the containing function

Returns: the containing function

getImplementationMethod

public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided. This implementation provides both iterate() and process() methods natively.

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression

Parameters: th The type hierarchy cache

iterate

public SequenceIterator iterate(XPathContext context)
Iterate over the sequence of values

process

public void process(XPathContext context)
Process the function body

Parameters: context The dynamic context, giving access to the current node, the current variables, etc.

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)
Type-check the expression