SHOW:
|
|
- or go back to the newest paste.
| 1 | public static void enConflitAvecTous(){
| |
| 2 | - | Relation enConflit = estEnConflitAvec().clone(); |
| 2 | + | Relation enConflit = estEnConflitAvec().clone(); |
| 3 | - | Ensemble coursEnConflitAvecTous = new Ensemble(); |
| 3 | + | Ensemble coursEnConflitAvecTous = new Ensemble(); |
| 4 | - | Iterator<Elt> it = enConflit.depart().iterator(); |
| 4 | + | Iterator<Elt> it = enConflit.depart().iterator(); |
| 5 | - | while (it.hasNext()){
|
| 5 | + | while (it.hasNext()){
|
| 6 | - | boolean enConflitAvecTous = true; |
| 6 | + | boolean enConflitAvecTous = true; |
| 7 | - | Elt cours = it.next(); |
| 7 | + | Elt cours = it.next(); |
| 8 | - | Iterator<Elt> it2 = enConflit.arrivee().iterator(); |
| 8 | + | Iterator<Elt> it2 = enConflit.arrivee().iterator(); |
| 9 | - | while (it2.hasNext()){
|
| 9 | + | while (it2.hasNext()){
|
| 10 | - | Elt coursEnParcours = it2.next(); |
| 10 | + | Elt coursEnParcours = it2.next(); |
| 11 | - | Couple c = new Couple(cours, coursEnParcours); |
| 11 | + | Couple c = new Couple(cours, coursEnParcours); |
| 12 | - | if (!enConflit.contient(c)){
|
| 12 | + | if (!enConflit.contient(c)){
|
| 13 | - | enConflitAvecTous = false; |
| 13 | + | enConflitAvecTous = false; |
| 14 | - | } |
| 14 | + | |
| 15 | } | |
| 16 | - | if (enConflitAvecTous){
|
| 16 | + | if (enConflitAvecTous){
|
| 17 | - | coursEnConflitAvecTous.ajouter(cours); |
| 17 | + | coursEnConflitAvecTous.ajouter(cours); |
| 18 | } | |
| 19 | } | |
| 20 | - | System.out.println("Cours en conflit avec tous les autres : ");
|
| 20 | + | System.out.println("Cours en conflit avec tous les autres : ");
|
| 21 | - | lister(coursEnConflitAvecTous, "COURS"); |
| 21 | + | lister(coursEnConflitAvecTous, "COURS"); |
| 22 | - | } |
| 22 | + | } |