//--------------------------------------------------------------------- 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; }
//--------------------------------------------------------------------- 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>(); }
//--------------------------------------------------------------------- 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>(); }
//--------------------------------------------------------------------- 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; }
//--------------------------------------------------------------------- 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; }
//--------------------------------------------------------------------- public BiomassCohortHarvest(ICohortSelector wholeCohortSelector, PartialCohortSelectors partialCohortSelectors) : base(wholeCohortSelector) { this.partialCohortSelectors = new PartialCohortSelectors(partialCohortSelectors); }
//--------------------------------------------------------------------- // 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; }
//--------------------------------------------------------------------- // 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; } } }
//--------------------------------------------------------------------- public WholeCohortHarvest(ICohortSelector cohortSelector) : base(cohortSelector) { base.Type = Main.ExtType; }
//--------------------------------------------------------------------- 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); }
//--------------------------------------------------------------------- /// <summary> /// Create a new instance. /// </summary> public WholeCohortCutter(ICohortSelector cohortSelector, ExtensionType extensionType) { Type = extensionType; CohortSelector = cohortSelector; }
//--------------------------------------------------------------------- protected override ICohortCutter CreateCohortCutter(ICohortSelector cohortSelector) { return CohortCutterFactory.CreateCutter(cohortSelector, HarvestExtensionMain.ExtType); }
//--------------------------------------------------------------------- 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; }
//--------------------------------------------------------------------- /// <summary> /// Creates a new instance. /// </summary> public AgeCohortHarvest(ICohortSelector cohortSelector) { this.cohortSelector = cohortSelector; }
//--------------------------------------------------------------------- public RemoveTrees(ICohortSelector cohortSelector) : base(cohortSelector) { base.Type = Main.ExtType; }