suppression Employe + impl Employe du buffet

This commit is contained in:
trochas
2024-11-28 12:02:22 +01:00
parent d73649f77f
commit b19cdd0d40
4 changed files with 24 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
import java.util.Random; import java.util.Random;
public class Cuisinier extends Employe { public class Cuisinier extends Thread {
private Stand_de_cuisson stand; private Stand_de_cuisson stand;
public Cuisinier(Stand_de_cuisson stand_de_cuisson){ public Cuisinier(Stand_de_cuisson stand_de_cuisson){

View File

@@ -1,3 +0,0 @@
public class Employe extends Thread {
}

View File

@@ -1,18 +1,18 @@
public class Employe_du_buffet extends Employe{ public class Employe_du_buffet extends Thread{
public Compartiment[] buffet;
private Compartiment compPoisson; Employe_du_buffet(Compartiment[] buffet){
private Compartiment compViande; this.buffet = buffet;
private Compartiment compLegume;
private Compartiment compNouille;
Employe_du_buffet(Compartiment compPoisson,Compartiment compViande,Compartiment compLegume,Compartiment compNouille){
this.compPoisson = compPoisson;
this.compViande = compViande;
this.compLegume = compViande;
this.compNouille = compNouille;
} }
public void run(){
while(true){
for(int i = 0; i<buffet.length;i++){
if(buffet[i].getQuantite()<100){
buffet[i].remplir();
}
}
}
}
} }

View File

@@ -1,14 +1,17 @@
public class Restaurant { public class Restaurant {
protected final int MAX_CLIENTS = 25; protected final int MAX_CLIENTS = 25;
private int nbClient = 0; private int nbClient;
private Compartiment[] buffet = new Compartiment[4];
private Employe_du_buffet employeB;
private Compartiment compPoisson = new Compartiment(); Restaurant(){
private Compartiment compViande = new Compartiment(); nbClient = 0;
private Compartiment compLegume = new Compartiment(); for(int i = 0 ; i<buffet.length; i++){
private Compartiment compNouille = new Compartiment(); this.buffet[i] = new Compartiment();
}
Employe_du_buffet employeB = new Employe_du_buffet(compPoisson,compViande,compLegume,compNouille); employeB = new Employe_du_buffet(buffet);
}
public synchronized boolean libre(){ public synchronized boolean libre(){
if(nbClient>MAX_CLIENTS){ if(nbClient>MAX_CLIENTS){