Exemplo n.º 1
0
        /// <summary>
        ///		Add additional years to this list from a passed list of winter types.  A
        ///		new year is added for each item in the winter type list.
        /// </summary>
        /// <param name="WTList">
        ///		The list of winter types.  An ArgumentException exception is raised if this
        ///		list is empty.
        ///	</param>
        public void AddYears(cWinterTypeList WTList)
        {
            System.Diagnostics.Debug.WriteLine("");
            System.Diagnostics.Debug.WriteLine("cYearList.cs: AddYears() from Winter list");

            AddYearsFromList(WTList);
        }
Exemplo n.º 2
0
 /// <summary>
 ///		Initialize a cYearList by passing a list of winter types.  One year is
 ///		added to the list for each value in the cWinterTypeList.  An ArgumentException
 ///		exception is raised if the passed list of winter types is empty.
 /// </summary>
 /// <param name="WTList">The list of winter types.</param>
 public cYearList(cWinterTypeList WTList, cUniformRandom YearRnd)
 {
     if (WTList == null)
     {
         throw new ArgumentNullException("WTList");
     }
     // create the list
     Values = new List <cYear>();
     // add the years.  Exception will be raised in this method if WTList is empty
     AddYearsFromList(WTList);
     // initialize to first year
     mvarCurrentYearNum = 0;
 }
Exemplo n.º 3
0
        /// <summary>
        ///		Return a list of the winter types assigned to the years in this list.
        /// </summary>
        /// <returns>The list of winter types in a cWinterTypeList object.</returns>
        public cWinterTypeList GetWinterTypes()
        {
            System.Diagnostics.Debug.WriteLine("");
            System.Diagnostics.Debug.WriteLine("cYearList.cs: cWinterTypeList: GetWinterTypes()");

            // create the winter type list
            cWinterTypeList WTList = new cWinterTypeList();

            // add the winter types to this list
            foreach (cYear Year in this)
            {
                WTList.Add(Year.WinterType);
            }
            return(WTList);
        }
 /// <summary>
 ///		Create a read-only rabies model datasource from a passed cells datasource,
 ///		a passed wintertype list and a single animal.
 /// </summary>
 /// <param name="Rnd">The random number generator to be used by the generated background</param>
 /// <param name="Cells">
 ///		The cells datasource.  An ArgumentNullException exception is raised if Cells
 ///		is null.
 ///	</param>
 /// <param name="Winters">
 ///		The list of winter types.  An ArgumentNullException exception is raised if
 ///		Winters is null.  An ArgumentException exception is raised if Winter is an
 ///		empty list.
 ///	</param>
 ///	<param name="MaleMarkers">
 ///	    The markers for the seed male animal
 /// </param>
 /// <param name="FemaleMarkers">
 ///     The markers for the seed female animal
 /// </param>
 public cModelDataSource(cUniformRandom Rnd, cCellsDataSource Cells, cWinterTypeList Winters,
                         string MaleMarkers, string FemaleMarkers)
 {
     // set the values
     mvarCells   = Cells;
     mvarWinters = Winters;
     mvarRnd     = Rnd;
     // make sure that they a valid
     CheckCells();
     CheckWinterTypes();
     CheckRandom();
     // get markers
     mvarMaleMarkers   = MaleMarkers;
     mvarFemaleMarkers = FemaleMarkers;
 }
        /// <summary>
        ///		Initialize the background specifying numbers of years and their winter
        ///		types in a winter type list.
        /// </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="WTList">
        ///		The list of winter types.  An ArgumentException exception is raised if
        ///		WTList is empty.
        ///	</param>
        public cBackground(cUniformRandom Rnd, string Name, bool KeepAllAnimals, cWinterTypeList WTList)
        {
            if (Rnd == null)
            {
                throw new ArgumentNullException("Rnd");
            }
            if (WTList == null)
            {
                throw new ArgumentNullException("WTList");
            }

            // 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");
            }
            // 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 = new cYearList(WTList, RandomNum);
            // 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;
        }
Exemplo n.º 6
0
        //	Add years to the list.  An ArgumentException exception is raised if the passed list
        //	of winter types is empty.
        private void AddYearsFromList(cWinterTypeList WTList)
        {
            cYear Year;

            // raise an exception if WTList is empty
            if (WTList.Count == 0)
            {
                throw new ArgumentException("The list of winter types cannot be empty.",
                                            "WTList");
            }
            // create the Years
            for (int i = 0; i < WTList.Count; i++)
            {
                // create year based on winter type in the list
                Year = new cYear(Values.Count, WTList[i]);
                // add this year to the list
                Values.Add(Year);
            }
            GenerateYearsOnRandomSet = false;
        }
 /// <summary>
 ///     Construct a new background object of the approriate type
 /// </summary>
 /// <param name="Rnd">The random number generator for the background</param>
 /// <param name="BackgroundName">The name of the background</param>
 /// <param name="KeepAllAnimals">A boolean value that indicates whether or not the background should retain a list of all animals</param>
 /// <param name="Winters">A list of winter types</param>
 /// <returns>A new background object ofthe approriate type</returns>
 protected abstract cBackground GetNewBackground(cUniformRandom Rnd, string BackgroundName, bool KeepAllAnimals,
                                                 cWinterTypeList Winters);