Mise en place de la méthode getLength

This commit is contained in:
Sabben Matteo 2025-04-04 09:44:28 +02:00
parent c539e72f6b
commit 79dc211f95
2 changed files with 9 additions and 4 deletions

View file

@ -311,7 +311,8 @@ public abstract class PriorityQueueTest {
Assume.assumeFalse(queue.isEmpty()); Assume.assumeFalse(queue.isEmpty());
int min = Collections.min(Arrays.asList(parameters.data)).get(); int min = Collections.min(Arrays.asList(parameters.data)).get();
for (MutableInteger mi : parameters.data) { for (MutableInteger mi : parameters.data) {
// Update value before removing it. This is what happens when updating a Dijkstra label before updating it. // Update value before removing it. This is what happens when updating a
// Dijkstra label before updating it.
mi.set(--min); mi.set(--min);
queue.remove(mi); queue.remove(mi);
assertEquals(parameters.data.length - 1, queue.size()); assertEquals(parameters.data.length - 1, queue.size());

View file

@ -30,7 +30,8 @@ public class Path {
public static Path createFastestPathFromNodes(Graph graph, List<Node> nodes) public static Path createFastestPathFromNodes(Graph graph, List<Node> nodes)
throws IllegalArgumentException { throws IllegalArgumentException {
List<Arc> arcs = new ArrayList<Arc>(); List<Arc> arcs = new ArrayList<Arc>();
// TODO: // TODO : faut faire en fct du maxspeed ds road information
return new Path(graph, arcs); return new Path(graph, arcs);
} }
@ -198,8 +199,11 @@ public class Path {
* @deprecated Need to be implemented. * @deprecated Need to be implemented.
*/ */
public float getLength() { public float getLength() {
// TODO: float pathLength=0f; // sinon error si on met O.O
return 0; for (Arc element : this.arcs) {
pathLength=pathLength+((float) element.getLength());
}
return pathLength;
} }
/** /**