64 lines
1.5 KiB
Java
64 lines
1.5 KiB
Java
package travaux;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
public class Salle {
|
|
|
|
//-------------------------------------------------------------------------
|
|
// PROPRIETES
|
|
private String numero; // lecture/écriture
|
|
|
|
// traduction de l'association entre une salle et ses ouvertures
|
|
private ArrayList<Ouverture> listeOuvertures;
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
// CONSTRUCTEURS
|
|
public Salle() {
|
|
listeOuvertures = new ArrayList<Ouverture>(); // ne pas oublier ce new
|
|
numero = "NC"; // NC pour "non connu"
|
|
}
|
|
|
|
public Salle(String num) {
|
|
listeOuvertures = new ArrayList<Ouverture>(); // ne pas oublier ce new
|
|
numero = num;
|
|
}
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
// METHODES "INTELLIGENTES"
|
|
public void afficherInfos() {
|
|
System.out.println("Salle numero : " + numero);
|
|
System.out.println("Ouvertures : ");
|
|
|
|
// Affichage des infos de toutes les ouvertures :
|
|
// parcours de la liste, et on demander à chaque ouverture de s'afficher
|
|
for (Ouverture ouv : listeOuvertures) {
|
|
ouv.afficherInfos();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
// METHODES D'ACCES
|
|
|
|
public void ajouterOuverture(Ouverture ouv) {
|
|
listeOuvertures.add(ouv);
|
|
}
|
|
|
|
public void supprimerOuverture(Ouverture ouv) {
|
|
listeOuvertures.remove(ouv);
|
|
}
|
|
|
|
public String getNumero() {
|
|
return numero;
|
|
}
|
|
|
|
|
|
public void setNumero(String numero) {
|
|
this.numero = numero;
|
|
}
|
|
|
|
|
|
} |