예제 #1
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Adds a new cohort for a particular species.
        /// </summary>
        public void AddNewCohort(ISpecies species,
                                 ushort initialBiomass)
        {
            if (isDebugEnabled)
            {
                log.DebugFormat("  add cohort: {0}, initial biomass = {1}; site biomass = {2}",
                                species.Name, initialBiomass, totalBiomass);
            }

            bool speciesPresent = false;

            for (int i = 0; i < cohorts.Count; i++)
            {
                SpeciesCohorts speciesCohorts = cohorts[i];
                if (speciesCohorts.Species == species)
                {
                    speciesCohorts.AddNewCohort(initialBiomass);
                    speciesPresent = true;
                    break;
                }
            }

            if (!speciesPresent)
            {
                cohorts.Add(new SpeciesCohorts(species, initialBiomass));
            }

            totalBiomass += initialBiomass;
        }
예제 #2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Adds a new cohort for a particular species.
        /// </summary>
        public void AddNewCohort(ISpecies species,
                                 ushort initialBiomass)
        {
            for (int i = 0; i < cohorts.Count; i++)
            {
                SpeciesCohorts speciesCohorts = cohorts[i];
                if (speciesCohorts.Species == species)
                {
                    speciesCohorts.AddNewCohort(initialBiomass);
                    return;
                }
            }

            //  Species not present at the site.
            cohorts.Add(new SpeciesCohorts(species, initialBiomass));
        }