Landis.Harvest.SpecificAgesCohortSelector.SelectCohorts C# (CSharp) Method

SelectCohorts() public method

Selects which of a species' cohorts are harvested.
public SelectCohorts ( ISpeciesCohorts cohorts, ISpeciesCohortBoolArray isHarvested ) : void
cohorts ISpeciesCohorts
isHarvested ISpeciesCohortBoolArray
return void
        public void SelectCohorts(ISpeciesCohorts         cohorts,
                                  ISpeciesCohortBoolArray isHarvested)
        {
            int i = 0;
            foreach (ICohort cohort in cohorts) {
                if (ages.Contains(cohort.Age))
                    isHarvested[i] = true;
                else {
                    foreach (AgeRange range in ranges) {
                        if (range.Contains(cohort.Age)) {
                            isHarvested[i] = true;
                            break;
                        }
                    }
                }
                i++;
            }
        }
    }

Usage Example

        //---------------------------------------------------------------------

        private void SelectCohorts(ISpeciesCohorts            cohorts,
                                   SpecificAgesCohortSelector selector)
        {
            isHarvested.SetAllFalse(cohorts.Count);
            selector.SelectCohorts(cohorts, isHarvested);
        }