Path: isValid func
This commit is contained in:
parent
da70b6ea86
commit
291c895bb4
1 changed files with 20 additions and 2 deletions
|
@ -201,8 +201,26 @@ public class Path {
|
|||
* @deprecated Need to be implemented.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue