/*
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 { FinancialIndicator } from "./FinancialIndicator";
import { String_$type, Number_$type, typeCast, fromEnum, markType } from "igniteui-angular-core/ES5/type";
import { DependencyProperty } from "igniteui-angular-core/ES5/DependencyProperty";
import { PropertyMetadata } from "igniteui-angular-core/ES5/PropertyMetadata";
import { List$1 } from "igniteui-angular-core/ES5/List$1";
import { AxisRange } from "./AxisRange";
import { isNaN_ } from "igniteui-angular-core/ES5/number";
/**
 * @hidden
 */
var StrategyBasedIndicator = /** @class */ (function (_super) {
    tslib_1.__extends(StrategyBasedIndicator, _super);
    function StrategyBasedIndicator() {
        var _this = _super.call(this) || this;
        _this.qi();
        return _this;
    }
    StrategyBasedIndicator.prototype.qi = function () {
        this.p3 = this.p4;
        this.ab = this.qh;
    };
    StrategyBasedIndicator.prototype.qa = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.qj = function (a) {
    };
    StrategyBasedIndicator.prototype.qc = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.p9 = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.qn = function (a, b, c) {
        var d = DependencyProperty.i(c, Number_$type, b, new PropertyMetadata(2, a, function (e, f) { return (typeCast(StrategyBasedIndicator.$, e)).raisePropertyChanged(c, f.oldValue, f.newValue); }));
        StrategyBasedIndicator.p7.add(c);
        return d;
    };
    StrategyBasedIndicator.qm = function (a, b) {
        return StrategyBasedIndicator.qn(a, b, "Period");
    };
    StrategyBasedIndicator.qk = function (a, b) {
        return StrategyBasedIndicator.qn(a, b, "LongPeriod");
    };
    StrategyBasedIndicator.qo = function (a, b) {
        return StrategyBasedIndicator.qn(a, b, "ShortPeriod");
    };
    StrategyBasedIndicator.prototype.pg = function (a, b) {
        var c = this.mc(a, b);
        var d = this.md(c);
        return this.p3.b(c, d);
    };
    StrategyBasedIndicator.prototype.pd = function (a, b) {
        var c = this.mc(a, b);
        if (b == 0) {
            return false;
        }
        if (!this.m9(this.pg(a, b))) {
            return false;
        }
        var d = this.md(c);
        if (this.pa != null) {
            c.minimumValue = this.pa.c;
            c.maximumValue = this.pa.b;
        }
        var e = this.p3.a(c, d);
        for (var f = 0; f < this.pi && f < c.indicatorColumn.count; f++) {
            c.indicatorColumn.item(f, NaN);
        }
        if (this.ml != null && this.p6(c)) {
            this.ml.ck();
        }
        return e;
    };
    StrategyBasedIndicator.prototype.p6 = function (a) {
        var e_1, _a;
        if (!isNaN_(a.minimumValue) && !isNaN_(a.maximumValue) && a.specifiesRange) {
            var b = this.pa;
            this.pa = new AxisRange(a.minimumValue, a.maximumValue);
            return this.p5(b, this.pa);
        }
        var c = 1.7976931348623157E+308;
        var d = -1.7976931348623157E+308;
        try {
            for (var _b = tslib_1.__values(fromEnum(a.indicatorColumn)), _c = _b.next(); !_c.done; _c = _b.next()) {
                var e = _c.value;
                if (!isNaN_(e)) {
                    c = Math.min(c, e);
                    d = Math.max(d, e);
                }
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
        var f = this.pa;
        this.pa = new AxisRange(c, d);
        return this.p5(f, this.pa);
    };
    StrategyBasedIndicator.prototype.p5 = function (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;
    };
    StrategyBasedIndicator.prototype.qb = function (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;
    };
    StrategyBasedIndicator.prototype.mc = function (a, b) {
        var c = _super.prototype.mc.call(this, a, b);
        c.indicatorColumn = this.indicatorColumn;
        c.period = this.qb(this.qa());
        c.shortPeriod = this.qb(this.qc());
        c.longPeriod = this.qb(this.p9());
        c.multiplier = this.p8();
        return c;
    };
    StrategyBasedIndicator.prototype.p8 = function () {
        return 1;
    };
    StrategyBasedIndicator.ql = function (a, b) {
        var c = DependencyProperty.i("Multiplier", Number_$type, b, new PropertyMetadata(2, a, function (d, e) { return (typeCast(StrategyBasedIndicator.$, d)).raisePropertyChanged("Multiplier", e.oldValue, e.newValue); }));
        StrategyBasedIndicator.p7.add("Multiplier");
        return c;
    };
    StrategyBasedIndicator.prototype.is = function (a, b, c, d) {
        _super.prototype.is.call(this, a, b, c, d);
        if (StrategyBasedIndicator.p7.contains(b)) {
            if (this.ml != null && !this.ml.ck()) {
                this.mg.bu.e(this.er);
                this.pd(0, this.indicatorColumn.count);
                if (this.pb.b4) {
                    this.pb.b2.g$i();
                }
                this.i5(false);
            }
        }
    };
    StrategyBasedIndicator.$t = markType(StrategyBasedIndicator, 'StrategyBasedIndicator', FinancialIndicator.$);
    StrategyBasedIndicator.p7 = new List$1(String_$type, 0);
    return StrategyBasedIndicator;
}(FinancialIndicator));
export { StrategyBasedIndicator };
//# sourceMappingURL=StrategyBasedIndicator.js.map