/*
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.qp();
        return _this;
    }
    StrategyBasedIndicator.prototype.qp = function () {
        this.qa = this.qb;
        this.ab = this.qo;
    };
    StrategyBasedIndicator.prototype.qh = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.qq = function (a) {
    };
    StrategyBasedIndicator.prototype.qj = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.prototype.qg = function () {
        return -2147483648;
    };
    StrategyBasedIndicator.qu = 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.qe.add(c);
        return d;
    };
    StrategyBasedIndicator.qt = function (a, b) {
        return StrategyBasedIndicator.qu(a, b, "Period");
    };
    StrategyBasedIndicator.qr = function (a, b) {
        return StrategyBasedIndicator.qu(a, b, "LongPeriod");
    };
    StrategyBasedIndicator.qv = function (a, b) {
        return StrategyBasedIndicator.qu(a, b, "ShortPeriod");
    };
    StrategyBasedIndicator.prototype.pn = function (a, b) {
        var c = this.mj(a, b);
        var d = this.mk(c);
        return this.qa.b(c, d);
    };
    StrategyBasedIndicator.prototype.pk = function (a, b) {
        var c = this.mj(a, b);
        if (b == 0) {
            return false;
        }
        if (!this.ng(this.pn(a, b))) {
            return false;
        }
        var d = this.mk(c);
        if (this.ph != null) {
            c.minimumValue = this.ph.c;
            c.maximumValue = this.ph.b;
        }
        var e = this.qa.a(c, d);
        for (var f = 0; f < this.pp && f < c.indicatorColumn.count; f++) {
            c.indicatorColumn.item(f, NaN);
        }
        if (this.ms != null && this.qd(c)) {
            this.ms.ck();
        }
        return e;
    };
    StrategyBasedIndicator.prototype.qd = function (a) {
        var e_1, _a;
        if (!isNaN_(a.minimumValue) && !isNaN_(a.maximumValue) && a.specifiesRange) {
            var b = this.ph;
            this.ph = new AxisRange(a.minimumValue, a.maximumValue);
            return this.qc(b, this.ph);
        }
        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.ph;
        this.ph = new AxisRange(c, d);
        return this.qc(f, this.ph);
    };
    StrategyBasedIndicator.prototype.qc = 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.qi = 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.mj = function (a, b) {
        var c = _super.prototype.mj.call(this, a, b);
        c.indicatorColumn = this.indicatorColumn;
        c.period = this.qi(this.qh());
        c.shortPeriod = this.qi(this.qj());
        c.longPeriod = this.qi(this.qg());
        c.multiplier = this.qf();
        return c;
    };
    StrategyBasedIndicator.prototype.qf = function () {
        return 1;
    };
    StrategyBasedIndicator.qs = 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.qe.add("Multiplier");
        return c;
    };
    StrategyBasedIndicator.prototype.iy = function (a, b, c, d) {
        _super.prototype.iy.call(this, a, b, c, d);
        if (StrategyBasedIndicator.qe.contains(b)) {
            if (this.ms != null && !this.ms.ck()) {
                this.mn.bu.e(this.eu);
                this.pk(0, this.indicatorColumn.count);
                if (this.pi.b4) {
                    this.pi.b2.g$i();
                }
                this.jc(false);
            }
        }
    };
    StrategyBasedIndicator.$t = markType(StrategyBasedIndicator, 'StrategyBasedIndicator', FinancialIndicator.$);
    StrategyBasedIndicator.qe = new List$1(String_$type, 0);
    return StrategyBasedIndicator;
}(FinancialIndicator));
export { StrategyBasedIndicator };
//# sourceMappingURL=StrategyBasedIndicator.js.map