From 8a304e8807ffe6eaee1b51e046dd762e5db319a0 Mon Sep 17 00:00:00 2001 From: Bezza Younes Date: Fri, 11 Apr 2025 10:49:13 +0200 Subject: [PATCH] =?UTF-8?q?r=C3=A9solution=20de=20conflit=20apr=C3=A8s=20s?= =?UTF-8?q?tash=20pop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/insa/graphs/model/Path.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 c1c1f0b..92799cf 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 @@ -34,11 +34,14 @@ public class Path { public static Path createFastestPathFromNodes(Graph graph, List nodes) throws IllegalArgumentException { - if (nodes == null || nodes.isEmpty()) + if (nodes == null || nodes.isEmpty()) { return new Path(graph); - if (nodes.size() == 1) - return new Path(graph, nodes.get(0)); - + // throw new IllegalArgumentException("La liste des nodes est vide"); ici il + // ne faut pas throw une erreur mais return un chemin vide. + } + if (nodes.size() == 1) { + return new Path(graph, nodes.get(0)); /* chemin de 1 point(node) */ + } ArrayList finalList = new ArrayList<>(); for (int i = 0; i < nodes.size() - 1; i++) {