Package com.saxonica.ee.optim
Class MultithreadedForEach
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.expr.instruct.Instruction
-
- net.sf.saxon.expr.instruct.ForEach
-
- com.saxonica.ee.optim.MultithreadedForEach
-
- All Implemented Interfaces:
ContextMappingFunction,ContextOriginator,ContextSwitchingExpression,ExportAgent,TailCallReturner,Locatable,IdentityComparable,Traceable
public class MultithreadedForEach extends ForEach
This instruction represents an xsl:for-each instruction using more than one thread
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.instruct.ForEach
actionOp, containsTailCall, isInstruction, selectOp, separatorOp, threadsOp
-
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 MultithreadedForEach(Expression select, Expression action, boolean containsTailCall, Expression threads)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expressioncopy(RebindingMap rebindings)Copy an expression.protected voidexplainThreads(ExpressionPresenter out)Add the value of the saxon:threads attribute to the explain outputjava.lang.StringgetExpressionName()Get a name identifying the kind of expression, in terms meaningful to a user.intgetImplementationMethod()An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().booleanisMultiThreaded(Configuration config)Ask whether the expression is multithreaded (that is, whether its operands are evaluated in parallel)SequenceIteratoriterate(XPathContext context)Return an Iterator to iterate over the values of the sequence.Expressionoptimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)Perform optimisation of an expression and its subexpressions.TailCallprocessLeavingTail(Outputter output, XPathContext context)ProcessLeavingTail: called to do the real work of this instruction.-
Methods inherited from class net.sf.saxon.expr.instruct.ForEach
addToPathMap, alwaysCreatesNewNodes, checkForUpdatingSubexpressions, checkPermittedContents, computeSpecialProperties, evaluatePendingUpdates, export, getAction, getActionExpression, getInstructionNameCode, getItemType, getNumberOfThreadsExpression, getSelect, getSelectExpression, getSeparatorExpression, getStaticUType, getStreamerName, getThreads, isInstruction, isUpdatingExpression, makeSeparator, map, mayCreateNewNodes, operands, setAction, setActionExpression, setInstruction, setSelect, setSelectExpression, setSeparatorExpression, setThreads, toShortString, toString, typeCheck, unordered
-
Methods inherited from class net.sf.saxon.expr.instruct.Instruction
assembleParams, assembleTunnelParams, computeCardinality, dynamicError, evaluateAsString, evaluateItem, getNetCost, getSourceLocator, isXSLT, process, someOperandCreatesNewNodes
-
Methods inherited from class net.sf.saxon.expr.Expression
adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, computeDependencies, computeHashCode, computeStaticProperties, dynamicError, effectiveBooleanValue, equals, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isLiftable, isStaticPropertiesKnown, isSubtreeExpression, isVacuousExpression, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, 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
-
MultithreadedForEach
public MultithreadedForEach(Expression select, Expression action, boolean containsTailCall, Expression threads)
-
-
Method Detail
-
isMultiThreaded
public boolean isMultiThreaded(Configuration config)
Description copied from class:ExpressionAsk whether the expression is multithreaded (that is, whether its operands are evaluated in parallel)- Overrides:
isMultiThreadedin classExpression- Parameters:
config- the Saxon configuration- Returns:
- true if execution will be multithreaded
-
optimize
public Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
Description copied from class:ExpressionPerform 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:
optimizein classForEach- Parameters:
visitor- an expression visitorcontextInfo- 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)
-
copy
public Expression copy(RebindingMap rebindings)
Description copied from class:ForEachCopy an expression. This makes a deep copy.
-
getImplementationMethod
public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided. This implementation provides only the process() method natively.- Overrides:
getImplementationMethodin classForEach- Returns:
- the implementation method, for example
Expression.ITERATE_METHODorExpression.EVALUATE_METHODorExpression.PROCESS_METHOD
-
processLeavingTail
public TailCall processLeavingTail(Outputter output, XPathContext context) throws XPathException
Description copied from class:InstructionProcessLeavingTail: called to do the real work of this instruction. This method must be implemented in each subclass. The results of the instruction are written to the current Receiver, which can be obtained via the Controller.- Specified by:
processLeavingTailin interfaceTailCallReturner- Overrides:
processLeavingTailin classForEach- Parameters:
output- the destination for the resultcontext- The dynamic context of the transformation, giving access to the current node, the current variables, etc.- Returns:
- null if the instruction has completed execution; or a TailCall indicating a function call or template call that is delegated to the caller, to be made after the stack has been unwound so as to save stack space.
- Throws:
XPathException- if a dynamic error occurs during the evaluation of the instruction
-
iterate
public SequenceIterator iterate(XPathContext context) throws XPathException
Return an Iterator to iterate over the values of the sequence.- Overrides:
iteratein classForEach- 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
-
getExpressionName
public java.lang.String getExpressionName()
Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
getExpressionNamein classForEach- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
-
explainThreads
protected void explainThreads(ExpressionPresenter out) throws XPathException
Add the value of the saxon:threads attribute to the explain output- Overrides:
explainThreadsin classForEach- Parameters:
out- the destination for explain output- Throws:
XPathException
-
-