This commit is contained in:
Raphael Rees 2023-03-22 10:53:34 +01:00
commit 96dc076c30

View file

@ -217,7 +217,24 @@ public class Path {
*/
public boolean isValid() {
// TODO:
return false;
boolean res=true;
//it is empty
if (this.size()!=0 && !this.arcs.isEmpty()){
//it contains a single node without arcs
Node deb=origin;
for (Arc ligne : arcs){
if (ligne.getOrigin().equals(deb)) {
deb=ligne.getDestination();
}
else {
res=false;
}
}
}
//the first arc has for origin the origin of the path and, for two consecutive arcs, the destination of the first one is the origin of the second one.
return res;
}
/**
@ -229,7 +246,11 @@ public class Path {
*/
public float getLength() {
// TODO:
return 0;
float res=0;
for (Arc ligne : arcs) {
res+=ligne.getLength();
}
return res;
}
/**
@ -260,7 +281,12 @@ public class Path {
*/
public double getMinimumTravelTime() {
// TODO:
return 0;
double min=0.0;
for (Arc ligne : arcs ){
min+=ligne.getMinimumTravelTime();
}
return min;
}
}