31 lines
840 B
Java
31 lines
840 B
Java
public class Restaurant {
|
|
protected final int MAX_CLIENTS = 25;
|
|
private int nbClient = 0;
|
|
|
|
|
|
private Compartiment compPoisson = new Compartiment();
|
|
private Compartiment compViande = new Compartiment();
|
|
private Compartiment compLegume = new Compartiment();
|
|
private Compartiment compNouille = new Compartiment();
|
|
|
|
Employe_du_buffet employeB = new Employe_du_buffet(compPoisson,compViande,compLegume,compNouille);
|
|
|
|
public synchronized boolean libre(){
|
|
if(nbClient>MAX_CLIENTS){
|
|
return false;
|
|
}else {
|
|
return true;
|
|
}
|
|
}
|
|
public synchronized void ajouterClient(){
|
|
if(nbClient<MAX_CLIENTS){
|
|
nbClient++;
|
|
}
|
|
}
|
|
|
|
public synchronized void diminuerClient(){
|
|
if(nbClient<MAX_CLIENTS){
|
|
nbClient++;
|
|
}
|
|
}
|
|
} |