|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Objectnet.sf.saxon.expr.Expression
net.sf.saxon.expr.UnaryExpression
net.sf.saxon.expr.LazyExpression
public class LazyExpression
A LazyExpression is an expression that forces lazy evaluation: it must not be evaluated eagerly, because a failure must not be reported unless the value is actually referenced. This is used for an expression that has been moved out of a loop. If the loop iterates zero times, the expression will not be evaluated, and in particular, it will not cause a dynamic error.
Note that the LazyExpression class does not itself implement any kind of delayed evaluation: calling its evaluateItem() and iterate() methods produces an immediate result. Instead, the existence of a LazyExpression on the expression tree acts as a signal to other classes that evaluation should be delayed, typically by holding the result of the iterate() method in a Closure object.
| Field Summary |
|---|
| Fields inherited from class net.sf.saxon.expr.Expression |
|---|
EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD |
| Constructor Summary | |
|---|---|
LazyExpression(Expression operand)
|
|
| Method Summary | |
|---|---|
Item |
evaluateItem(XPathContext context)
Evaluate an expression as a single item. |
SequenceIterator |
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence. |
static Expression |
makeLazyExpression(Expression operand)
|
Expression |
optimize(Optimizer opt,
StaticContext env,
ItemType contextItemType)
Perform optimisation of an expression and its subexpressions. |
void |
process(XPathContext context)
Process the instruction, without returning any tail calls |
Expression |
typeCheck(StaticContext env,
ItemType contextItemType)
The typeCheck method suppresses compile-time evaluation |
| Methods inherited from class net.sf.saxon.expr.UnaryExpression |
|---|
computeCardinality, computeSpecialProperties, display, equals, getBaseExpression, getItemType, hashCode, iterateSubExpressions, promote, replaceSubExpression, simplify |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LazyExpression(Expression operand)
| Method Detail |
|---|
public static Expression makeLazyExpression(Expression operand)
public Expression typeCheck(StaticContext env,
ItemType contextItemType)
throws XPathException
typeCheck in class UnaryExpressionenv - contextItemType -
XPathException
StaticError - if an error is discovered during this phase
(typically a type error)
public Expression optimize(Optimizer opt,
StaticContext env,
ItemType contextItemType)
throws XPathException
optimize in class UnaryExpressionopt - the optimizer in use. This provides access to supporting functions; it also allows
different optimization strategies to be used in different circumstances.env - the static context of the expressioncontextItemType - the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
StaticError - if an error is discovered during this phase
(typically a type error)
XPathException
public Item evaluateItem(XPathContext context)
throws XPathException
evaluateItem in interface EvaluableItemevaluateItem in class Expressioncontext - The context in which the expression is to be evaluated
XPathException - if any dynamic error occurs evaluating the
expression
public SequenceIterator iterate(XPathContext context)
throws XPathException
iterate in interface SequenceIterableiterate in class Expressioncontext - supplies the context for evaluation
XPathException - if any dynamic error occurs evaluating the
expression
public void process(XPathContext context)
throws XPathException
process in class Expressioncontext - The dynamic context, giving access to the current node,
the current variables, etc.
XPathException
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||