/// <summary> /// Initialize the background, passing a list of years and a seed for all /// random number generators in the model. This is an internal constructor /// and may only be used by classes within the Rabies_Model_Core namespace. /// </summary> /// <param name="Rnd">The random number generator to be used by the background</param> /// <param name="Name"> /// The name to assign to this background. An ArgumentException is raised if /// Name is zero length. /// </param> /// <param name="KeepAllAnimals"> /// A flag indicating whether a record of all animals should be kept during /// a run. /// </param> /// <param name="YList"> /// The list of years. An ArgumentException exception is raised if YList is empty. /// </param> /// <param name="DList"> /// A list of diseases that will affect the animals in this background. /// </param> public cBackground(cUniformRandom Rnd, string Name, bool KeepAllAnimals, cYearList YList, cDiseaseList DList) { if (Rnd == null) { throw new ArgumentNullException("Rnd"); } if (YList == null) { throw new ArgumentNullException("YList"); } if (DList == null) { throw new ArgumentNullException("DList"); } // make sure that Name is not zero length if (string.IsNullOrEmpty(Name)) { throw new ArgumentException("Name must not be zero length.", "Name"); } // make sure the Years list contains at least one year if (YList.Count == 0) { throw new ArgumentException("Year list must contain at least one year.", "Years"); } // create the random number generator RandomNum = Rnd; RandomNum.MinValue = 0; RandomNum.MaxValue = 100; // copy the name this.Name = Name; // create a super cell list SuperCells = new cSuperCellList(); // create a master cell list Cells = new cMasterCellList(this, RandomNum); // generate winter and animal lists Years = YList; Years.YearRnd = RandomNum; // create the master list of animals Animals = new cMasterAnimalList(1, KeepAllAnimals, RandomNum); // create the list of diseases Diseases = DList; // create the strategy list Strategies = new cStrategyList(); StrategyCounter = 0; // set have run weekly events to false mvarHaveRunWeeklyEvents = false; // scramble list is false by default ScrambleList = false; // abort on disease disappearance is true by default AbortOnDiseaseDisappearance = true; // prevent incest flag - set to false by default PreventIncest = false; }
/// <summary> /// Initialize the background specifying the initial number of years and their /// winter bias. /// </summary> /// <param name="Rnd">The random number generator to be used by the background</param> /// <param name="Name"> /// The name to assign to this background. An ArgumentException is raised if /// Name is zero length. /// </param> /// <param name="KeepAllAnimals"> /// A flag indicating whether a record of all animals should be kept during /// a run. /// </param> /// <param name="NYears"> /// The initial number of years. An ArgumentException is raised in NYears is /// less than or equal to zero. /// </param> /// <param name="WinterBias">The winter bias of the initial years.</param> public cBackground(cUniformRandom Rnd, string Name, bool KeepAllAnimals, int NYears, enumWinterType WinterBias) { if (Rnd == null) { throw new ArgumentNullException("Rnd"); } // reference the random number generator RandomNum = Rnd; RandomNum.MinValue = 0; RandomNum.MaxValue = 100; // make sure that Name is not zero length if (string.IsNullOrEmpty(Name)) { throw new ArgumentException("Name must not be zero length.", "Name"); } // make sure NYears > 0 if (NYears <= 0) { throw new ArgumentException("NYears must be greater than 0.", "NYears"); } // copy the name this.Name = Name; // create a super cell list SuperCells = new cSuperCellList(); // create a master cell list Cells = new cMasterCellList(this, RandomNum); // create list of years Years = new cYearList(NYears, RandomNum, WinterBias); // create the master list of animals Animals = new cMasterAnimalList(1, KeepAllAnimals, RandomNum); // create the list of diseases Diseases = new cDiseaseList(RandomNum); // create the strategy list Strategies = new cStrategyList(); StrategyCounter = 0; // set have run weekly events to false mvarHaveRunWeeklyEvents = false; // scramble list is false by default ScrambleList = false; // abort on disease disappearance is true by default AbortOnDiseaseDisappearance = true; // prevent incest flag - set to false by default PreventIncest = false; }