Package net.sf.saxon.expr.flwor
Class Clause
- java.lang.Object
-
- net.sf.saxon.expr.flwor.Clause
-
- Direct Known Subclasses:
CountClause
,ForClause
,GroupByClause
,LetClause
,OrderByClause
,TraceClause
,WhereClause
,WindowClause
public abstract class Clause extends java.lang.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).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Clause.ClauseName
-
Constructor Summary
Constructors Constructor Description Clause()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Collect information about the navigation paths followed by this clause, for document projection purposesboolean
containsNonInlineableVariableReference(Binding binding)
Determine whether the clause contains a reference to a local variable binding that cannot be inlinedabstract Clause
copy(FLWORExpression flwor, RebindingMap rebindings)
Create a copy of this clauseabstract void
explain(ExpressionPresenter out)
Diagnostic print of expression structure.void
gatherVariableReferences(ExpressionVisitor visitor, Binding binding, java.util.List<VariableReference> refs)
Build a list of all references to a variables declared in this clauseabstract Clause.ClauseName
getClauseKey()
Get a keyword identifying what kind of clause this isConfiguration
getConfiguration()
Location
getLocation()
Get the location, which can be used to determine the system ID and line number of the clausePackageData
getPackageData()
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 modifiesabstract TuplePush
getPushStream(TuplePush destination, Outputter output, XPathContext context)
Get a push-mode tuple stream that implements the functionality of this clause, supplying its output to another tuple streamLocalVariableBinding[]
getRangeVariables()
Get the variables bound by this clausejava.util.Map<java.lang.String,java.lang.Object>
getTraceInfo()
Get information for inclusion in trace outputboolean
isRepeated()
void
optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)
Optimize any expressions contained within this clauseabstract void
processOperands(OperandProcessor processor)
Process the subexpressions of this clausevoid
refineVariableType(ExpressionVisitor visitor, java.util.List<VariableReference> references, Expression returnExpr)
Supply improved type information to the expressions that contain references to the variables declared in this clausevoid
setLocation(Location locationId)
Set the location, which can be used to determine the system ID and line number of the clausevoid
setPackageData(PackageData pd)
void
setRepeated(boolean repeated)
java.lang.String
toShortString()
Get a short string representation of the clausevoid
typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)
Type-check any expression contained within this clause
-
-
-
Method Detail
-
getLocation
public Location getLocation()
Get the location, which can be used to determine the system ID and line number of the clause- Returns:
- the location
-
setLocation
public void setLocation(Location locationId)
Set the location, which can be used to determine the system ID and line number of the clause- Parameters:
locationId
- the location
-
setPackageData
public void setPackageData(PackageData pd)
-
getPackageData
public PackageData getPackageData()
-
getConfiguration
public Configuration getConfiguration()
-
setRepeated
public void setRepeated(boolean repeated)
-
isRepeated
public boolean isRepeated()
-
copy
public abstract Clause copy(FLWORExpression flwor, RebindingMap rebindings)
Create a copy of this clause- Parameters:
flwor
- the new FLWORExpression to contain the copied clauserebindings
-- Returns:
- the copied clause
-
optimize
public void optimize(ExpressionVisitor visitor, ContextItemStaticInfo 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
public void typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Type-check any expression contained within this clause- Parameters:
visitor
- the ExpressionVisitor, providing access to static context informationcontextInfo
- static information about the dynamic context- 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 streamcontext
- the dynamic evaluation context- Returns:
- the output tuple stream
-
getPushStream
public abstract TuplePush getPushStream(TuplePush destination, Outputter output, 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 streamoutput
- the destination for the resultcontext
- the dynamic evaluation context- Returns:
- the push tuple stream that implements the functionality of this clause of the FLWOR expression
-
processOperands
public abstract void processOperands(OperandProcessor 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) throws XPathException
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- Throws:
XPathException
-
getRangeVariables
public LocalVariableBinding[] getRangeVariables()
Get the variables bound by this clause- Returns:
- the variable bindings
-
gatherVariableReferences
public void gatherVariableReferences(ExpressionVisitor visitor, Binding binding, java.util.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
public boolean containsNonInlineableVariableReference(Binding binding)
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, java.util.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
-
addToPathMap
public abstract void addToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodeSet)
Collect information about the navigation paths followed by this clause, for document projection purposes- Parameters:
pathMap
- the path map in which the data is to be collectedpathMapNodeSet
- the path map node set representing the paths to the context item
-
getClauseKey
public abstract Clause.ClauseName getClauseKey()
Get a keyword identifying what kind of clause this is- Returns:
- the kind of clause
-
toShortString
public java.lang.String toShortString()
Get a short string representation of the clause- Returns:
- a recognizable string
-
getTraceInfo
public java.util.Map<java.lang.String,java.lang.Object> getTraceInfo()
Get information for inclusion in trace output- Returns:
- a map containing the properties to be output
-
-