From 65a01d5936406a00c3cd3fa4f27de42d7138558e Mon Sep 17 00:00:00 2001 From: Favary Pierre Date: Sun, 16 May 2021 15:53:50 +0200 Subject: [PATCH] =?UTF-8?q?d=C3=A9m=C3=AAl=C3=A9s=20divers=20avec=20Access?= =?UTF-8?q?Restrictions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shortestpath/DijkstraAlgorithmTest.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java b/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java index fe7aa79..5eb0bbd 100644 --- a/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java +++ b/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java @@ -10,11 +10,13 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Arrays; +import java.util.EnumMap; import org.insa.graphs.algorithm.ArcInspector; import org.insa.graphs.algorithm.ArcInspectorFactory; import org.insa.graphs.model.*; import org.insa.graphs.model.AccessRestrictions.AccessMode; +import org.insa.graphs.model.AccessRestrictions.AccessRestriction; import org.insa.graphs.model.RoadInformation.RoadType; import org.insa.graphs.model.io.BinaryGraphReader; import org.insa.graphs.model.io.BinaryPathReader; @@ -52,12 +54,20 @@ public class DijkstraAlgorithmTest{ @BeforeClass public static void initAll() throws IOException { - RoadInformation speed10 = new RoadInformation(RoadType.MOTORWAY, null, false, 36, ""), - speed20 = new RoadInformation(RoadType.MOTORWAY, null, false, 72, ""), - pietonable = new RoadInformation(RoadType.PEDESTRIAN, null, false, 5, ""); + //gestion des restrictions pour pouvoir créer les Bellman-Ford + AccessRestrictions voiture, pedestre; + AccessRestrictions.AccessRestriction authorise = AccessRestrictions.AccessRestriction.ALLOWED; + EnumMap pmap = null, vmap = null; + pmap.put(AccessMode.FOOT, authorise); + vmap.put(AccessMode.MOTORCAR, authorise); + pedestre = new AccessRestrictions(pmap); + voiture = new AccessRestrictions(vmap); + + RoadInformation speed10 = new RoadInformation(RoadType.MOTORWAY, voiture, false, 36, ""), + speed20 = new RoadInformation(RoadType.MOTORWAY, voiture, false, 72, ""), + pietonable = new RoadInformation(RoadType.PEDESTRIAN, pedestre, false, 5, ""); //cyclable = new RoadInformation(RoadType.CYCLEWAY, null, false, 20, ""), //toutes les routes ici sont à double sens - //visiblement un problème ave le deuxième argument null, comment gérer les restrictions? // Create nodes nodes = new Node[8];