Package com.saxonica.ee.stream
Class StreamInstr
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.instruct.Instruction
-
- net.sf.saxon.expr.instruct.SourceDocument
-
- com.saxonica.ee.stream.StreamInstr
-
- All Implemented Interfaces:
Pusher
,ExportAgent
,TailCallReturner
,Locatable
,IdentityComparable
,Traceable
public class StreamInstr extends SourceDocument implements Pusher
Implementation of the xsl:source-document (streamable="yes") instruction
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.instruct.SourceDocument
accumulators, bodyOp, hrefOp, parseOptions
-
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
-
-
Constructor Summary
Constructors Constructor Description StreamInstr(Expression hrefExp, Expression body, ParseOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
checkStreamability(java.util.List<java.lang.String> reasons, boolean enabled, boolean strict)
int
computeDependencies()
Compute the dependencies of an expression, as the union of the dependencies of its subexpressions.protected int
computeSpecialProperties()
Get the static properties of this expression (other than its type).Expression
copy(RebindingMap rebindings)
Copy an expression.Inversion
getAction()
java.lang.String
getExportTag()
SequenceIterator
iterate(XPathContext context)
Return an Iterator to iterate over the values of a sequence.boolean
mayCreateNewNodes()
Determine whether this instruction creates new nodes.Expression
optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.void
prepareForStreaming()
Expression
prepareForStreaming(PackageData pack)
void
push(Outputter output, XPathContext context)
Evaluate the instruction in push mode-
Methods inherited from class net.sf.saxon.expr.instruct.SourceDocument
allowExtractingCommonSubexpressions, export, getBody, getExpressionName, getHref, operands, processLeavingTail, setBody, setHref, setUsedAccumulators, typeCheck
-
Methods inherited from class net.sf.saxon.expr.instruct.Instruction
alwaysCreatesNewNodes, assembleParams, assembleTunnelParams, computeCardinality, dynamicError, evaluateAsString, evaluateItem, getImplementationMethod, getInstructionNameCode, getItemType, getNetCost, getSourceLocator, isInstruction, isXSLT, process, someOperandCreatesNewNodes
-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeHashCode, computeStaticProperties, dynamicError, effectiveBooleanValue, equals, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, toShortString, toString, typeCheckChildren, typeError, unordered, verifyParentPointers
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Constructor Detail
-
StreamInstr
public StreamInstr(Expression hrefExp, Expression body, ParseOptions options)
-
-
Method Detail
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
Perform optimisation of an expression and its subexpressions. This is the third and final phase of static optimization.This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
- Overrides:
optimize
in classSourceDocument
- Parameters:
visitor
- an expression visitorcontextItemType
- 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 toType.ITEM_TYPE
- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
XPathException
- if an error is discovered during this phase (typically a type error)
-
prepareForStreaming
public Expression prepareForStreaming(PackageData pack) throws XPathException
- Throws:
XPathException
-
prepareForStreaming
public void prepareForStreaming() throws XPathException
- Overrides:
prepareForStreaming
in classExpression
- Throws:
XPathException
-
checkStreamability
public Expression checkStreamability(java.util.List<java.lang.String> reasons, boolean enabled, boolean strict) throws XPathException
- Throws:
XPathException
-
mayCreateNewNodes
public boolean mayCreateNewNodes()
Determine whether this instruction creates new nodes. This implementation returns a default value of false- Overrides:
mayCreateNewNodes
in classSourceDocument
- Returns:
- true if the instruction creates new nodes (or if it can't be proved that it doesn't)
-
computeDependencies
public int computeDependencies()
Compute the dependencies of an expression, as the union of the dependencies of its subexpressions. (This is overridden for path expressions and filter expressions, where the dependencies of a subexpression are not all propogated). This method should be called only once, to compute the dependencies; after that, getDependencies should be used.- Overrides:
computeDependencies
in classSourceDocument
- Returns:
- the depencies, as a bit-mask
-
computeSpecialProperties
protected int computeSpecialProperties()
Get the static properties of this expression (other than its type). The result is bit-signficant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.- Overrides:
computeSpecialProperties
in classSourceDocument
- Returns:
- a set of flags indicating static properties of this expression
-
getAction
public Inversion getAction()
-
copy
public Expression copy(RebindingMap rebindings)
Copy an expression. This makes a deep copy.- Overrides:
copy
in classSourceDocument
- Parameters:
rebindings
- variables that need to be re-bound- Returns:
- the copy of the original expression
-
push
public void push(Outputter output, XPathContext context) throws XPathException
Evaluate the instruction in push mode- Specified by:
push
in interfacePusher
- Overrides:
push
in classSourceDocument
- Parameters:
output
- the final destination for the output of the instructioncontext
- the evaluation context- Throws:
XPathException
- in the event of a failureQuitParsingException
- if there was an early exit, that is, if the instruction was evaluated without reading the input to completion
-
iterate
public SequenceIterator iterate(XPathContext context) throws XPathException
Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This implementation uses two threads: the instruction is evaluated in push mode in a child thread (using the process() method), putting its results on a queue, from which this method reads them.- Overrides:
iterate
in classInstruction
- Parameters:
context
- supplies the context for evaluation- Returns:
- a SequenceIterator that can be used to iterate over the result of the expression
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
getExportTag
public java.lang.String getExportTag()
- Overrides:
getExportTag
in classSourceDocument
-
-