Merge branch 'master' of https://git.etud.insa-toulouse.fr/rees/Graphes_REES_KOUTSODIMA
This commit is contained in:
commit
96dc076c30
1 changed files with 29 additions and 3 deletions
|
@ -217,7 +217,24 @@ public class Path {
|
||||||
*/
|
*/
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
// TODO:
|
// 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() {
|
public float getLength() {
|
||||||
// TODO:
|
// 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() {
|
public double getMinimumTravelTime() {
|
||||||
// TODO:
|
// TODO:
|
||||||
return 0;
|
double min=0.0;
|
||||||
|
for (Arc ligne : arcs ){
|
||||||
|
min+=ligne.getMinimumTravelTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue