init
This commit is contained in:
@@ -2,15 +2,12 @@ import java.util.Random;
|
||||
|
||||
public class Client extends Thread {
|
||||
private int MAX_PORTION = 100;
|
||||
protected Compartiment compartiment;
|
||||
protected Restaurant restaurant;
|
||||
|
||||
public Client (Compartiment c, Restaurant restaurant){
|
||||
this.compartiment=c;
|
||||
public Client (Restaurant restaurant){
|
||||
this.restaurant=restaurant;
|
||||
}
|
||||
|
||||
|
||||
public void prendre_portion(Compartiment compartiment){
|
||||
synchronized(compartiment){
|
||||
int r =new Random().nextInt(MAX_PORTION);
|
||||
@@ -59,4 +56,8 @@ public class Client extends Thread {
|
||||
restaurant.diminuerClient();
|
||||
restaurant.notifyAll();
|
||||
}
|
||||
|
||||
public void cuir_au_stand(Stand_de_cuisson stand){
|
||||
//stand.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
import java.util.Random;
|
||||
|
||||
public class Cuisinier extends Employe {
|
||||
|
||||
private Stand_de_cuisson stand;
|
||||
|
||||
public Cuisinier(Stand_de_cuisson stand_de_cuisson){
|
||||
this.stand= stand_de_cuisson;
|
||||
}
|
||||
|
||||
public void faire_cuire(Client client){
|
||||
try{
|
||||
long temps_cuire =new Random().nextInt(300 - 100) + 100;
|
||||
Thread.sleep(temps_cuire);
|
||||
}catch(InterruptedException e){
|
||||
System.out.println(e);
|
||||
}
|
||||
stand.finir_cuit();
|
||||
stand.notifyAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
public class Stand_de_cuisson extends Employe {
|
||||
|
||||
public class Stand_de_cuisson {
|
||||
public synchronized void finir_cuit(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user