54 lines
1.4 KiB
C#
54 lines
1.4 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;
|
|
private int crossoverTime;
|
|
|
|
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(int averageWaitingTime, int CrossoverTime)
|
|
{
|
|
if (!Open && averageWaitingTime > CrossoverTime)
|
|
{
|
|
Open = true;
|
|
}
|
|
if (Open && averageWaitingTime < CrossoverTime && Clients.Count == 0)
|
|
{
|
|
Open = false;
|
|
}
|
|
/*
|
|
if (Clients.Count != 0)
|
|
{
|
|
//This is the first client inline
|
|
Client client = Clients[0];
|
|
if (client.State == Client.ClientState.Inline)
|
|
client.State = Client.ClientState.Checkout;
|
|
|
|
|
|
if (client.CheckoutTime <= 0)
|
|
{
|
|
I think we need to do this processing in the store
|
|
}
|
|
|
|
}
|
|
*/
|
|
}
|
|
}
|
|
}
|