Package net.sf.saxon.expr.flwor
Class Clause
java.lang.Object
net.sf.saxon.expr.flwor.Clause
- Direct Known Subclasses:
ForClause
,LetClause
,OrderByClause
,TraceClause
,WhereClause
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
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine whether the clause contains a reference to a local variable binding that cannot be inlinedabstract Clause
copy()
Create a copy of this clauseabstract void
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 clauseabstract int
Get a keyword identifying what kind of clause this isint
Get the location ID, which can be used in conjunction with a LocationProvider to determine the system ID and line number of the clauseabstract 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 modifiesabstract 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 streamGet the variables bound by this clausevoid
optimize
(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType) Optimize any expressions contained within this clauseabstract void
processSubExpressions
(ExpressionProcessor processor) Process the subexpressions of this clausevoid
refineVariableType
(ExpressionVisitor visitor, List<VariableReference> references, Expression returnExpr) Supply improved type information to the expressions that contain references to the variables declared in this clausevoid
setLocationId
(int locationId) Set the location ID, which can be used in conjunction with a LocationProvider to determine the system ID and line number of the clausevoid
typeCheck
(ExpressionVisitor visitor) Type-check any expression contained within this clause
-
Field Details
-
FOR
public static final int FOR- See Also:
-
LET
public static final int LET- See Also:
-
WINDOW
public static final int WINDOW- See Also:
-
GROUPBYCLAUSE
public static final int GROUPBYCLAUSE- See Also:
-
COUNT
public static final int COUNT- See Also:
-
ORDERBYCLAUSE
public static final int ORDERBYCLAUSE- See Also:
-
WHERE
public static final int WHERE- See Also:
-
TRACE
public static final int TRACE- See Also:
-
-
Constructor Details
-
Clause
public Clause()
-
-
Method Details
-
getLocationId
public int getLocationId()Get the location ID, which can be used in conjunction with a LocationProvider to determine the system ID and line number of the clause- Returns:
- the location ID
-
setLocationId
public void setLocationId(int locationId) Set the location ID, which can be used in conjunction with a LocationProvider to determine the system ID and line number of the clause- Parameters:
locationId
- the location ID
-
copy
Create a copy of this clause- Returns:
- the copied clause
-
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 informationcontextItemType
- the type of the context item- Throws:
XPathException
- if any error is detected
-
typeCheck
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
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 streamcontext
- the dynamic evaluation context- Returns:
- the output tuple stream
-
getPushStream
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 streamcontext
- the dynamic evaluation context- Returns:
- the push tuple stream that implements the functionality of this clause of the FLWOR expression
-
processSubExpressions
Process the subexpressions of this clause- Parameters:
processor
- the expression processor used to process the subexpressions- Throws:
XPathException
- if any error is detected
-
explain
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
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 visitorbinding
- a variable declared in this clauserefs
- the list of variable references, initially empty, to which the method will append
-
containsNonInlineableVariableReference
Determine whether the clause contains a reference to a local variable binding that cannot be inlined- Parameters:
binding
- the binding for the local variable in question- Returns:
- true if this clause uses the variable in a way that does not permit inlining
-
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 visitorreferences
- the list of variable referencesreturnExpr
- 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
-