public class ForExpression extends Assignation
action, declaration, nameCode, sequence, slotNumber, variableNamelocationId, staticPropertiesEVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD| Constructor and Description |
|---|
ForExpression() |
| Modifier and Type | Method and Description |
|---|---|
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 |
convertWhereToPredicate(Optimizer opt,
StaticContext env,
ItemType contextItemType)
Convert where clause, if possible, to a predicate.
|
void |
display(int level,
java.io.PrintStream out,
Configuration config)
Diagnostic print of expression structure
|
protected Binding[] |
extendBindingList(Binding[] in)
Extend an array of variable bindings to include the binding(s) defined in this expression
|
protected 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
|
int |
getPositionVariableNameCode() |
int |
getRequiredSlots()
Get the number of slots required.
|
SequenceIterator |
iterate(XPathContext context)
Iterate over the sequence of values
|
boolean |
markTailFunctionCalls(int nameCode,
int arity)
Mark tail function calls: only possible if the for expression iterates zero or one times.
|
Expression |
optimize(Optimizer opt,
StaticContext env,
ItemType contextItemType)
Optimize the expression
|
void |
process(XPathContext context)
Process this expression as an instruction, writing results to the current
outputter
|
void |
setAction(Expression action)
Add the "return" or "satisfies" expression, and fix up all references to the
range variable that occur within that expression
|
void |
setPositionVariable(RangeVariableDeclaration decl)
Set the reference to the position variable (XQuery only)
|
void |
setSlotNumber(int nr)
Set the slot number for the range variable
|
Expression |
typeCheck(StaticContext env,
ItemType contextItemType)
Type-check the expression
|
evaluateVariable, getAction, getLocalSlotNumber, getSequence, getVariableDeclaration, getVariableFingerprint, getVariableName, getVariableNameCode, isAssignable, isGlobal, iterateSubExpressions, promote, promoteWhereClause, replaceSubExpression, setSequence, setVariableDeclaration, simplify, suppressValidationadoptChildExpression, computeDependencies, computeSpecialProperties, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, getCardinality, getColumnNumber, getDependencies, getExecutable, getHostLanguage, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, typeErrorpublic void setPositionVariable(RangeVariableDeclaration decl)
public int getPositionVariableNameCode()
public void setAction(Expression action)
AssignationsetAction in class Assignationaction - the expression that occurs after the "return" keyword of a "for"
expression, the "satisfies" keyword of "some/every", or the ":=" operator of
a "let" expression.
This method must be called after calling setVariableDeclaration()
public void setSlotNumber(int nr)
setSlotNumber in class Assignationpublic int getRequiredSlots()
getRequiredSlots in class Assignationpublic Expression typeCheck(StaticContext env, ItemType contextItemType) throws XPathException
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_TYPEStaticError - if an error is discovered during this phase
(typically a type error)XPathExceptionpublic Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType) throws XPathException
opt - 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_TYPEStaticError - if an error is discovered during this phase
(typically a type error)XPathExceptionpublic Expression convertWhereToPredicate(Optimizer opt, StaticContext env, ItemType contextItemType) throws XPathException
XPathExceptionpublic boolean markTailFunctionCalls(int nameCode,
int arity)
markTailFunctionCalls in class ComputedExpressionprotected Binding[] extendBindingList(Binding[] in)
extendBindingList in class Assignationpublic int getImplementationMethod()
getImplementationMethod in interface ExpressiongetImplementationMethod in class ComputedExpressionpublic void checkPermittedContents(SchemaType parentType, StaticContext env, boolean whole) throws XPathException
checkPermittedContents in interface ExpressioncheckPermittedContents in class ComputedExpressionparentType - The schema typeenv - the static contextwhole - true if this expression is expected to make the whole content of the type, false
if it is expected to make up only a partXPathException - if the expression doesn't match the required content typepublic SequenceIterator iterate(XPathContext context) throws XPathException
iterate in interface Expressioniterate in class ComputedExpressioncontext - supplies the context for evaluationXPathException - if any dynamic error occurs evaluating the
expressionpublic void process(XPathContext context) throws XPathException
process in interface Expressionprocess in class ComputedExpressioncontext - The dynamic context, giving access to the current node,
the current variables, etc.XPathExceptionpublic ItemType getItemType(TypeHierarchy th)
th - public int computeCardinality()
computeCardinality in class ComputedExpressionpublic void display(int level,
java.io.PrintStream out,
Configuration config)
level - indentation level for this expressionout - Output destinationprotected int getConstructType()
getConstructType in class ComputedExpressionLocation