//--------------------------------------------------------------------- /// <summary> /// Computes current forage in reach for a cohort /// </summary> /// <returns> /// </returns> public int UpdateForageInReach(IDisturbance disturbance) { // Go backwards through list of cohort data, so the removal of an // item doesn't mess up the loop. int totalForageInReach = 0; for (int i = cohortData.Count - 1; i >= 0; i--) { Cohort cohort = new Cohort(species, cohortData[i]); int forageInReach = disturbance.ChangeForageInReach(cohort); cohort.ChangeForageInReach(forageInReach); cohortData[i] = cohort.Data; totalForageInReach += forageInReach; } return(totalForageInReach); }