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).
|
* @return Total length of the path (in meters).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
* Need to be implemented.
|
||||||
*/
|
*/
|
||||||
public float getLength() {
|
public float getLength() {
|
||||||
// TODO:
|
// 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
|
* @return Time (in seconds) required to travel this path at the given speed (in
|
||||||
* kilometers-per-hour).
|
* kilometers-per-hour).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
* Need to be implemented.
|
||||||
*/
|
*/
|
||||||
public double getTravelTime(double speed) {
|
public double getTravelTime(double speed) {
|
||||||
// TODO:
|
double length = (double) this.getLength(); //length in meter
|
||||||
return 0;
|
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).
|
* @return Minimum travel time to travel this path (in seconds).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
* Need to be implemented.
|
||||||
*/
|
*/
|
||||||
public double getMinimumTravelTime() {
|
public double getMinimumTravelTime() {
|
||||||
// TODO:
|
double traveltime = 0;
|
||||||
return 0;
|
for (Arc a : this.arcs) {
|
||||||
|
traveltime += a.getMinimumTravelTime();}
|
||||||
|
return traveltime;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue