Package net.sf.saxon.expr.accum

## Class AccumulatorRegistry

- java.lang.Object
- - net.sf.saxon.expr.accum.AccumulatorRegistry

- Direct Known Subclasses:
    `AccumulatorRegistryEE`

      public class AccumulatorRegistry
      extends java.lang.Object

  Static registry for accumulators (XSLT 3.0) defined within a single package. Generally accessed via the PackageData object for the package.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected java.util.Map<StructuredQName,​Accumulator>` | `accumulatorsByName` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AccumulatorRegistry()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addAccumulator​(Accumulator acc)` | Register an accumulator
    `Accumulator` | `getAccumulator​(StructuredQName name)` | Get the accumulator with a given name
    `java.lang.Iterable<Accumulator>` | `getAllAccumulators()` | Get all the registered accumulators
    `Sequence` | `getStreamingAccumulatorValue​(NodeInfo node, Accumulator accumulator, AccumulatorFn.Phase phase)` | Get the run-time value of a streamed accumulator
    `java.util.Set<Accumulator>` | `getUsedAccumulators​(java.lang.String useAccumulatorsAtt, StyleElement styleElement)` | Process the use-accumulators attribute of instructions such as xsl:stream, xsl:mode, etc

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### accumulatorsByName

          protected java.util.Map<StructuredQName,​Accumulator> accumulatorsByName

  - ### Constructor Detail

    - #### AccumulatorRegistry

          public AccumulatorRegistry()

  - ### Method Detail

    - #### getUsedAccumulators

          public java.util.Set<Accumulator> getUsedAccumulators​(java.lang.String useAccumulatorsAtt,
                                                                StyleElement styleElement)

      Process the use-accumulators attribute of instructions such as xsl:stream, xsl:mode, etc
      Parameters:
        `useAccumulatorsAtt` - the value of the use-accumulators attribute
      Returns:
        the list of accumulators referenced

    - #### addAccumulator

          public void addAccumulator​(Accumulator acc)

      Register an accumulator
      Parameters:
        `acc` - the accumulator to be registered

    - #### getAccumulator

          public Accumulator getAccumulator​(StructuredQName name)

      Get the accumulator with a given name
      Parameters:
        `name` - the name of the accumulator
      Returns:
        the accumulator with this name

    - #### getAllAccumulators

          public java.lang.Iterable<Accumulator> getAllAccumulators()

      Get all the registered accumulators
      Returns:
        a collection of accumulators

    - #### getStreamingAccumulatorValue

          public Sequence getStreamingAccumulatorValue​(NodeInfo node,
                                                       Accumulator accumulator,
                                                       AccumulatorFn.Phase phase)
                                                throws XPathException

      Get the run-time value of a streamed accumulator
      Parameters:
        `node` - the context node, which must be a streamed node
        `accumulator` - the accumulator whose value is required
        `phase` - pre-descent or post-descent
      Returns:
        the value of the accumulator, or null if the context node is not streamed
      Throws:
        `XPathException` - if a dynamic error occurs