Browse Source

démêlés divers avec AccessRestrictions

Favary Pierre 6 months ago
parent
commit
65a01d5936

+ 14
- 4
be-graphes-algos/src/test/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithmTest.java View File

@@ -10,11 +10,13 @@ import java.io.FileInputStream;
10 10
 import java.io.FileNotFoundException;
11 11
 import java.io.IOException;
12 12
 import java.util.Arrays;
13
+import java.util.EnumMap;
13 14
 
14 15
 import org.insa.graphs.algorithm.ArcInspector;
15 16
 import org.insa.graphs.algorithm.ArcInspectorFactory;
16 17
 import org.insa.graphs.model.*;
17 18
 import org.insa.graphs.model.AccessRestrictions.AccessMode;
19
+import org.insa.graphs.model.AccessRestrictions.AccessRestriction;
18 20
 import org.insa.graphs.model.RoadInformation.RoadType;
19 21
 import org.insa.graphs.model.io.BinaryGraphReader;
20 22
 import org.insa.graphs.model.io.BinaryPathReader;
@@ -52,12 +54,20 @@ public class DijkstraAlgorithmTest{
52 54
     @BeforeClass
53 55
     public static void initAll() throws IOException {
54 56
 
55
-        RoadInformation speed10 = new RoadInformation(RoadType.MOTORWAY, null, false, 36, ""),
56
-                speed20 = new RoadInformation(RoadType.MOTORWAY, null, false, 72, ""),
57
-                pietonable = new RoadInformation(RoadType.PEDESTRIAN, null, false, 5, "");
57
+    	//gestion des restrictions pour pouvoir créer les Bellman-Ford
58
+    	AccessRestrictions voiture, pedestre;
59
+    	AccessRestrictions.AccessRestriction authorise = AccessRestrictions.AccessRestriction.ALLOWED;
60
+    	EnumMap<AccessMode, AccessRestrictions.AccessRestriction> pmap = null, vmap = null;
61
+    	pmap.put(AccessMode.FOOT, authorise);
62
+    	vmap.put(AccessMode.MOTORCAR, authorise);
63
+    	pedestre = new AccessRestrictions(pmap);
64
+    	voiture = new AccessRestrictions(vmap);
65
+    	
66
+        RoadInformation speed10 = new RoadInformation(RoadType.MOTORWAY, voiture, false, 36, ""),
67
+                speed20 = new RoadInformation(RoadType.MOTORWAY, voiture, false, 72, ""),
68
+                pietonable = new RoadInformation(RoadType.PEDESTRIAN, pedestre, false, 5, "");
58 69
         //cyclable = new RoadInformation(RoadType.CYCLEWAY, null, false, 20, ""),
59 70
         //toutes les routes ici sont à double sens
60
-        //visiblement un problème ave le deuxième argument null, comment gérer les restrictions?
61 71
         
62 72
         // Create nodes
63 73
         nodes = new Node[8];

Loading…
Cancel
Save