/*
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, getEnumerator } from "igniteui-react-core/ES2015/type";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
export class MoneyFlowIndexIndicatorStrategy extends IndicatorCalculationStrategy {
    b(a, b) {
        let c = new List$1(String_$type, 0);
        c.o(a.typicalColumn.basedOn);
        c.add("VolumeColumn");
        return c;
    }
    a(a, b) {
        let c = a.typicalColumn.getEnumerator();
        let d = getEnumerator(a.volumeColumn);
        let e = a.period;
        let f = 0;
        let g = new Array(e);
        for (f = 0; f < e; f++) {
            g[f] = 0;
        }
        let h = 0;
        let i = new Array(e);
        for (f = 0; f < e; f++) {
            i[f] = 0;
        }
        let j = 0;
        let k = 0;
        f = 0;
        while (c.moveNext() && d.moveNext()) {
            let l = f % e;
            let m = c.current * d.current;
            h -= g[l];
            j -= i[l];
            switch (Math.sign(m - k)) {
                case -1:
                    g[l] = 0;
                    i[l] = m;
                    break;
                case 0:
                    g[l] = 0;
                    i[l] = 0;
                    break;
                case 1:
                    g[l] = m;
                    i[l] = 0;
                    break;
            }
            h += g[l];
            j += i[l];
            let n = b.i(100 * h / (h + j));
            a.indicatorColumn.item(f, n);
            k = m;
            ++f;
        }
        return true;
    }
}
MoneyFlowIndexIndicatorStrategy.$t = markType(MoneyFlowIndexIndicatorStrategy, 'MoneyFlowIndexIndicatorStrategy', IndicatorCalculationStrategy.$);
