56 lines
1.4 KiB
Java
56 lines
1.4 KiB
Java
|
package Monpack2;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
|
||
|
public class Salle {
|
||
|
|
||
|
private int numero;
|
||
|
public ArrayList<Ouverture> listeOuvertures = new ArrayList<Ouverture>();
|
||
|
public void afficherInfosOuvertures() {
|
||
|
// TODO - implement Salle.afficherInfosOuvertures
|
||
|
//throw new UnsupportedOperationException();
|
||
|
for(Ouverture OuvertureCourantes: listeOuvertures) {
|
||
|
OuvertureCourantes.afficherInfos();
|
||
|
}
|
||
|
}
|
||
|
public void ajouterOuverture(Ouverture Ouv) {
|
||
|
listeOuvertures.add(Ouv);
|
||
|
|
||
|
}
|
||
|
|
||
|
public int getNumero() {
|
||
|
return numero;
|
||
|
}
|
||
|
|
||
|
public void setNumero(int numero) {
|
||
|
this.numero = numero;
|
||
|
}
|
||
|
|
||
|
public ArrayList<Ouverture> getOuverturesAvecPlusDeKTechniciens(int k) {
|
||
|
ArrayList<Ouverture> result = new ArrayList<>();
|
||
|
for (Ouverture o : listeOuvertures) {
|
||
|
if (o.getTechniciens().size() > k) {
|
||
|
result.add(o);
|
||
|
}
|
||
|
}
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
public int getSommeLargeurOuverturesParTechnicien(Technicien t) {
|
||
|
int somme = 0;
|
||
|
for (Ouverture o : listeOuvertures) {
|
||
|
if (o.getTechniciens().contains(t)) {
|
||
|
somme += o.getLargeur();
|
||
|
}
|
||
|
}
|
||
|
return somme;
|
||
|
}
|
||
|
public void afficherInfos() {
|
||
|
// TODO - implement Salle.afficherInfos
|
||
|
//throw new UnsupportedOperationException();
|
||
|
System.out.println("Numero de la salle: " + this.getNumero());
|
||
|
System.out.println("Liste des ouvertures: ");
|
||
|
this.afficherInfosOuvertures();
|
||
|
}
|
||
|
|
||
|
}
|