org.exist.xquery
Class ForExpr

java.lang.Object
  extended by org.exist.xquery.AbstractExpression
      extended by org.exist.xquery.BindingExpression
          extended by org.exist.xquery.ForExpr
All Implemented Interfaces:
Expression

public class ForExpr
extends BindingExpression

Represents an XQuery "for" expression.

Author:
Wolfgang Meier

Field Summary
 
Fields inherited from interface org.exist.xquery.Expression
DOT_TEST, EXPRESSION_ID_INVALID, IGNORE_CONTEXT, IN_NODE_CONSTRUCTOR, IN_PREDICATE, IN_UPDATE, IN_WHERE_CLAUSE, NEED_INDEX_INFO, NO_CONTEXT_ID, SINGLE_STEP_EXECUTION, USE_TREE_TRAVERSAL
 
Constructor Summary
ForExpr(XQueryContext context)
           
 
Method Summary
 void accept(ExpressionVisitor visitor)
          Start traversing the expression tree using the specified ExpressionVisitor.
 void analyze(AnalyzeContextInfo contextInfo, OrderSpec[] orderBy)
           
 void analyze(AnalyzeContextInfo contextInfo, OrderSpec[] orderBy, GroupSpec[] groupBy)
           
 void dump(ExpressionDumper dumper)
          Write a diagnostic dump of the expression to the passed ExpressionDumper.
 Sequence eval(Sequence contextSequence, Item contextItem, Sequence resultSequence, GroupedValueSequenceTable groupedSequence)
          This implementation tries to process the "where" clause in advance, i.e.
 void resetState(boolean postOptimization)
          Called to inform an expression that it should reset to its initial state.
 int returnsType()
          The static return type of the expression.
 void setPositionalVariable(String var)
          A "for" expression may have an optional positional variable whose QName can be set via this method.
 String toString()
           
 
Methods inherited from class org.exist.xquery.BindingExpression
analyze, eval, getDependencies, getInputSequence, getReturnExpression, getVariable, getWhereExpression, preselect, setGroupReturnExpr, setGroupSpecs, setGroupVariable, setInputSequence, setOrderSpecs, setReturnExpression, setSequenceType, setToGroupVariable, setVariable, setWhereExpression
 
Methods inherited from class org.exist.xquery.AbstractExpression
eval, getASTNode, getCardinality, getContextDocSet, getContextId, getExpressionId, setASTNode, setContextDocSet, setPrimaryAxis
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ForExpr

public ForExpr(XQueryContext context)
Method Detail

setPositionalVariable

public void setPositionalVariable(String var)
A "for" expression may have an optional positional variable whose QName can be set via this method.

Parameters:
var -

analyze

public void analyze(AnalyzeContextInfo contextInfo,
                    OrderSpec[] orderBy)
             throws XPathException
Throws:
XPathException

analyze

public void analyze(AnalyzeContextInfo contextInfo,
                    OrderSpec[] orderBy,
                    GroupSpec[] groupBy)
             throws XPathException
Specified by:
analyze in class BindingExpression
Throws:
XPathException

eval

public Sequence eval(Sequence contextSequence,
                     Item contextItem,
                     Sequence resultSequence,
                     GroupedValueSequenceTable groupedSequence)
              throws XPathException
This implementation tries to process the "where" clause in advance, i.e. in one single step. This is possible if the input sequence is a node set and the where expression has no dependencies on other variables than those declared in this "for" statement.

Specified by:
eval in class BindingExpression
Throws:
XPathException
See Also:
Expression.eval(Sequence, Item)

returnsType

public int returnsType()
Description copied from interface: Expression
The static return type of the expression. This method should return one of the type constants defined in class Type. If the return type cannot be determined statically, return Type.ITEM.

Specified by:
returnsType in interface Expression
Specified by:
returnsType in class AbstractExpression

dump

public void dump(ExpressionDumper dumper)
Description copied from interface: Expression
Write a diagnostic dump of the expression to the passed ExpressionDumper.

Parameters:
dumper - the expression dumper to write to

toString

public String toString()
Overrides:
toString in class Object

resetState

public void resetState(boolean postOptimization)
Description copied from interface: Expression
Called to inform an expression that it should reset to its initial state. All cached data in the expression object should be dropped. For example, the xmldb:document() function calls this method whenever the input document set has changed.

Specified by:
resetState in interface Expression
Overrides:
resetState in class BindingExpression

accept

public void accept(ExpressionVisitor visitor)
Description copied from interface: Expression
Start traversing the expression tree using the specified ExpressionVisitor.

Specified by:
accept in interface Expression
Overrides:
accept in class AbstractExpression


Copyright (C) Wolfgang Meier. All rights reserved.