Class: IndexAccumulator

IndexAccumulator()

Single-dimension index over row indices, keyed by exact value. Also maintains a meta-group prefix index so "X - All" style filter values (as used for applications and substances, see ReportDataWrapper.stepWithSubtype) can be resolved via a lookup instead of a scan. Building the meta-group index is a no-op for non-string keys (e.g. year) and for strings with no " - " separator (e.g. plain scenario names), so this class is safe to use uniformly across all indexed dimensions.

Constructor

new IndexAccumulator()

Create a new, empty index accumulator.
Source:

Methods

addToIndex(key, rowIndex)

Register a row under a value, indexing both its exact value and any meta-group prefixes it implies.
Parameters:
Name Type Description
key * The value to index (e.g. a scenario name or year).
rowIndex number The row's index in the underlying rows array.
Source:

getIndicies(filterVal, allowMetaGroup) → {Set.<number>}

Resolve the row indices matching a filter value.
Parameters:
Name Type Description
filterVal * The value to look up.
allowMetaGroup boolean Whether a value ending in " - All" should be resolved via the meta-group prefix index rather than treated as an exact (and likely non-matching) value.
Source:
Returns:
Matching row indices, possibly empty.
Type
Set.<number>

getKeys() → {IterableIterator.<*>}

Get the distinct exact values registered in this index.
Source:
Returns:
The indexed values.
Type
IterableIterator.<*>