Fin des Fonctionnalités demander, debut debogage et simplification

This commit is contained in:
2022-12-03 17:52:10 +01:00
parent 4e087ad4ba
commit 8dd7db7396
16 changed files with 473 additions and 16 deletions

View File

@@ -56,6 +56,7 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
* @return l'ensemble de tous les changements en attente
*/
public Set<Changement> getAllChangements(){
this.refresh();
// la méthode value() d'un hashmap retourne la collection des valeurs.
// Il faut transformer la collection en Set.
// Un constructeur de HashSet permet de faire cette opération.
@@ -85,7 +86,12 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
agf.dropFromGroupe(a,e);
agf.addToGroupe(b,e);
// En cas de succès, on enlève le changement du cerveau
this.brain.remove(Integer.valueOf(c.getId()));
this.deleteChangement(c);
for(Changement ch: this.getAllChangements()){
if(ch.getB().getSize()+1==ch.getB().getMax()){
this.deleteChangement(ch);
}
}
}
@@ -297,5 +303,10 @@ public class AbstractChangementFactoryNP implements AbstractChangementFactory {
}
}
private void refresh(){
this.brain=new HashMap<Integer,Changement>();
this.getChange();
}
}