Permettre la modification de la liste d'arcs du path pour l'algo marathon

This commit is contained in:
Clement Lacau 2024-05-24 23:39:15 +02:00
parent f3bb926fda
commit fd6b03a32c

View file

@ -115,7 +115,7 @@ public class Path {
* map do not match, or the end of a path is not the beginning of the
* next).
*/
public static Path concatenate(Path... paths) throws IllegalArgumentException {
public static Path concatenate(int indice, Path... paths) throws IllegalArgumentException {
if (paths.length == 0) {
throw new IllegalArgumentException("Cannot concatenate an empty list of paths.");
}
@ -128,7 +128,7 @@ public class Path {
}
ArrayList<Arc> arcs = new ArrayList<>();
for (Path path: paths) {
arcs.addAll(path.getArcs());
arcs.addAll(indice, path.getArcs());
}
Path path = new Path(paths[0].getGraph(), arcs);
if (!path.isValid()) {
@ -145,7 +145,7 @@ public class Path {
private final Node origin;
// List of arcs in this path.
private final List<Arc> arcs;
private List<Arc> arcs;
/**
* Create an empty path corresponding to the given graph.
@ -207,7 +207,8 @@ public class Path {
* @return List of arcs in the path.
*/
public List<Arc> getArcs() {
return Collections.unmodifiableList(arcs);
// return Collections.unmodifiableList(arcs);
return arcs;
}
/**
@ -308,4 +309,5 @@ public class Path {
return somme;
}
}