Version fonctionnelle - Ajout getMinimumTravelTime isValid

This commit is contained in:
Paul Faure 2020-03-16 12:06:55 +01:00
parent 4365c6b3a8
commit 3303f2400c

View file

@ -197,12 +197,21 @@ public class Path {
* </ul> * </ul>
* *
* @return true if the path is valid, false otherwise. * @return true if the path is valid, false otherwise.
*
* @deprecated Need to be implemented.
*/ */
public boolean isValid() { public boolean isValid() {
// TODO: boolean retour = true;
return false; if ((! this.isEmpty()) && (!(this.size() == 0))) {
Node Deb = this.origin;
for (Arc arc : this.arcs) {
if (Deb == arc.getOrigin()) {
Deb = arc.getDestination();
} else {
retour = false;
break;
}
}
}
return retour;
} }
/** /**
@ -239,12 +248,13 @@ public class Path {
* on every arc. * on every arc.
* *
* @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.
*/ */
public double getMinimumTravelTime() { public double getMinimumTravelTime() {
// TODO: double minimumTravelTime = 0;
return 0; for (Arc arc : this.arcs) {
minimumTravelTime = minimumTravelTime + arc.getMinimumTravelTime();
}
return minimumTravelTime;
} }
} }