Revert "le Client utilise un sméaphore pour cuir son plat"
This reverts commit 1a0c808353
This commit is contained in:
@@ -1,11 +1,30 @@
|
||||
public class Stand_de_cuisson {
|
||||
private Cuisinier cuisinier;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
Stand_de_cuisson(Cuisinier cuisinier){
|
||||
this.cuisinier = cuisinier;
|
||||
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();
|
||||
}
|
||||
|
||||
public synchronized void faire_cuire_plat(Client client){
|
||||
this.cuisinier.faire_cuire(client);
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user