1
0
Fork 0

made isValid()

This commit is contained in:
Sebastien Moll 2026-04-15 17:00:52 +02:00
parent 472b578692
commit b65f6c27ca

View file

@ -184,11 +184,21 @@ public class Path {
* </ul>
*
* @return true if the path is valid, false otherwise.
* @deprecated Need to be implemented.
*/
public boolean isValid() {
// TODO:
return false;
if (this.isEmpty()) { return true; }
if (this.size() == 1 && this.arcs.isEmpty()) { return true; }
if (this.arcs.get(0).getOrigin() != this.origin) { return false; }
Boolean good = true;
for (int i = 0; i < this.arcs.size() - 1; i++) {
if (this.arcs.get(i).getDestination() != this.arcs.get(i+1).getOrigin()) {
good = false;
}
}
return good;
}
/**