init commint
This commit is contained in:
56
Salle.java
Normal file
56
Salle.java
Normal file
@@ -0,0 +1,56 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user