/*
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 { IndicatorCalculationStrategy } from "./IndicatorCalculationStrategy";
import { String_$type, markType } from "igniteui-react-core/ES5/type";
import { List$1 } from "igniteui-react-core/ES5/List$1";
var OnBalanceVolumeIndicatorStrategy = /** @class */ (function (_super) {
    tslib_1.__extends(OnBalanceVolumeIndicatorStrategy, _super);
    function OnBalanceVolumeIndicatorStrategy() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    OnBalanceVolumeIndicatorStrategy.prototype.b = function (a, b) {
        var c = new List$1(String_$type, 0);
        c.add("CloseColumn");
        c.add("VolumeColumn");
        return c;
    };
    OnBalanceVolumeIndicatorStrategy.prototype.a = function (a, b) {
        var c = a.closeColumn;
        var d = a.volumeColumn;
        var e = a.indicatorColumn;
        var f = 0;
        if (c != null && d != null) {
            f = Math.min(c.count, d.count);
        }
        var g = 0;
        if (f > 0) {
            g = d.item(0);
            e.item(0, g);
        }
        for (var h = 1; h < f; ++h) {
            switch (Math.sign(c.item(h) - c.item(h - 1))) {
                case -1:
                    g -= d.item(h);
                    break;
                case 1:
                    g += d.item(h);
                    break;
            }
            e.item(h, g);
        }
        return true;
    };
    OnBalanceVolumeIndicatorStrategy.$t = markType(OnBalanceVolumeIndicatorStrategy, 'OnBalanceVolumeIndicatorStrategy', IndicatorCalculationStrategy.$);
    return OnBalanceVolumeIndicatorStrategy;
}(IndicatorCalculationStrategy));
export { OnBalanceVolumeIndicatorStrategy };
