modified: getLength(), getMinimumTravelTime(), getTravelTime()
This commit is contained in:
parent
8cd678b723
commit
3dcba7891b
1 changed files with 16 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue