public class StreamingAdjunct extends Object
Expression
with methods used at compile-time
to support streaming, by generating a Watch
that allows the expression to be evaluated in push mode.
The default implementation is adequate only for expressions that take single items as their input. For other kinds of expression, either a WatchMaker or FeedMaker, or both, need to be supplied. If the input sequence is atomized (as with the sum() function), then only a FeedMaker is required; a TypedValueWatch will automatically be added to the Streaming Route to perform atomization of the supplied sequence. For expressions that do not perform atomization, both a WatchMaker (for use when the input is striding or consuming) and a FeedMaker (for use when it is climbing or grounded) need to be provided.
Neither method should be called in cases where streamability analysis has decided that the expression is not streamable. In such cases the methods may throw an exception.
There is a fallback implementation that allows any expression to be evaluated as a Feed, but it involves buffering the input in memory, and performing an implicit copy-of() to create a grounded copy, so it is only really suitable for the case where the input is a single atomic value.
Constructor and Description |
---|
StreamingAdjunct() |
Modifier and Type | Method and Description |
---|---|
PostureAndSweep |
computeStreamability(boolean allowExtensions,
ContextItemStaticInfo contextInfo,
List<String> reasons)
Compute the posture and sweep of this expression as defined in the W3C streamability specifications.
|
Configuration |
getConfiguration()
Get the Saxon Configuration
|
protected FeedMaker |
getDefaultFeedMaker(int arg)
Get a FeedMaker which will generate a feed to handle streamed input of operand "arg".
|
Expression |
getExpression()
Get the expression being processed by this StreamingAdjunct
|
FeedMaker |
getFeedMaker(int arg)
Get a FeedMaker, a factory class that creates a Feed to evaluate this expression
in streaming mode.
|
WatchMaker |
getWatchMaker(boolean forGrouping)
Get a WatchMaker, a factory class that creates a Watch to evaluate this expression
in streaming mode.
|
void |
setConfiguration(Configuration config)
Set the Saxon Configuration
|
void |
setExpression(Expression expression)
Set the expression being processed by this StreamingAdjunct
|
Pattern |
toStreamingPattern(Configuration config)
Convert this expression to a streaming pattern (a pattern used internally to match nodes during
push processing of an event stream)
|
public void setConfiguration(Configuration config)
config
- the Configurationpublic Configuration getConfiguration()
public void setExpression(Expression expression)
expression
- the expression being processedpublic Expression getExpression()
public PostureAndSweep computeStreamability(boolean allowExtensions, ContextItemStaticInfo contextInfo, List<String> reasons)
allowExtensions
- if false, the definition of "guaranteed streamability" in the
W3C specification is used. If true, Saxon extensions are permitted, which make somecontextInfo
- Information about the context item type and posturereasons
- the caller may supply a list, in which case the implementation may add to this; the
contents are human-readable messages explaining why the expression is not streamable.public Pattern toStreamingPattern(Configuration config)
config
- the Saxon configurationpublic WatchMaker getWatchMaker(boolean forGrouping) throws XPathException
Expression.WATCH_METHOD
forGrouping
- true if the selected items are being groupedXPathException
- in the event of a failurepublic FeedMaker getFeedMaker(int arg) throws XPathException
arg
- identifies the argument with respect to which the expression is to be inverted:
usually 0 to indicate the first argument is the value that is streamed. Argument numbering
is the same as the sequence of arguments/operands returned by the method Expression.operands()
XPathException
- in the event of a failureprotected FeedMaker getDefaultFeedMaker(int arg) throws XPathException
arg
- identifies which operand of the expression is the streamed (consuming) inputXPathException
- if a dynamic error occursCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.