net.sf.saxon.expr.flwor
Class Clause

java.lang.Object
  extended by net.sf.saxon.expr.flwor.Clause
Direct Known Subclasses:
CountClause, ForClause, GroupByClause, LetClause, OrderByClause, WhereClause, WindowClause

public abstract class Clause
extends Object

A "Clause" refers specifically to one of the clauses of a FLWOR expression, for example the "for" clause, the "let" clause, the "where" or "order by" clause. (The "return" clause, however, is not modelled as a Clause).


Field Summary
static int COUNT
           
static int FOR
           
static int GROUPBYCLAUSE
           
static int LET
           
static int ORDERBYCLAUSE
           
static int WHERE
           
static int WINDOW
           
 
Constructor Summary
Clause()
           
 
Method Summary
abstract  Clause copy()
           
abstract  void explain(ExpressionPresenter out)
          Diagnostic print of expression structure.
 void gatherVariableReferences(ExpressionVisitor visitor, Binding binding, List<VariableReference> refs)
          Build a list of all references to a variables declared in this clause
abstract  int getClauseKey()
          Get a keyword identifying what kind of clause this is
abstract  TuplePull getPullStream(TuplePull base, XPathContext context)
          Get a pull-mode tuple stream that implements the functionality of this clause, taking its input from another tuple stream which this clause modifies
abstract  TuplePush getPushStream(TuplePush destination, XPathContext context)
          Get a push-mode tuple stream that implements the functionality of this clause, supplying its output to another tuple stream
 LocalVariableBinding[] getRangeVariables()
          Get the variables bound by this clause
 void optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)
          Optimize any expressions contained within this clause
abstract  void processSubExpressions(ExpressionProcessor processor)
          Process the subexpressions of this clause
 void refineVariableType(ExpressionVisitor visitor, List<VariableReference> references, Expression returnExpr)
          Supply improved type information to the expressions that contain references to the variables declared in this clause
 void typeCheck(ExpressionVisitor visitor)
          Type-check any expression contained within this clause
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOR

public static final int FOR
See Also:
Constant Field Values

LET

public static final int LET
See Also:
Constant Field Values

WINDOW

public static final int WINDOW
See Also:
Constant Field Values

GROUPBYCLAUSE

public static final int GROUPBYCLAUSE
See Also:
Constant Field Values

COUNT

public static final int COUNT
See Also:
Constant Field Values

ORDERBYCLAUSE

public static final int ORDERBYCLAUSE
See Also:
Constant Field Values

WHERE

public static final int WHERE
See Also:
Constant Field Values
Constructor Detail

Clause

public Clause()
Method Detail

copy

public abstract Clause copy()

optimize

public void optimize(ExpressionVisitor visitor,
                     ExpressionVisitor.ContextItemType contextItemType)
              throws XPathException
Optimize any expressions contained within this clause

Parameters:
visitor - the ExpressionVisitor, providing access to static context information
contextItemType - the type of the context item
Throws:
XPathException - if any error is detected

typeCheck

public void typeCheck(ExpressionVisitor visitor)
               throws XPathException
Type-check any expression contained within this clause

Parameters:
visitor - the ExpressionVisitor, providing access to static context information
Throws:
XPathException - if any error is detected

getPullStream

public abstract TuplePull getPullStream(TuplePull base,
                                        XPathContext context)
Get a pull-mode tuple stream that implements the functionality of this clause, taking its input from another tuple stream which this clause modifies

Parameters:
base - the input tuple stream
context - the dynamic evaluation context
Returns:
the output tuple stream

getPushStream

public abstract TuplePush getPushStream(TuplePush destination,
                                        XPathContext context)
Get a push-mode tuple stream that implements the functionality of this clause, supplying its output to another tuple stream

Parameters:
destination - the output tuple stream
context - the dynamic evaluation context
Returns:
the push tuple stream that implements the functionality of this clause of the FLWOR expression

processSubExpressions

public abstract void processSubExpressions(ExpressionProcessor processor)
                                    throws XPathException
Process the subexpressions of this clause

Parameters:
processor - the expression processor used to process the subexpressions
Throws:
XPathException - if any error is detected

explain

public abstract void explain(ExpressionPresenter out)
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.

Parameters:
out - the expression presenter used to display the structure

getRangeVariables

public LocalVariableBinding[] getRangeVariables()
Get the variables bound by this clause

Returns:
the variable bindings

gatherVariableReferences

public void gatherVariableReferences(ExpressionVisitor visitor,
                                     Binding binding,
                                     List<VariableReference> refs)
Build a list of all references to a variables declared in this clause

Parameters:
visitor - the expression visitor
binding - a variable declared in this clause
refs - the list of variable references, initially empty, to which the method will append

refineVariableType

public void refineVariableType(ExpressionVisitor visitor,
                               List<VariableReference> references,
                               Expression returnExpr)
Supply improved type information to the expressions that contain references to the variables declared in this clause

Parameters:
visitor - the expression visitor
references - the list of variable references
returnExpr - the expression in the return clause

getClauseKey

public abstract int getClauseKey()
Get a keyword identifying what kind of clause this is

Returns:
the kind of clause


Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.