restauration de l'API et ajout de possibilité plusieur promo
This commit is contained in:
@@ -22,6 +22,20 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
this.promo=promo;
|
||||
this.brain=new HashMap<Integer,Groupe>();
|
||||
this.brain.put(Integer.valueOf(this.promo.getId()),this.promo);
|
||||
this.addSousGroupe(this.promo);
|
||||
}
|
||||
|
||||
/**
|
||||
* permet d'ajouter les sous groupe lors de l'initialisation de la promo
|
||||
* avec un groupe déja créer
|
||||
*
|
||||
* @param g le groupe (methode récursive)
|
||||
*/
|
||||
private void addSousGroupe(Groupe g){
|
||||
for(Groupe s:g.getSousGroupes()){
|
||||
this.brain.put(g.getId(), g);
|
||||
this.addSousGroupe(s);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,7 +222,6 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
public Set<Etudiant> getEtudiants(String nomEtu){
|
||||
Set<Etudiant> s=new LinkedHashSet<>();
|
||||
for(Etudiant e:this.getPromotion().getEtudiants()){
|
||||
//System.out.println("Comparaison de: \""+nomEtu.toLowerCase()+"\" a \"" + e.getNom().toLowerCase()+"\"");
|
||||
if((e.getNom()).equals(nomEtu.toString())){
|
||||
s.add(e);
|
||||
}
|
||||
@@ -237,16 +250,4 @@ public class AbstractGroupeFactoryNP implements AbstractGroupeFactory {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* permet d'ajouter un groupe deja tout fait la factory
|
||||
*
|
||||
* @param adable le groupe devant être ajouter
|
||||
*
|
||||
*
|
||||
* @throws java.lang.NullPointerException si le Groupe est null.
|
||||
*/
|
||||
public void addGroupe(Groupe adable) {
|
||||
this.brain.put(adable.getId(), adable);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user