From 3dcba7891bc71472a1df4996e61871c33e25519b Mon Sep 17 00:00:00 2001 From: Nabzzz Date: Mon, 16 Mar 2020 12:05:23 +0100 Subject: [PATCH] modified: getLength(), getMinimumTravelTime(), getTravelTime() --- .../main/java/org/insa/graphs/model/Path.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 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 6ebdb73..42b20df 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 @@ -210,11 +210,14 @@ public class Path { * * @return Total length of the path (in meters). * - * @deprecated Need to be implemented. */ public float getLength() { - // TODO: - return 0; + float total_length=0; + for (Arc arc: this.arcs) + { + total_length+=arc.getLength(); + } + return total_length; } /** @@ -225,11 +228,11 @@ public class Path { * @return Time (in seconds) required to travel this path at the given speed (in * kilometers-per-hour). * - * @deprecated Need to be implemented. */ public double getTravelTime(double speed) { - // TODO: - return 0; + + + return ((double) this.getLength())/(speed/3.6); } /** @@ -238,11 +241,15 @@ public class Path { * * @return Minimum travel time to travel this path (in seconds). * - * @deprecated Need to be implemented. + */ public double getMinimumTravelTime() { - // TODO: - return 0; + float total_time=0; + for(Arc arc:this.arcs) + { + total_time+=arc.getMinimumTravelTime(); + } + return total_time; } }