[6a3a178] | 1 | "use strict";
|
---|
| 2 | /*
|
---|
| 3 | * This is a TypeScript port of the original Java version, which was written by
|
---|
| 4 | * Gil Tene as described in
|
---|
| 5 | * https://github.com/HdrHistogram/HdrHistogram
|
---|
| 6 | * and released to the public domain, as explained at
|
---|
| 7 | * http://creativecommons.org/publicdomain/zero/1.0/
|
---|
| 8 | */
|
---|
| 9 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 10 | const JsHistogramIterator_1 = require("./JsHistogramIterator");
|
---|
| 11 | /**
|
---|
| 12 | * Used for iterating through all recorded histogram values using the finest granularity steps supported by the
|
---|
| 13 | * underlying representation. The iteration steps through all non-zero recorded value counts, and terminates when
|
---|
| 14 | * all recorded histogram values are exhausted.
|
---|
| 15 | */
|
---|
| 16 | class RecordedValuesIterator extends JsHistogramIterator_1.default {
|
---|
| 17 | /**
|
---|
| 18 | * @param histogram The histogram this iterator will operate on
|
---|
| 19 | */
|
---|
| 20 | constructor(histogram) {
|
---|
| 21 | super();
|
---|
| 22 | this.doReset(histogram);
|
---|
| 23 | }
|
---|
| 24 | /**
|
---|
| 25 | * Reset iterator for re-use in a fresh iteration over the same histogram data set.
|
---|
| 26 | */
|
---|
| 27 | reset() {
|
---|
| 28 | this.doReset(this.histogram);
|
---|
| 29 | }
|
---|
| 30 | doReset(histogram) {
|
---|
| 31 | super.resetIterator(histogram);
|
---|
| 32 | this.visitedIndex = -1;
|
---|
| 33 | }
|
---|
| 34 | incrementIterationLevel() {
|
---|
| 35 | this.visitedIndex = this.currentIndex;
|
---|
| 36 | }
|
---|
| 37 | reachedIterationLevel() {
|
---|
| 38 | const currentCount = this.histogram.getCountAtIndex(this.currentIndex);
|
---|
| 39 | return currentCount != 0 && this.visitedIndex !== this.currentIndex;
|
---|
| 40 | }
|
---|
| 41 | }
|
---|
| 42 | exports.default = RecordedValuesIterator;
|
---|
| 43 | //# sourceMappingURL=RecordedValuesIterator.js.map |
---|