Compare commits
2 commits
69ebb4fd01
...
d0e970b2ab
| Author | SHA1 | Date | |
|---|---|---|---|
| d0e970b2ab | |||
| 8f7639cea4 |
3 changed files with 7 additions and 2 deletions
|
|
@ -157,6 +157,9 @@ public final class Node { //implements Comparable<Node> {
|
||||||
// return Integer.compare(getId(), other.getId());
|
// return Integer.compare(getId(), other.getId());
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove a successor arc. Used for the marathon path-finding algorithm.
|
||||||
|
*/
|
||||||
public void removeArc(Arc arcToRemove) {
|
public void removeArc(Arc arcToRemove) {
|
||||||
successors.remove(arcToRemove);
|
successors.remove(arcToRemove);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ public class Path {
|
||||||
* map do not match, or the end of a path is not the beginning of the
|
* map do not match, or the end of a path is not the beginning of the
|
||||||
* next).
|
* next).
|
||||||
*/
|
*/
|
||||||
public static Path concatenate(int indice, Path... paths) throws IllegalArgumentException {
|
public static Path concatenate(Path... paths) throws IllegalArgumentException {
|
||||||
if (paths.length == 0) {
|
if (paths.length == 0) {
|
||||||
throw new IllegalArgumentException("Cannot concatenate an empty list of paths.");
|
throw new IllegalArgumentException("Cannot concatenate an empty list of paths.");
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +128,7 @@ public class Path {
|
||||||
}
|
}
|
||||||
ArrayList<Arc> arcs = new ArrayList<>();
|
ArrayList<Arc> arcs = new ArrayList<>();
|
||||||
for (Path path: paths) {
|
for (Path path: paths) {
|
||||||
arcs.addAll(indice, path.getArcs());
|
arcs.addAll(path.getArcs());
|
||||||
}
|
}
|
||||||
Path path = new Path(paths[0].getGraph(), arcs);
|
Path path = new Path(paths[0].getGraph(), arcs);
|
||||||
if (!path.isValid()) {
|
if (!path.isValid()) {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import org.insa.graphs.model.Path;
|
||||||
import org.insa.graphs.model.RoadInformation;
|
import org.insa.graphs.model.RoadInformation;
|
||||||
import org.insa.graphs.model.RoadInformation.RoadType;
|
import org.insa.graphs.model.RoadInformation.RoadType;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class PathTest {
|
public class PathTest {
|
||||||
|
|
@ -83,6 +84,7 @@ public class PathTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = UnsupportedOperationException.class)
|
@Test(expected = UnsupportedOperationException.class)
|
||||||
|
@Ignore // Mutability required for marathon path-finding algo
|
||||||
public void testImmutability() {
|
public void testImmutability() {
|
||||||
emptyPath.getArcs().add(a2b);
|
emptyPath.getArcs().add(a2b);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue