Files
Std_Caisses/Caisses/Checkout.cs
T

37 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Caisses
{
internal class Checkout
{
public const int MAX_CAPACITY = 5;
private List<Client> clients;
private bool open;
public List<Client> Clients { get => clients; set => clients = value; }
public bool Open { get => open; set => open = value; }
public Checkout()
{
Clients = new List<Client>();
Open = false;
}
public void Tick(GraphicalStore store)
{
if (!Open && store.AverageWaitingTime > GraphicalStore.CROSSOVER_TIME && store.GetEmptyCheckoutCount() == 0 || store.OpenCheckoutCount == 0 || store.WaitingClients.Count > MAX_CAPACITY * 2 && store.GetEmptyCheckoutCount() == 0)
{
Open = true;
}
if (Open && store.AverageWaitingTime < 1 && Clients.Count == 0 && store.OpenCheckoutCount > 0)
{
Open = false;
}
}
}
}