From bc8611b6b67ac31c630dc90c4ac931d9e0ab99ea Mon Sep 17 00:00:00 2001 From: trochas Date: Tue, 3 Dec 2024 15:41:06 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20print=20pour=20suivre=20l'=C3=A9volutio?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.java | 4 ++++ src/Compartiment.java | 1 + src/Employe_du_buffet.java | 1 + 3 files changed, 6 insertions(+) diff --git a/src/Client.java b/src/Client.java index 0a61387..03b60e1 100644 --- a/src/Client.java +++ b/src/Client.java @@ -48,6 +48,7 @@ public class Client extends Thread { while(!restaurant.libre()){ this.wait(); } + System.out.println("Clien " + Thread.currentThread().getId() + " : est entré dans le restaurant"); restaurant.ajouterClient(); restaurant.notifyAll(); }catch (InterruptedException e) { @@ -58,6 +59,7 @@ public class Client extends Thread { public void manger(){ try{ + System.out.println("Clien " + Thread.currentThread().getId() + " : mange"); long temps_manger =new Random().nextInt(2000 - 1000) + 1000; Thread.sleep(temps_manger); }catch(InterruptedException e){ @@ -67,6 +69,7 @@ public class Client extends Thread { public void sort(){ synchronized(restaurant){ + System.out.println("Clien " + Thread.currentThread().getId() + " : sortir"); restaurant.diminuerClient(); restaurant.notifyAll(); } @@ -79,6 +82,7 @@ public class Client extends Thread { while (stand.attendClient()!= this) { //Verify s'il est meme client wait(); } + System.out.println("Clien " + Thread.currentThread().getId() + " : fait cuir son plat"); stand.finir_cuit(this); }catch (InterruptedException e){ e.printStackTrace(); diff --git a/src/Compartiment.java b/src/Compartiment.java index 42ebfab..15a9f0e 100644 --- a/src/Compartiment.java +++ b/src/Compartiment.java @@ -1,6 +1,7 @@ public class Compartiment{ protected final int QUANTITE_MAX = 1000; private int quantite_courant; + private String name; Compartiment(){ quantite_courant = 0; diff --git a/src/Employe_du_buffet.java b/src/Employe_du_buffet.java index ccca0ca..9da2e4d 100644 --- a/src/Employe_du_buffet.java +++ b/src/Employe_du_buffet.java @@ -10,6 +10,7 @@ public class Employe_du_buffet extends Thread{ while(true){ for(int i = 0; i