Beispiel #1
0
 internal void RemoveMarkedCohorts(ICohortDisturbance disturbance)
 {
     for (int i = 0; i < agevector.Length; ++i)
     {
         if (agevector[i] > 0)
         {
             if (disturbance.MarkCohortForDeath(new Library.AgeOnlyCohorts.Cohort(Species, (ushort)i)))
             {
                 agevector[i] = 0;
             }
         }
     }
 }
Beispiel #2
0
        //---------------------------------------------------------------------

        /// <summary>
        /// Removes the cohorts which are damaged by a disturbance.
        /// </summary>
        public void RemoveMarkedCohorts(ICohortDisturbance disturbance)
        {
            //  Go backwards through list of ages, so the removal of an age
            //  doesn't mess up the loop.
            isMaturePresent = false;
            for (int i = ages.Count - 1; i >= 0; i--)
            {
                ICohort cohort = new Cohort(species, ages[i]);
                if (disturbance.MarkCohortForDeath(cohort))
                {
                    ages.RemoveAt(i);
                    Cohort.Died(this, cohort, disturbance.CurrentSite, disturbance.Type);
                }
                else if (ages[i] >= species.Maturity)
                {
                    isMaturePresent = true;
                }
            }
        }
        //---------------------------------------------------------------------

        /// <summary>
        /// Removes the cohorts which are damaged by a disturbance.
        /// </summary>
        public void RemoveMarkedCohorts(ICohortDisturbance disturbance)
        {
            //  Go backwards through list of ages, so the removal of an age
            //  doesn't mess up the loop.
            isMaturePresent = false;
            for (int i = ages.Count - 1; i >= 0; i--) {
                ICohort cohort = new Cohort(species, ages[i]);
                //Console.WriteLine("Cohort={0}.", cohort.Species.Name);
                //Console.WriteLine("disturbance={0}.", disturbance.ToString());
                if (disturbance.MarkCohortForDeath(cohort))
                {
                    ages.RemoveAt(i);
                    Cohort.Died(this, cohort, disturbance.CurrentSite, disturbance.Type);
                }
                else if (ages[i] >= species.Maturity)
                    isMaturePresent = true;
            }
        }