This repository was archived by the owner on Oct 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommande.java
More file actions
45 lines (35 loc) · 1.48 KB
/
Commande.java
File metadata and controls
45 lines (35 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.ArrayList;
public class Commande {
protected int numeroDeCommande;
protected boolean pret = false;
protected ArrayList<Plat> listeDesPlatsCommandes = new ArrayList<Plat>();
protected ArrayList<Boisson> listeDesBoissonsCommandees = new ArrayList<Boisson>();
protected double addition = 0;
//Creation d'une commande
public Commande(int numeroDeCommande) {
this.numeroDeCommande = numeroDeCommande;
}
public double getAddition() { return this.addition; }
public boolean isPret() { return this.pret; }
public ArrayList<Plat> getPlat() { return this.listeDesPlatsCommandes; }
public ArrayList<Boisson> getBoisson() { return this.listeDesBoissonsCommandees; }
public void setPret(boolean bool) { this.pret = bool; }
// Ajout d'un plat à la commande
public void ajoutPlatALaCommande(Plat newPlat) {
listeDesPlatsCommandes.add(newPlat);
}
// Ajout d'une boisson à la commande
public void ajoutBoissonALaCommande(Boisson newBoisson) {
listeDesBoissonsCommandees.add(newBoisson);
}
public ArrayList<Ingredients> getAllIngredientsFromPlat(){
ArrayList<Ingredients> retListOfIngredients = new ArrayList<Ingredients>();
for (int i = 0; i < listeDesPlatsCommandes.size(); i++) {
for (int j = 0; j < listeDesPlatsCommandes.get(i).listeDIngredient.length; j++) {
// System.out.println(listeDesPlatsCommandes.get(i).listeDIngredient[j]);
retListOfIngredients.add(listeDesPlatsCommandes.get(i).listeDIngredient[j]);
}
}
return retListOfIngredients;
}
}