import { FinancialCalculationSupportingCalculations as FinancialCalculationSupportingCalculations_internal } from "./FinancialCalculationSupportingCalculations";
/**
 * Represents a contract between the financial series and the calculation strategies
 * detailing the supporting calculation strategies that the financial series will
 * provide in order for the indicator calculations to be performed.
*/
export class IgrFinancialCalculationSupportingCalculations {
    createImplementation() {
        return new FinancialCalculationSupportingCalculations_internal();
    }
    /**
     * @hidden
     */
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    constructor() {
        this.mounted = false;
        this._implementation = this.createImplementation();
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    }
    _provideImplementation(i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
        if (this._initializeAdapters) {
            this._initializeAdapters();
        }
    }
    /**
     * The strategy provided to calculate an exponential moving average for a collection.
    */
    get eMA() {
        const r = this.i.a;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set eMA(v) {
        v == null ? this.i.a = null : this.i.a = v.i;
    }
    /**
     * The strategy provided to calculate a simple moving average for a collection.
    */
    get sMA() {
        const r = this.i.c;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set sMA(v) {
        v == null ? this.i.c = null : this.i.c = v.i;
    }
    /**
     * The strategy provided to calculate a standard deviation for a collection.
    */
    get sTDEV() {
        const r = this.i.d;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set sTDEV(v) {
        v == null ? this.i.d = null : this.i.d = v.i;
    }
    /**
     * The strategy provided to calculate a moving sum for a collection.
    */
    get movingSum() {
        const r = this.i.b;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set movingSum(v) {
        v == null ? this.i.b = null : this.i.b = v.i;
    }
    /**
     * The strategy provided to calculate the short period moving average for volume oscillator indicators.
    */
    get shortVolumeOscillatorAverage() {
        const r = this.i.h;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set shortVolumeOscillatorAverage(v) {
        v == null ? this.i.h = null : this.i.h = v.i;
    }
    /**
     * The strategy provided to calculate the long period moving average for volume oscillator indicators.
    */
    get longVolumeOscillatorAverage() {
        const r = this.i.f;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set longVolumeOscillatorAverage(v) {
        v == null ? this.i.f = null : this.i.f = v.i;
    }
    /**
     * The strategy provided to calculate the short period moving average for price oscillator indicators.
    */
    get shortPriceOscillatorAverage() {
        const r = this.i.g;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set shortPriceOscillatorAverage(v) {
        v == null ? this.i.g = null : this.i.g = v.i;
    }
    /**
     * The strategy provided to calculate the long period moving average for price oscillator indicators.
    */
    get longPriceOscillatorAverage() {
        const r = this.i.e;
        if (r == null) {
            return null;
        }
        return r.externalObject;
    }
    set longPriceOscillatorAverage(v) {
        v == null ? this.i.e = null : this.i.e = v.i;
    }
    /**
     * The strategy provided to make doubles safe for plotting, by default will just make zero if the value
     * is invalid.
    */
    get makeSafe() {
        return this.i.i;
    }
    set makeSafe(v) {
        this.i.i = v;
    }
    findByName(name) {
        if (this.findEphemera) {
            if (name && name.indexOf("@@e:") == 0) {
                return this.findEphemera(name);
            }
        }
        if (this.eMA && this.eMA.name && this.eMA.name == name) {
            return this.eMA;
        }
        if (this.sMA && this.sMA.name && this.sMA.name == name) {
            return this.sMA;
        }
        if (this.sTDEV && this.sTDEV.name && this.sTDEV.name == name) {
            return this.sTDEV;
        }
        if (this.movingSum && this.movingSum.name && this.movingSum.name == name) {
            return this.movingSum;
        }
        if (this.shortVolumeOscillatorAverage && this.shortVolumeOscillatorAverage.name && this.shortVolumeOscillatorAverage.name == name) {
            return this.shortVolumeOscillatorAverage;
        }
        if (this.longVolumeOscillatorAverage && this.longVolumeOscillatorAverage.name && this.longVolumeOscillatorAverage.name == name) {
            return this.longVolumeOscillatorAverage;
        }
        if (this.shortPriceOscillatorAverage && this.shortPriceOscillatorAverage.name && this.shortPriceOscillatorAverage.name == name) {
            return this.shortPriceOscillatorAverage;
        }
        if (this.longPriceOscillatorAverage && this.longPriceOscillatorAverage.name && this.longPriceOscillatorAverage.name == name) {
            return this.longPriceOscillatorAverage;
        }
        return null;
    }
}
