/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import * as tslib_1 from "tslib";
import { StreamingIndicatorCalculationStrategy } from "./StreamingIndicatorCalculationStrategy";
import { String_$type, fromEnum, toEnum, markType } from "igniteui-react-core/ES5/type";
import { List$1 } from "igniteui-react-core/ES5/List$1";
var AccumulationDistributionIndicatorStrategy = /** @class */ (function (_super) {
    tslib_1.__extends(AccumulationDistributionIndicatorStrategy, _super);
    function AccumulationDistributionIndicatorStrategy() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    AccumulationDistributionIndicatorStrategy.prototype.b = function (a, b) {
        var c = new List$1(String_$type, 0);
        c.add("CloseColumn");
        c.add("LowColumn");
        c.add("HighColumn");
        c.add("VolumeColumn");
        return c;
    };
    AccumulationDistributionIndicatorStrategy.prototype.a = function (a, b) {
        var c = 0;
        try {
            for (var _a = tslib_1.__values(fromEnum(this.c(a, b))), _b = _a.next(); !_b.done; _b = _a.next()) {
                var d = _b.value;
                a.indicatorColumn.item(c, d);
                c++;
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
            }
            finally { if (e_1) throw e_1.error; }
        }
        return true;
        var e_1, _d;
    };
    AccumulationDistributionIndicatorStrategy.prototype._c = function (a, b) {
        var c, d, e, f, g, h, i, j, k, l, m, n, o, p;
        return tslib_1.__generator(this, function (_a) {
            switch (_a.label) {
                case 0:
                    c = 0;
                    d = Number.POSITIVE_INFINITY;
                    e = Number.NEGATIVE_INFINITY;
                    f = a.indicatorColumn != null ? a.indicatorColumn.count : 0;
                    g = a.closeColumn != null ? a.closeColumn.count : 0;
                    h = a.highColumn != null ? a.highColumn.count : 0;
                    i = a.volumeColumn != null ? a.volumeColumn.count : 0;
                    j = Math.min(f, Math.min(g, Math.min(h, i)));
                    k = 0;
                    _a.label = 1;
                case 1:
                    if (!(k < j)) return [3 /*break*/, 4];
                    l = a.closeColumn.item(k);
                    m = a.lowColumn.item(k);
                    n = a.highColumn.item(k);
                    o = a.volumeColumn.item(k);
                    p = ((l - m) - (n - l)) / (n - m);
                    c += b.i(p * o);
                    d = Math.min(d, c);
                    e = Math.max(e, c);
                    return [4 /*yield*/, c];
                case 2:
                    _a.sent();
                    _a.label = 3;
                case 3:
                    ++k;
                    return [3 /*break*/, 1];
                case 4: return [2 /*return*/];
            }
        });
    };
    AccumulationDistributionIndicatorStrategy.prototype.c = function (a, b) {
        var _this = this;
        return toEnum(function () { return _this._c(a, b); });
    };
    AccumulationDistributionIndicatorStrategy.$t = markType(AccumulationDistributionIndicatorStrategy, 'AccumulationDistributionIndicatorStrategy', StreamingIndicatorCalculationStrategy.$);
    return AccumulationDistributionIndicatorStrategy;
}(StreamingIndicatorCalculationStrategy));
export { AccumulationDistributionIndicatorStrategy };
