コード例 #1
0
        public int GetTempOrderTime(Order order)
        {
            Kitchen tempkitchen = (Kitchen)this.Clone();

            tempkitchen.AddOrder(order);
            tempkitchen.Start();
            int res = tempkitchen.CheckOrder(order);

            return(res);
        }
コード例 #2
0
        public object Clone()
        {
            var isStarted      = false;
            var newkitchen     = new Kitchen();
            var newOrders      = new List <Order>(this.orders);
            var newReadyOrders = new List <Order>();
            var newQuisines    = new List <Quisine>(this.quisines);

            foreach (Quisine quisine in newQuisines)
            {
                newkitchen.AddQuisine(quisine);
            }
            foreach (Order order in newOrders)
            {
                Order neworder = new Order();
                foreach (Dish dish in order.GetDishes())
                {
                    var name = dish.GetName();
                    try
                    {
                        neworder.AddDish(newkitchen.GetDishByName(name));
                    }
                    catch { }
                }
                newkitchen.AddOrder(order);
                if (isStarted)
                {
                    newkitchen.Continue(order);
                }
                else
                {
                    newkitchen.Start();
                }
            }
            foreach (Order order in newReadyOrders)
            {
                Order neworder = new Order();
                foreach (Dish dish in order.GetDishes())
                {
                    neworder.AddDish(dish);
                }
                newkitchen.AddOrder(order);
            }
            foreach (Cooker cook in this.cookers)
            {
                newkitchen.AddCooker((Cooker)cook.Clone());
            }
            newkitchen.TimePoint = this.TimePoint;
            return(newkitchen);
        }
コード例 #3
0
 public void SetKitchen(Kitchen kitchen)
 {
     this.kitchen = kitchen;
 }
コード例 #4
0
 public void ResetKitchen(Kitchen newkitchen)
 {
     this.kitchen = newkitchen;
 }
コード例 #5
0
 public void SetPropsAfterJDeserealization(Kitchen kitchen)
 {
     this.dishes = this.dishesArr.ToList();
     this.idS    = this.id.ToString();
     this.SetKitchen(kitchen);
 }