Path: isValid func

This commit is contained in:
Clement Lacau 2024-03-25 09:43:12 +01:00
parent da70b6ea86
commit 291c895bb4

View file

@ -201,8 +201,26 @@ public class Path {
* @deprecated Need to be implemented. * @deprecated Need to be implemented.
*/ */
public boolean isValid() { public boolean isValid() {
// TODO:
return false; boolean retour = false;
if (isEmpty() || this.size() == 1) {
retour = true;
} else {
retour = true;
if (this.getOrigin() == this.arcs.get(0).getOrigin()) {
for (int j = 0 ; j < arcs.size() - 2 ; j++) {
if (!(arcs.get(j).getDestination() == arcs.get(j+1).getOrigin())) {
retour = false;
}
}
}
else {
retour = false;
}
}
return retour;
} }
/** /**