Exemplo n.º 1
0
        public int GetTempOrderTime(Order order)
        {
            Kitchen tempkitchen = (Kitchen)this.Clone();

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

            return(res);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
 public void SetKitchen(Kitchen kitchen)
 {
     this.kitchen = kitchen;
 }
Exemplo n.º 4
0
 public void ResetKitchen(Kitchen newkitchen)
 {
     this.kitchen = newkitchen;
 }
Exemplo n.º 5
0
 public void SetPropsAfterJDeserealization(Kitchen kitchen)
 {
     this.dishes = this.dishesArr.ToList();
     this.idS    = this.id.ToString();
     this.SetKitchen(kitchen);
 }