//--------------------------------------------------------------------- /// <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)); } }
//--------------------------------------------------------------------- /// <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)); }