Methode length , travelTime, minimumTravelTime
This commit is contained in:
parent
4bcb001c79
commit
4b708049d2
1 changed files with 15 additions and 8 deletions
|
@ -210,11 +210,15 @@ public class Path {
|
|||
*
|
||||
* @return Total length of the path (in meters).
|
||||
*
|
||||
* @deprecated Need to be implemented.
|
||||
* Need to be implemented.
|
||||
*/
|
||||
public float getLength() {
|
||||
// TODO:
|
||||
return 0;
|
||||
float total = 0;
|
||||
for (Arc a : this.arcs) {
|
||||
total += a.getLength();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -225,11 +229,12 @@ 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.
|
||||
* Need to be implemented.
|
||||
*/
|
||||
public double getTravelTime(double speed) {
|
||||
// TODO:
|
||||
return 0;
|
||||
double length = (double) this.getLength(); //length in meter
|
||||
double vitesse = speed/3.6 ; //speed in m/sec
|
||||
return length/vitesse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -238,11 +243,13 @@ public class Path {
|
|||
*
|
||||
* @return Minimum travel time to travel this path (in seconds).
|
||||
*
|
||||
* @deprecated Need to be implemented.
|
||||
* Need to be implemented.
|
||||
*/
|
||||
public double getMinimumTravelTime() {
|
||||
// TODO:
|
||||
return 0;
|
||||
double traveltime = 0;
|
||||
for (Arc a : this.arcs) {
|
||||
traveltime += a.getMinimumTravelTime();}
|
||||
return traveltime;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue