示例#1
0
 public FranceTravel(BookingDatabase bookingDatabase, OysterDatabase oysterDatabase, ShutterStockDatabase shutterDatabase, TripAdvisorDatabase advisorDatabase, Random random)
 {
     this.booking = new BookingIterator(bookingDatabase);
     this.oyster  = new OysterIterator(oysterDatabase);
     this.shutter = new ShutterStockIterator(shutterDatabase);
     this.advisor = new TripAdvisorIterator(advisorDatabase);
     this.random  = random;
 }
示例#2
0
        public PolandTrip(BookingIterator booking, TripAdvisorIterator advisor, Random random)
        {
            days = random.Next(1, 5);
            EncryptedNumber num;

            while (advice.Count < 3 * days)
            {
                while (true)
                {
                    if (advisor.HasNext)
                    {
                        TripAdvice a = advisor.GetNext;
                        if (a.Country == "Poland")
                        {
                            advice.Add(a);
                            num             = new EncryptedNumber(a.Price);
                            this.price     += tripAdvisorDecodec.GetRealNumber(num);
                            num             = new EncryptedNumber(a.Rating);
                            this.ratingSum += tripAdvisorDecodec.GetRealNumber(num);
                            break;
                        }
                    }
                    else
                    {
                        advisor.Reset();
                    }
                }
            }

            while (rooms.Count < days)
            {
                while (true)
                {
                    if (booking.HasNext)
                    {
                        ListNode r = booking.GetNext;
                        rooms.Add(r);
                        num             = new EncryptedNumber(r.Price);
                        this.price     += bookingDecodec.GetRealNumber(num);
                        num             = new EncryptedNumber(r.Rating);
                        this.ratingSum += bookingDecodec.GetRealNumber(num);
                        break;
                    }
                    else
                    {
                        booking.Reset();
                    }
                }
            }
        }