/*
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 { RelativeStrengthIndexIndicatorStrategy } from "./RelativeStrengthIndexIndicatorStrategy";
import { String_$type, markType, getEnumerator } from "igniteui-react-core/ES2015/type";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
import { isNaN_ } from "igniteui-react-core/ES2015/number";
export class StochRSIIndicatorStrategy extends IndicatorCalculationStrategy {
    constructor() {
        super();
        this.c = null;
        this.c = new RelativeStrengthIndexIndicatorStrategy();
    }
    b(a, b) {
        let c = new List$1(String_$type, 0);
        c.o(this.c.b(a, b));
        return c;
    }
    a(a, b) {
        let c = getEnumerator(this.c.c(a, b));
        let d = a.period;
        let e = 0;
        let f = new Array(d);
        for (e = 0; e < d; e++) {
            f[e] = 0;
        }
        e = 0;
        while (c.moveNext()) {
            let g = Math.min(d, e);
            let h = -1.7976931348623157E+308;
            let i = 1.7976931348623157E+308;
            let j = e % d;
            for (let k = 0; k < g; k++) {
                if (!isNaN_(f[g - k - 1])) {
                    h = Math.max(h, f[g - k - 1]);
                }
                if (!isNaN_(f[g - k - 1])) {
                    i = Math.min(i, f[g - k - 1]);
                }
            }
            f[j] = c.current;
            let l = b.i((c.current - i) / (h - i));
            a.indicatorColumn.item(e, l);
            e++;
        }
        return true;
    }
}
StochRSIIndicatorStrategy.$t = markType(StochRSIIndicatorStrategy, 'StochRSIIndicatorStrategy', IndicatorCalculationStrategy.$);
