net.sf.saxon.expr
public class ForExpression extends Assignation
Nested Class Summary | |
---|---|
protected static class | ForExpression.EventMappingAction
The EventMappingAction represents the action to be taken for each item in the
source sequence. |
protected static class | ForExpression.MappingAction
The MappingAction represents the action to be taken for each item in the
source sequence. |
Field Summary | |
---|---|
protected PositionVariable | positionVariable |
Constructor Summary | |
---|---|
ForExpression()
Create a "for" expression (for $x at $p in SEQUENCE return ACTION) |
Method Summary | |
---|---|
void | checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole)
Check that any elements and attributes constructed or returned by this expression are acceptable
in the content model of a given complex type. |
int | computeCardinality()
Determine the static cardinality of the expression |
Expression | copy()
Copy an expression. |
void | evaluatePendingUpdates(XPathContext context, PendingUpdateList pul)
Evaluate an updating expression, adding the results to a Pending Update List.
|
void | explain(ExpressionPresenter out)
Diagnostic print of expression structure. |
protected void | explainSpecializedAttributes(ExpressionPresenter out) |
protected Binding[] | extendBindingList(Binding[] in)
Extend an array of variable bindings to include the binding(s) defined in this expression |
int | getConstructType()
Get the type of this expression for use in tracing and diagnostics |
int | getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
ItemType | getItemType(TypeHierarchy th)
Determine the data type of the items returned by the expression, if possible |
StructuredQName | getPositionVariableName()
Get the name of the position variable |
protected int | getRangeVariableCardinality()
Get the cardinality of the range variable |
int | getRequiredSlots()
Get the number of slots required. |
boolean | hasLoopingSubexpression(Expression child)
Given an expression that is an immediate child of this expression, test whether
the evaluation of the parent expression causes the child expression to be
evaluated repeatedly |
boolean | isVacuousExpression()
Determine whether this is a vacuous expression as defined in the XQuery update specification |
SequenceIterator | iterate(XPathContext context)
Iterate over the sequence of values |
EventIterator | iterateEvents(XPathContext context)
Deliver the result of the expression as a sequence of events. |
int | markTailFunctionCalls(StructuredQName qName, int arity)
Mark tail function calls: only possible if the for expression iterates zero or one times.
|
Expression | optimize(ExpressionVisitor visitor, ItemType contextItemType)
Optimize the expression |
void | process(XPathContext context)
Process this expression as an instruction, writing results to the current
outputter |
void | setPositionVariable(PositionVariable decl)
Set the reference to the position variable (XQuery only) |
void | setSlotNumber(int nr)
Set the slot number for the range variable |
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 |
Returns: the copy of the original expression
Parameters: context the XPath dynamic evaluation context pul the pending update list to which the results should be written
Returns: the type of expression, as enumerated in class Location
Parameters: th the type hierarchy cache
Returns: one of the values Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known in advance)
Returns: the name of the position variable ("at $p") if there is one, or null if not
Returns: the cardinality of the range variable (StaticProperty.EXACTLY_ONE). Can be overridden in a subclass
Returns: normally 1, except for a FOR expression with an AT clause, where it is 2.
Parameters: child the immediate subexpression
Returns: true if the child expression is evaluated repeatedly
Returns: true if this expression is vacuous
Parameters: context The dynamic evaluation context
Returns: the result of the expression as an iterator over a sequence of PullEvent objects
Throws: XPathException if a dynamic error occurs during expression evaluation
Parameters: decl the range variable declaration for the position variable
Parameters: nr the slot number allocated to the range variable on the local stack frame. This implicitly allocates the next slot number to the position variable if there is one.
Returns: a representation of the expression as a string