Пример #1
0
        public bool Accept(IReservation[] reservations, IReservation candidate,
                           ITable[] tables, TimeSpan seatingDuration)
        {
            var sameDayReservations = new SameDayReservationFilter()
                                      .Filter(reservations, candidate,
                                              seatingDuration);

            int total = sameDayReservations
                        .Sum(r => r.Quantity);

            return(candidate
                   .CanFit(new RectangularTable(tables.Sum(t => t.Size) - total)));
        }
Пример #2
0
        public bool Accept(
            IReservation[] reservations, IReservation candidate,
            ITable[] tables, TimeSpan seatingDuration)
        {
            var sameDayReservations = new SameDayReservationFilter()
                                      .Filter(reservations, candidate,
                                              seatingDuration);

            var assignedTables = new BestFitTableAssigner()
                                 .Assign(sameDayReservations, tables);

            var leftTables = tables.Except(assignedTables);

            return(leftTables.Any(t => candidate.CanFit(t)));
        }