//--------------------------------------------------------------------- /// <summary> /// Adds a prescription to be applied to the management area. /// </summary> public void ApplyPrescription(Prescription prescription, Percentage percentageToHarvest, int startTime, int endTime) { prescriptions.Add(new AppliedPrescription(prescription, percentageToHarvest, startTime, endTime)); }
//--------------------------------------------------------------------- /// <summary> /// Has a particular prescription been applied to the managment area? /// </summary> public bool IsApplied(Prescription prescription) { foreach (AppliedPrescription appliedPrescription in prescriptions) if (appliedPrescription.Prescription == prescription) return true; return false; }
//--------------------------------------------------------------------- public AppliedPrescription(Prescription prescription, ManagementArea managementArea, Percentage percentageToHarvest, int beginTime, int endTime) { this.prescription = prescription; this.standSpreadSiteSelector = prescription.SiteSelectionMethod as StandSpreading; this.percentageToHarvest = percentageToHarvest; this.areaToHarvest = managementArea.Area * percentageToHarvest; this.beginTime = beginTime; this.endTime = endTime; }
//--------------------------------------------------------------------- public AppliedPrescription(Prescription prescription, Percentage percentageToHarvest, int beginTime, int endTime) { //set prescription this.prescription = prescription; //set stand ranking method this.standSpreadSiteSelector = prescription.SiteSelectionMethod as StandSpreading; //set harvest percentage this.percentageToHarvest = percentageToHarvest; //set begin time and end time this.beginTime = beginTime; this.endTime = endTime; }
//--------------------------------------------------------------------- /// <summary> /// Adds a prescription to be applied to the management area. /// </summary> public void ApplyPrescription(Prescription prescription, Percentage percentageToHarvest, int startTime, int endTime) { // tjs - 2008.12.17 - reversing if and else if so that it checks for // SingleRepeatHarvest. This is done because SingleRepeatHarvest // is a descendent of RepeatHarvest, so the RepeatHarvest condition // is true if prescription is SingleRepeatHarvest if(prescription is SingleRepeatHarvest) { AppliedRepeatHarvest appy = new AppliedRepeatHarvest((SingleRepeatHarvest) prescription, percentageToHarvest, startTime, endTime); prescriptions.Add(appy); } else if (prescription is RepeatHarvest) { AppliedRepeatHarvest appy = new AppliedRepeatHarvest((RepeatHarvest)prescription, percentageToHarvest, startTime, endTime); prescriptions.Add(appy); } else prescriptions.Add(new AppliedPrescription(prescription, percentageToHarvest, startTime, endTime)); }