/// <summary>
 /// Generalized method to load Stochastic Data Parameters from AGEPRO Input Data files.
 /// </summary>
 /// <param name="inp">AGEPRO InputFile StochasticAge Parameters </param>
 /// <param name="generalOpt">AGEPRO InputFile General Options values</param>
 public void LoadStochasticAgeInputData(Nmfs.Agepro.CoreLib.AgeproStochasticAgeTable inp,
                                        Nmfs.Agepro.CoreLib.AgeproGeneral generalOpt)
 {
     this.readInputFileState = true;
     this.seqYears           = Array.ConvertAll(generalOpt.SeqYears(), element => element.ToString());
     this.numFleets          = generalOpt.numFleets;
     this.timeVarying        = inp.timeVarying;
     this.stochasticDataFile = inp.dataFile;
     this.stochasticAgeTable = Util.GetAgeproInputDataTable(this.stochasticAgeTable, inp.byAgeData);
     this.stochasticCV       = Util.GetAgeproInputDataTable(this.stochasticCV, inp.byAgeCV);
     if (this.stochasticAgeTable == null)
     {
         this.enableTimeVaryingCheckBox = false;
     }
     else
     {
         this.enableTimeVaryingCheckBox = true;
     }
     this.readInputFileState = false;
 }
 public virtual void bindStochasticAgeData(Nmfs.Agepro.CoreLib.AgeproStochasticAgeTable inp)
 {
     if (readInputFileState == false)
     {
         inp.fromFile    = false;
         inp.timeVarying = this.timeVarying;
         inp.byAgeData   = this.stochasticAgeTable;
         inp.byAgeCV     = this.stochasticCV;
     }
     else if (readInputFileState == true)
     {
         inp.fromFile    = true;
         inp.timeVarying = this.timeVarying;
         inp.byAgeData.Clear();
         inp.byAgeCV.Clear();
     }
     else
     {
         throw new InvalidAgeproParameterException("readInputFileState is NULL");
     }
 }
        /// <summary>
        /// Creates a empty Data Table for the Stochastic Parameter Control based on the user inputs gathered
        /// from the General Options control parameter.
        /// </summary>
        /// <param name="objNT">Object representing the Stochastic Parameter</param>
        /// <param name="genOpt">Paramters from the General Options Control</param>
        /// <param name="fleetDependent">Is this Stochastic Parameter dependent on the
        /// nubmber of fleets? Default is false.</param>
        public void CreateStochasticParameterFallbackDataTable(Nmfs.Agepro.CoreLib.AgeproStochasticAgeTable objNT,
                                                               Nmfs.Agepro.CoreLib.AgeproGeneral genOpt,
                                                               StochasticAgeFleetDependency fleetDependent = StochasticAgeFleetDependency.independent)
        {
            this.numFleets          = Convert.ToInt32(genOpt.numFleets);
            this.seqYears           = Array.ConvertAll(genOpt.SeqYears(), element => element.ToString());
            this.readInputFileState = true;
            //Reset Tables if they were used before
            if (this.stochasticAgeTable != null)
            {
                this.stochasticAgeTable.Reset();
                this.stochasticCV.Reset();
            }

            if (this.timeVarying == true)
            {
                this.stochasticAgeTable = CreateFallbackAgeDataTable(genOpt.NumAges(),
                                                                     genOpt.SeqYears().Count(), this.numFleets);
            }
            else
            {
                if (fleetDependent == StochasticAgeFleetDependency.dependent)
                {
                    this.stochasticAgeTable = CreateFallbackAgeDataTable(genOpt.NumAges(), 1, this.numFleets);
                    this.stochasticCV       = CreateFallbackAgeDataTable(genOpt.NumAges(), 1, this.numFleets);
                }
                else
                {
                    this.stochasticAgeTable = CreateFallbackAgeDataTable(genOpt.NumAges(), 1, 1);
                    this.stochasticCV       = CreateFallbackAgeDataTable(genOpt.NumAges(), 1, 1);
                }
            }

            objNT.byAgeData = this.stochasticAgeTable;
            objNT.byAgeCV   = this.stochasticCV;

            this.readInputFileState = false;
        }