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