public void go() { try { System.out.println("**"); System.out.println("** Programme de test des algorithmes de graphe."); System.out.println("**"); System.out.println(); // On obtient ici le nom de la carte a utiliser. String nomcarte = this.readarg.lireString("Nom du fichier .map a utiliser ? "); DataInputStream mapdata = Openfile.open(nomcarte); boolean display = (1 == this.readarg.lireInt("Voulez-vous une sortie graphique (0 = non, 1 = oui) ? ")); Dessin dessin = (display) ? new DessinVisible(800, 600) : new DessinInvisible(); Graphe graphe = new Graphe(nomcarte, mapdata, dessin); // Boucle principale : le menu est accessible // jusqu'a ce que l'on quitte. boolean continuer = true; int choix; while (continuer) { this.afficherMenu(); choix = this.readarg.lireInt("Votre choix ? "); // Algorithme a executer Algo algo = null; // Le choix correspond au numero du menu. switch (choix) { case 0: continuer = false; break; case 1: algo = new Connexite(graphe, this.fichierSortie(), this.readarg); break; case 2: algo = new Pcc(graphe, this.fichierSortie(), this.readarg); break; case 3: algo = new PccStar(graphe, this.fichierSortie(), this.readarg); break; case 4: algo = new Esclave(graphe, System.out, this.readarg); continuer = false; break; case 5: graphe.situerClick(); break; case 6: String nom_chemin = this.readarg.lireString("Nom du fichier .path contenant le chemin ? "); graphe.verifierChemin(Openfile.open(nom_chemin), nom_chemin); break; default: System.out.println("Choix de menu incorrect : " + choix); System.exit(1); } if (algo != null) { algo.run(); } } System.out.println("Programme termine."); System.exit(0); } catch (Throwable t) { t.printStackTrace(); System.exit(1); } }