Browse Source

démêlés divers avec AccessRestrictions

Favary Pierre 2 years ago
parent
commit
65a01d5936

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

10
 import java.io.FileNotFoundException;
10
 import java.io.FileNotFoundException;
11
 import java.io.IOException;
11
 import java.io.IOException;
12
 import java.util.Arrays;
12
 import java.util.Arrays;
13
+import java.util.EnumMap;
13
 
14
 
14
 import org.insa.graphs.algorithm.ArcInspector;
15
 import org.insa.graphs.algorithm.ArcInspector;
15
 import org.insa.graphs.algorithm.ArcInspectorFactory;
16
 import org.insa.graphs.algorithm.ArcInspectorFactory;
16
 import org.insa.graphs.model.*;
17
 import org.insa.graphs.model.*;
17
 import org.insa.graphs.model.AccessRestrictions.AccessMode;
18
 import org.insa.graphs.model.AccessRestrictions.AccessMode;
19
+import org.insa.graphs.model.AccessRestrictions.AccessRestriction;
18
 import org.insa.graphs.model.RoadInformation.RoadType;
20
 import org.insa.graphs.model.RoadInformation.RoadType;
19
 import org.insa.graphs.model.io.BinaryGraphReader;
21
 import org.insa.graphs.model.io.BinaryGraphReader;
20
 import org.insa.graphs.model.io.BinaryPathReader;
22
 import org.insa.graphs.model.io.BinaryPathReader;
52
     @BeforeClass
54
     @BeforeClass
53
     public static void initAll() throws IOException {
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
         //cyclable = new RoadInformation(RoadType.CYCLEWAY, null, false, 20, ""),
69
         //cyclable = new RoadInformation(RoadType.CYCLEWAY, null, false, 20, ""),
59
         //toutes les routes ici sont à double sens
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
         // Create nodes
72
         // Create nodes
63
         nodes = new Node[8];
73
         nodes = new Node[8];

Loading…
Cancel
Save