public class AccumulatorManager
extends java.lang.Object
In principle there is a dataset containing accumulator values for every accumulator/document pair. In addition, if the same stylesheet is run concurrently in multiple transformations, and a document is shared between these transformations, the data values for the accumulator can differ between the two transformations, because the accumulator rules can depend on values of stylesheet parameters or on context variables such as current-dateTime.
It is important that the accumulator data for a tree does not cause the tree to be locked in memory for the duration of a transformation. We therefore keep a weak reference to the tree. For each tree, until it is garbage collected, there is a map from accumulator names to accumulator data.
Constructor and Description |
---|
AccumulatorManager() |
Modifier and Type | Method and Description |
---|---|
void |
addAccumulatorData(TreeInfo doc,
Accumulator acc,
IAccumulatorData accData)
Add the accumulator data for a particular accumulator, if it does not already exist
|
IAccumulatorData |
getAccumulatorData(TreeInfo doc,
Accumulator acc,
XPathContext context)
Get the data relating to a particular accumulator for a particular unstreamed document tree
|
boolean |
isApplicable(TreeInfo tree,
Accumulator accumulator)
Ask whether a particular accumulator is applicable to a particular tree
|
void |
setApplicableAccumulators(TreeInfo tree,
java.util.Set<? extends Accumulator> accumulators)
By default, all accumulators are applicable to any given tree.
|
public void setApplicableAccumulators(TreeInfo tree, java.util.Set<? extends Accumulator> accumulators)
tree
- the document tree in questionaccumulators
- the set of accumulators that are appicablepublic boolean isApplicable(TreeInfo tree, Accumulator accumulator)
tree
- the tree in questionaccumulator
- the accumulator in questionpublic IAccumulatorData getAccumulatorData(TreeInfo doc, Accumulator acc, XPathContext context) throws XPathException
doc
- the source document tree in questionacc
- the required accumulatorcontext
- the XPath dynamic evaluation contextXPathException
- if any dynamic error occurspublic void addAccumulatorData(TreeInfo doc, Accumulator acc, IAccumulatorData accData)
doc
- the document/tree whose accumulator data is being addedacc
- the accumulator in questionaccData
- the data holding the values of the accumulator for the nodes in this treeCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.