/*
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 { FinancialIndicator } from "./FinancialIndicator";
import { String_$type, Number_$type, typeCast, fromEnum, markType } from "igniteui-react-core/ES2015/type";
import { DependencyProperty } from "igniteui-react-core/ES2015/DependencyProperty";
import { PropertyMetadata } from "igniteui-react-core/ES2015/PropertyMetadata";
import { List$1 } from "igniteui-react-core/ES2015/List$1";
import { AxisRange } from "./AxisRange";
import { isNaN_ } from "igniteui-react-core/ES2015/number";
/**
 * @hidden
 */
export class StrategyBasedIndicator extends FinancialIndicator {
    constructor() {
        super();
        this.qj();
    }
    qj() {
        this.p4 = this.p5;
        this.ab = this.qi;
    }
    qb() {
        return -2147483648;
    }
    qk(a) {
    }
    qd() {
        return -2147483648;
    }
    qa() {
        return -2147483648;
    }
    static qo(a, b, c) {
        let d = DependencyProperty.i(c, Number_$type, b, new PropertyMetadata(2, a, (e, f) => (typeCast(StrategyBasedIndicator.$, e)).raisePropertyChanged(c, f.oldValue, f.newValue)));
        StrategyBasedIndicator.p8.add(c);
        return d;
    }
    static qn(a, b) {
        return StrategyBasedIndicator.qo(a, b, "Period");
    }
    static ql(a, b) {
        return StrategyBasedIndicator.qo(a, b, "LongPeriod");
    }
    static qp(a, b) {
        return StrategyBasedIndicator.qo(a, b, "ShortPeriod");
    }
    ph(a, b) {
        let c = this.md(a, b);
        let d = this.me(c);
        return this.p4.b(c, d);
    }
    pe(a, b) {
        let c = this.md(a, b);
        if (b == 0) {
            return false;
        }
        if (!this.na(this.ph(a, b))) {
            return false;
        }
        let d = this.me(c);
        if (this.pb != null) {
            c.minimumValue = this.pb.c;
            c.maximumValue = this.pb.b;
        }
        let e = this.p4.a(c, d);
        for (let f = 0; f < this.pj && f < c.indicatorColumn.count; f++) {
            c.indicatorColumn.item(f, NaN);
        }
        if (this.mm != null && this.p7(c)) {
            this.mm.ck();
        }
        return e;
    }
    p7(a) {
        if (!isNaN_(a.minimumValue) && !isNaN_(a.maximumValue) && a.specifiesRange) {
            let b = this.pb;
            this.pb = new AxisRange(a.minimumValue, a.maximumValue);
            return this.p6(b, this.pb);
        }
        let c = 1.7976931348623157E+308;
        let d = -1.7976931348623157E+308;
        for (let e of fromEnum(a.indicatorColumn)) {
            if (!isNaN_(e)) {
                c = Math.min(c, e);
                d = Math.max(d, e);
            }
        }
        let f = this.pb;
        this.pb = new AxisRange(c, d);
        return this.p6(f, this.pb);
    }
    p6(a, b) {
        if (a == null || b == null) {
            return true;
        }
        if (a.c != b.c) {
            return true;
        }
        if (a.b != b.b) {
            return true;
        }
        return false;
    }
    qc(a) {
        if (a == -2147483648) {
            return 0;
        }
        if (a > this.indicatorColumn.count && this.indicatorColumn.count > 0) {
            a = this.indicatorColumn.count - 1;
        }
        if (a < 1) {
            return 1;
        }
        return a;
    }
    md(a, b) {
        let c = super.md(a, b);
        c.indicatorColumn = this.indicatorColumn;
        c.period = this.qc(this.qb());
        c.shortPeriod = this.qc(this.qd());
        c.longPeriod = this.qc(this.qa());
        c.multiplier = this.p9();
        return c;
    }
    p9() {
        return 1;
    }
    static qm(a, b) {
        let c = DependencyProperty.i("Multiplier", Number_$type, b, new PropertyMetadata(2, a, (d, e) => (typeCast(StrategyBasedIndicator.$, d)).raisePropertyChanged("Multiplier", e.oldValue, e.newValue)));
        StrategyBasedIndicator.p8.add("Multiplier");
        return c;
    }
    is(a, b, c, d) {
        super.is(a, b, c, d);
        if (StrategyBasedIndicator.p8.contains(b)) {
            if (this.mm != null && !this.mm.ck()) {
                this.mh.bu.e(this.er);
                this.pe(0, this.indicatorColumn.count);
                if (this.pc.b4) {
                    this.pc.b2.g$i();
                }
                this.i6(false);
            }
        }
    }
}
StrategyBasedIndicator.$t = markType(StrategyBasedIndicator, 'StrategyBasedIndicator', FinancialIndicator.$);
StrategyBasedIndicator.p8 = new List$1(String_$type, 0);
