21 lines
395 B
Java
21 lines
395 B
Java
public class Compartiment{
|
|
protected final int QUANTITE_MAX = 1000;
|
|
private int quantite_courant;
|
|
|
|
Compartiment(){
|
|
quantite_courant = 0;
|
|
}
|
|
|
|
synchronized void remplir(){
|
|
quantite_courant = QUANTITE_MAX;
|
|
}
|
|
|
|
synchronized void servir(int qte){
|
|
quantite_courant -= qte;
|
|
}
|
|
|
|
public int getQuantite(){
|
|
return quantite_courant;
|
|
}
|
|
}
|