31 lines
693 B
Java
31 lines
693 B
Java
import java.util.LinkedList;
|
|
import java.util.Queue;
|
|
|
|
public class Stand_de_cuisson {
|
|
private Queue<Client> clients = new LinkedList<Client>();
|
|
|
|
|
|
//get le client en tête de queue
|
|
public synchronized Client getClient(){
|
|
return clients.peek();
|
|
}
|
|
|
|
//supprime le client en tête de queue
|
|
public synchronized void nextClient(){
|
|
clients.poll();
|
|
}
|
|
|
|
public synchronized void finir_cuit(){
|
|
notifyAll();
|
|
}
|
|
|
|
public synchronized void ajouter_client(Client client){
|
|
clients.add(client);
|
|
notifyAll();
|
|
}
|
|
|
|
public synchronized boolean containsClient(Client client){
|
|
return this.clients.contains(client);
|
|
}
|
|
}
|