コード例 #1
0
        //---------------------------------------------------------------------

        public Prescription(string              name,
                            IStandRankingMethod rankingMethod,
                            ISiteSelector       siteSelector,
                            ICohortSelector     cohortSelector)
        {
            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
        }
 /// <summary>
 /// Creates a cohort cutter instance.
 /// </summary>
 /// <returns>
 /// An instance of WholeCohortCutter if no species is partially thinned
 /// by the cohort selector.  If the selector has a percentage for at
 /// least one species, then an instance of PartialCohortCutter is
 /// returned.
 /// </returns>
 public static ICohortCutter CreateCutter(ICohortSelector cohortSelector,
     ExtensionType   extensionType)
 {
     ICohortCutter cohortCutter;
     if (PartialThinning.CohortSelectors.Count == 0)
         cohortCutter = new WholeCohortCutter(cohortSelector, extensionType);
     else
         cohortCutter = new PartialCohortCutter(cohortSelector,
                                                PartialThinning.CohortSelectors,
                                                extensionType);
     return cohortCutter;
 }
コード例 #3
0
        //---------------------------------------------------------------------

        public RepeatHarvest(string               name,
                             IStandRankingMethod  rankingMethod,
                             ISiteSelector        siteSelector,
                             ICohortSelector      cohortSelector,
                             Planting.SpeciesList speciesToPlant,
                             int                  interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant)
        {
            this.interval = interval;
            this.spreadingSiteSelector = siteSelector as StandSpreading;
            this.harvestedStands = new List<Stand>();
        }
コード例 #4
0
        //---------------------------------------------------------------------

        public RepeatHarvest(string               name,
                             IStandRankingMethod  rankingMethod,
                             ISiteSelector        siteSelector,
                             ICohortSelector      cohortSelector,
                             Planting.SpeciesList speciesToPlant,
                             ISiteSelector        additionalSiteSelector,
                             int                  minTimeSinceDamage,
                             bool                 preventEstablishment,
                             int                  interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant, minTimeSinceDamage, preventEstablishment)
        {
            this.interval = interval;
            this.spreadingSiteSelector = siteSelector as StandSpreading;
            this.additionalSiteSelector = additionalSiteSelector;
            this.harvestedStands = new List<Stand>();
        }
コード例 #5
0
        //---------------------------------------------------------------------

        public SingleRepeatHarvest(string               name,
                                   IStandRankingMethod  rankingMethod,
                                   ISiteSelector        siteSelector,
                                   ICohortSelector      cohortSelector,
                                   Planting.SpeciesList speciesToPlant,
                                   ICohortSelector      additionalCohortSelector,
                                   Planting.SpeciesList additionalSpeciesToPlant,
                                   int                  interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant, interval)
        {
            this.initialCohortSelector = cohortSelector;
            this.initialSpeciesToPlant = speciesToPlant;

            this.additionalCohortSelector = additionalCohortSelector;
            this.additionalSpeciesToPlant = additionalSpeciesToPlant;
        }
コード例 #6
0
        //---------------------------------------------------------------------
        public Prescription(string               name,
            IStandRankingMethod  rankingMethod,
            ISiteSelector        siteSelector,
            ICohortSelector      cohortSelector,
            Planting.SpeciesList speciesToPlant,
            int                  minTimeSinceDamage,
            bool                 preventEstablishment)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
            this.speciesToPlant = speciesToPlant;
            this.minTimeSinceDamage = minTimeSinceDamage;
            this.preventEstablishment = preventEstablishment;
        }
        //---------------------------------------------------------------------

        public SingleRepeatHarvest(string               name,
                                   IStandRankingMethod  rankingMethod,
                                   ISiteSelector        siteSelector,
                                   ICohortSelector      cohortSelector,
                                   Planting.SpeciesList speciesToPlant,
                                   ICohortSelector      additionalCohortSelector,
                                   Planting.SpeciesList additionalSpeciesToPlant,
                                   ISiteSelector        additionalSiteSelector,
                                   int                  minTimeSinceDamage,
                                   bool                 preventEstablishment,
                                   int                  interval)
            : base(name, rankingMethod, siteSelector, cohortSelector, speciesToPlant,additionalSiteSelector, minTimeSinceDamage, preventEstablishment, interval)
        {
            this.initialCohortSelector = cohortSelector;
            this.initialSpeciesToPlant = speciesToPlant;

            this.additionalCohortSelector = additionalCohortSelector;
            this.additionalSpeciesToPlant = additionalSpeciesToPlant;
            this.additionalSiteSelector = additionalSiteSelector;
        }
        //---------------------------------------------------------------------

        // Replaces all the instances of BaseHarvest.SpecificAgesCohortSelector
        // with biomass counterparts.
        protected MultiSpeciesCohortSelector ReplaceSpecificAgeSelectors(ICohortSelector selector)
        {
            if (! ageOrRangeWasRead)
                return null;

            ageOrRangeWasRead = false;
            MultiSpeciesCohortSelector multiSpeciesCohortSelector = (MultiSpeciesCohortSelector) selector;
            foreach (ISpecies species in speciesDataset) {
                //PlugIn.ModelCore.UI.WriteLine("ReplaceSpecificAgeSelectors:  spp={0}", species.Name);
                SpecificAgesCohortSelector ageSelector = ageSelectors[species.Index];
                if (ageSelector != null) {
                    multiSpeciesCohortSelector[species] = ageSelector.SelectCohorts; 
                    ageSelectors[species.Index] = null;
                }
            }
            return multiSpeciesCohortSelector;
        }
コード例 #9
0
        //---------------------------------------------------------------------

        public BiomassCohortHarvest(ICohortSelector wholeCohortSelector,
                                    PartialCohortSelectors partialCohortSelectors)
            : base(wholeCohortSelector)
        {
            this.partialCohortSelectors = new PartialCohortSelectors(partialCohortSelectors);
        }
コード例 #10
0
        //---------------------------------------------------------------------

        // Replaces all the instances of BaseHarvest.SpecificAgesCohortSelector
        // with biomass counterparts.

        // <rant>Really people?!  This used to be a void method.  It modified its argument, so
        // there was no need to return it.  Now, you return it, just to have it ignored.  Way to
        // make the code more confusing (i.e., lower the signal-to-noise ratio)!!</rant>
        protected MultiSpeciesCohortSelector ReplaceSpecificAgeSelectors(ICohortSelector selector)
        {
            if (! ageOrRangeWasRead)
                return null;

            ageOrRangeWasRead = false;

            if (selector is AllSpeciesCohortSelector)
            {
                AllSpeciesCohortSelector allSpeciesCohortSelector = (AllSpeciesCohortSelector) selector;
                allSpeciesCohortSelector.SelectionMethod = ageSelectorForAllSpecies.SelectCohorts;
                return null;  // NOT USED!  SEE NOTE ABOVE.
            }

            MultiSpeciesCohortSelector multiSpeciesCohortSelector = (MultiSpeciesCohortSelector) selector;
            foreach (ISpecies species in speciesDataset) {
                //PlugIn.ModelCore.UI.WriteLine("ReplaceSpecificAgeSelectors:  spp={0}", species.Name);
                SpecificAgesCohortSelector ageSelector = ageSelectors[species.Index];
                if (ageSelector != null) {
                    multiSpeciesCohortSelector[species] = ageSelector.SelectCohorts; 
                    ageSelectors[species.Index] = null;
                }
            }
            return multiSpeciesCohortSelector;
        }
コード例 #11
0
        //---------------------------------------------------------------------

        // Replaces all the instances of BaseHarvest.SpecificAgesCohortSelector
        // with biomass counterparts.
        protected void ReplaceSpecificAgeSelectors(ICohortSelector selector)
        {
            if (! ageOrRangeWasRead)
                return;

            ageOrRangeWasRead = false;
            MultiSpeciesCohortSelector multiSpeciesCohortSelector = (MultiSpeciesCohortSelector) selector;
            foreach (ISpecies species in speciesDataset) {
                SpecificAgesCohortSelector ageSelector = ageSelectors[species.Index];
                if (ageSelector != null) {
                    multiSpeciesCohortSelector[species] = ageSelector.SelectCohorts;
                    ageSelectors[species.Index] = null;
                }
            }
        }
コード例 #12
0
        //---------------------------------------------------------------------

        public WholeCohortHarvest(ICohortSelector cohortSelector)
            : base(cohortSelector)
        {
            base.Type = Main.ExtType;
        }
コード例 #13
0
        //---------------------------------------------------------------------

        public Prescription(string               name,
                            IStandRankingMethod  rankingMethod,
                            ISiteSelector        siteSelector,
                            ICohortSelector      cohortSelector,
                            Planting.SpeciesList speciesToPlant,
                            int                  minTimeSinceDamage,
                            bool                 preventEstablishment)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
            this.speciesToPlant = speciesToPlant;
            this.minTimeSinceDamage = minTimeSinceDamage;
            this.preventEstablishment = preventEstablishment;

            // scan the name for LU-->{LU-name}
            const string LUmarker = "LU-->";
            int positionOfLUmarker = name.IndexOf(LUmarker);
            int positionOfLUname = positionOfLUmarker + LUmarker.Length;
            string LUname = name.Substring(positionOfLUname);
            this.landUseAfterHarvest = LandUse.LookupName(LUname);
        }
コード例 #14
0
 //---------------------------------------------------------------------
 /// <summary>
 /// Create a new instance.
 /// </summary>
 public WholeCohortCutter(ICohortSelector cohortSelector,
     ExtensionType   extensionType)
 {
     Type = extensionType;
     CohortSelector = cohortSelector;
 }
コード例 #15
0
        //---------------------------------------------------------------------

        protected override ICohortCutter CreateCohortCutter(ICohortSelector cohortSelector)
        {
            return CohortCutterFactory.CreateCutter(cohortSelector, HarvestExtensionMain.ExtType);
        }
コード例 #16
0
        //---------------------------------------------------------------------

        public Prescription(string               name,
                            IStandRankingMethod  rankingMethod,
                            ISiteSelector        siteSelector,
                            ICohortSelector      cohortSelector,
                            Planting.SpeciesList speciesToPlant)
        {
            this.number = nextNumber;
            nextNumber++;

            this.name = name;
            this.rankingMethod = rankingMethod;
            this.siteSelector = siteSelector;
            this.cohortSelector = cohortSelector;
            this.speciesToPlant = speciesToPlant;
        }
コード例 #17
0
 //---------------------------------------------------------------------
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 public AgeCohortHarvest(ICohortSelector cohortSelector)
 {
     this.cohortSelector = cohortSelector;
 }
コード例 #18
0
        //---------------------------------------------------------------------

        public RemoveTrees(ICohortSelector cohortSelector)
            : base(cohortSelector)
        {
            base.Type = Main.ExtType;
        }