POssibiliter Grupe: Renomer, supprimer, créer, ajouter des Etudiant
This commit is contained in:
@@ -32,8 +32,8 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
* @param g le groupe (methode récursive)
|
||||
*/
|
||||
private void addSousGroupe(Groupe g){
|
||||
this.brain.put(g.getId(), g);
|
||||
for(Groupe s:g.getSousGroupes()){
|
||||
this.brain.put(g.getId(), g);
|
||||
this.addSousGroupe(s);
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
if (this.getPromotion().equals(g)){
|
||||
throw new IllegalArgumentException("Impossible de détruire le groupe de toute la promotion");
|
||||
}
|
||||
if (g.getSize()>0){
|
||||
if (g.getSousGroupes().size()>0){
|
||||
throw new IllegalStateException("Impossible de détruire un groupe contenant un groupe");
|
||||
}
|
||||
g.getPointPoint().removeSousGroupe(g);
|
||||
|
@@ -22,6 +22,19 @@ public class EtudiantNP implements Etudiant{
|
||||
this.nom=nom;
|
||||
this.prenom=prenom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur.
|
||||
*/
|
||||
public EtudiantNP(String nom, String prenom, int id){
|
||||
Objects.requireNonNull(nom,"On ne peut pas créer un étudiant avec un nom null");
|
||||
Objects.requireNonNull(prenom,"On ne peut pas créer un étudiant avec un nom null");
|
||||
// auto incrément de l'id
|
||||
this.id=id;
|
||||
this.nextId++;
|
||||
this.nom=nom;
|
||||
this.prenom=prenom;
|
||||
}
|
||||
|
||||
/**
|
||||
* permet de récupérer l'identifiant de l'étudiant.
|
||||
|
@@ -207,6 +207,14 @@ public class GroupeNP implements Groupe {
|
||||
public Set<Etudiant> getEtudiants(){
|
||||
return this.membresDuGroupe;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change le nom du groupe
|
||||
* @param s le nouveau nom
|
||||
*/
|
||||
@Override
|
||||
public void setName(String s){
|
||||
this.name=s;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user