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

        IEnumerator <ActiveSite> IEnumerable <ActiveSite> .GetEnumerator()
        {
            // harvestable sites are thos sites that will be harvested if
            // the minTargetSize is reached
            //
            // standsToHarvest are the stands from which harvesting will
            // be done if minTargetSize is reached.
            //
            // standsToHarvestRankings holds the rankings of the stands
            // we will be harvesting.
            //
            // standsToReject are those stands immediately that
            // are not harvestable and that will be marked
            // as rejected for the current prescription name

            harvestableSites        = new Queue <ActiveSite>();
            areaSelected            = 0;
            standsToHarvest         = new Queue <Stand>();
            standsToHarvestRankings = new Queue <double>();
            standsToReject          = new List <Stand>();
            string       prescriptionName = initialStand.PrescriptionName;
            Prescription lastPrescription = initialStand.LastPrescription;

            minTimeSinceDamage = initialStand.MinTimeSinceDamage;
            this.HarvestedNeighbors.Clear();

            // Attempt to do the harvest
            if (SpreadFromStand(initialStand))
            {
                int eventId = EventId.MakeNewId();

                // loop through all harvestable stands and update
                // appropriate items
                foreach (Stand standToHarvest in standsToHarvest)
                {
                    standToHarvest.MarkAsHarvested();
                    standToHarvest.EventId            = eventId;
                    standToHarvest.PrescriptionName   = prescriptionName;
                    standToHarvest.LastPrescription   = lastPrescription;
                    standToHarvest.MinTimeSinceDamage = minTimeSinceDamage;
                    standToHarvest.HarvestedRank      = standsToHarvestRankings.Dequeue();
                    if (!(standToHarvest == initialStand))
                    {
                        this.HarvestedNeighbors.Add(standToHarvest);
                    }
                } // foreach(Stand standToHarvest in standsToHarvest)
            }
            else
            {
                // if this set of stands is not harvestable by this prescription
                // mark them all as such using the prescriptionName.

                foreach (Stand standToReject in standsToHarvest)
                {
                    //Model.Core.UI.WriteLine("Rejecting stand {0} for prescription {1}",standToReject.MapCode, prescriptionName);
                    standToReject.RejectPrescriptionName(prescriptionName);
                    standToReject.HarvestedRank = standsToHarvestRankings.Dequeue();
                } // foreach(Stand standToReject in standsToHarvest)
            }     // if(SpreadFromStand(initialStand)) ... else

            // mark all rejected stands as rejected for this
            // prescription name

            foreach (Stand standToReject in standsToReject)
            {
                //Model.Core.UI.WriteLine("Rejecting stand {0} for prescription {1}",standToReject.MapCode, prescriptionName);
                standToReject.RejectPrescriptionName(prescriptionName);
            }

            // If what was found is enough to harvest, yield it
            if (harvestableSites.Count >= minTargetSize)
            {
                while (harvestableSites.Count > 0)
                {
                    yield return(harvestableSites.Dequeue());
                }
            }
        } // IEnumerator<ActiveSite> IEnumerable<ActiveSite>.GetEnumerator()