diff --git a/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java b/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java
index 7580981..dae1a5a 100644
--- a/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java
+++ b/be-graphes-model/src/main/java/org/insa/graphs/model/Path.java
@@ -1,8 +1,7 @@
package org.insa.graphs.model;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import java.awt.RenderingHints;
+import java.util.*;
/**
*
@@ -48,7 +47,10 @@ public class Path {
public static Path createShortestPathFromNodes(Graph graph, List nodes)
throws IllegalArgumentException {
List arcs = new ArrayList();
- // TODO:
+ // TODO: en fonction des mètres
+ Boolean fini = false;
+
+
return new Path(graph, arcs);
}
@@ -184,11 +186,31 @@ public class Path {
*
*
* @return true if the path is valid, false otherwise.
- * @deprecated Need to be implemented.
*/
public boolean isValid() {
- // TODO:
- return false;
+
+ if (this.isEmpty()) {// Vérifie si le path est vide
+ return true;
+ }
+
+ if (this.arcs.isEmpty()) {// Vérifie si la liste d'arcs est vide
+ return true;
+ }
+
+ // Vérifie que le premier arc a pour origine le point de départ de la path
+ if (!this.origin.equals(this.arcs.get(0).getOrigin())) {
+ return false;
+ }
+
+ // Vérifie la continuité entre les arcs
+ for (int i = 0; i < this.arcs.size() - 1; i++) {
+ if (!this.arcs.get(i).getDestination()
+ .equals(this.arcs.get(i + 1).getOrigin())) {
+ return false;
+ }
+ }
+
+ return true;
}
/**