示例#1
0
        //---------------------------------------------------------------------

        public void Do(ActiveSite site)
        {
            for (int i = 0; i < Model.Core.Species.Count; i++)
            {
                ISpecies species = Model.Core.Species[i];
                if (seedingAlgorithm(species, site))
                {
                    Reproduction.AddNewCohort(species, site);
                    if (isDebugEnabled)
                    {
                        log.DebugFormat("site {0}: seeded {1}",
                                        site.Location, species.Name);
                    }
                }
            }
        }
        //---------------------------------------------------------------------

        bool IFormOfReproduction.TryAt(ActiveSite site)
        {
            bool     success = false;
            BitArray selectedSpeciesAtSite = selectedSpecies[site];

            for (int index = 0; index < speciesDataset.Count; ++index)
            {
                if (selectedSpeciesAtSite.Get(index))
                {
                    ISpecies species = speciesDataset[index];
                    if (PreconditionsSatisfied(species, site))
                    {
                        Reproduction.AddNewCohort(species, site);
                        success = true;
                    }
                }
            }

            return(success);
        }
示例#3
0
        //---------------------------------------------------------------------

        bool IFormOfReproduction.TryAt(ActiveSite site)
        {
            bool     success = false;
            BitArray selectedSpeciesAtSite = selectedSpecies[site];

            for (int index = 0; index < speciesDataset.Count; ++index)
            {
                if (selectedSpeciesAtSite.Get(index))
                {
                    ISpecies species = speciesDataset[index];
                    if (PreconditionsSatisfied(species, site))
                    {
                        Reproduction.AddNewCohort(species, site);
                        success = true;
                    }
                }
            }
            // Reset the BitArray to be empty so planting does not continue to recur on the site
            selectedSpecies[site].SetAll(false);
            return(success);
        }