public int GetTempOrderTime(Order order) { Kitchen tempkitchen = (Kitchen)this.Clone(); tempkitchen.AddOrder(order); tempkitchen.Start(); int res = tempkitchen.CheckOrder(order); return(res); }
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); }
public void SetKitchen(Kitchen kitchen) { this.kitchen = kitchen; }
public void ResetKitchen(Kitchen newkitchen) { this.kitchen = newkitchen; }
public void SetPropsAfterJDeserealization(Kitchen kitchen) { this.dishes = this.dishesArr.ToList(); this.idS = this.id.ToString(); this.SetKitchen(kitchen); }