/*
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 { IndicatorCalculationStrategy } from "./IndicatorCalculationStrategy";
import { String_$type, markType } from "igniteui-react-core/ES2015/type";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
export class OnBalanceVolumeIndicatorStrategy extends IndicatorCalculationStrategy {
    b(a, b) {
        let c = new List$1(String_$type, 0);
        c.add("CloseColumn");
        c.add("VolumeColumn");
        return c;
    }
    a(a, b) {
        let c = a.closeColumn;
        let d = a.volumeColumn;
        let e = a.indicatorColumn;
        let f = 0;
        if (c != null && d != null) {
            f = Math.min(c.count, d.count);
        }
        let g = 0;
        if (f > 0) {
            g = d.item(0);
            e.item(0, g);
        }
        for (let 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.$);
