public boolean besoinRafraichirIti(Route routeDevientIndispo) { // Si la ville devient indispo et que l'user a son itinéraire qui y passe for (Troncon unTroncon : theProgps.getSonUser().getItineraireCourant().getLesTroncons()) { if (unTroncon.getSaRoute().equals(routeDevientIndispo)) return true; } return false; }
public static void comparerTroncons(Troncon tronconATester, Troncon tronconType) { comparerTronconsPrimitives(tronconATester, tronconType); Intersection intersectionArriveeATester = tronconATester.getArrivee(); Intersection intersectionArriveeType = tronconType.getArrivee(); assertNotNull(intersectionArriveeATester); assertNotNull(intersectionArriveeType); IntersectionTest.comparerIntersectionsPrimitives( intersectionArriveeATester, intersectionArriveeType); }
public static boolean comparerTronconsBool(Troncon tronconATester, Troncon tronconType) { if (!comparerTronconsPrimitivesBool(tronconATester, tronconType)) { return false; } Intersection intersectionArriveeATester = tronconATester.getArrivee(); Intersection intersectionArriveeType = tronconType.getArrivee(); return (intersectionArriveeATester != null && intersectionArriveeType != null && IntersectionTest.comparerIntersectionsPrimitivesBool( intersectionArriveeATester, intersectionArriveeType)); }
@Test public void testDuree() { Chemin chemin = new Chemin(); // Si le chemin ne contient aucun troncon, la duree retournée est 0. assertEquals("La duree n'est pas de 0.", 0.0, chemin.getDuree(), 0.0); // On ajoute des Troncons. Intersection intersection1 = new Intersection(1, 0, 0); Intersection intersection2 = new Intersection(2, 0, 10); Intersection intersection3 = new Intersection(3, 10, 10); Troncon troncon1 = new Troncon(intersection1, intersection2, "Troncon1", 10.0, 1.0); Troncon troncon2 = new Troncon(intersection2, intersection3, "Troncon2", 10.0, 1.0); chemin.ajouterTronconDebut(troncon2); chemin.ajouterTronconDebut(troncon1); // On teste si la duree retourne par le chemin est bien la somme des durees des deux troncons. assertEquals( "La duree du chemin n'est pas bonne.", troncon1.getDuree() + troncon2.getDuree(), chemin.getDuree(), 0.0); }
public static void comparerTronconsPrimitives(Troncon tronconATester, Troncon tronconType) { assertNotNull(tronconATester); assertNotNull(tronconType); assertEquals(tronconATester.getVitesse(), tronconType.getVitesse(), EPSILON); assertEquals(tronconATester.getLongueur(), tronconType.getLongueur(), EPSILON); assertEquals(tronconATester.getNom(), tronconType.getNom()); }
public static boolean comparerTronconsPrimitivesBool( Troncon tronconATester, Troncon tronconType) { return (tronconATester != null && tronconType != null && Math.abs(tronconATester.getVitesse() - tronconType.getVitesse()) < EPSILON && Math.abs(tronconATester.getLongueur() - tronconType.getLongueur()) < EPSILON && tronconATester.getNom().equals(tronconType.getNom())); }