refactor(marathon): rename solution to more coherent naming schema
This commit is contained in:
parent
63da86ab0f
commit
de340c65dd
1 changed files with 9 additions and 9 deletions
|
@ -41,20 +41,20 @@ public class MarathonAlgorithm extends ShortestPathAlgorithm {
|
|||
final ShortestPathData data = getInputData();
|
||||
final Graph graph = data.getGraph();
|
||||
|
||||
DijkstraAlgorithm dijkstra = new DijkstraAlgorithm(data);
|
||||
ShortestPathSolution path = dijkstra.run();
|
||||
final ShortestPathSolution solution = (new DijkstraAlgorithm(data)).run();
|
||||
final Path path = solution.getPath();
|
||||
|
||||
if (!path.isFeasible())
|
||||
return path;
|
||||
if (!solution.isFeasible())
|
||||
return solution;
|
||||
|
||||
while (path.getPath().getLength() < getDistance()) {
|
||||
while (path.getLength() < getDistance()) {
|
||||
// Recuperation Arc à supprimer
|
||||
Arc arcToRemove = getLongestArc(path.getPath());
|
||||
Arc arcToRemove = getLongestArc(path);
|
||||
Node originArcToRemove = arcToRemove.getOrigin();
|
||||
Node destinationArcToRemove = arcToRemove.getDestination();
|
||||
|
||||
// On le supprime dans une copie du tableau (getter Collections.unmodifiable dans Path.java)
|
||||
path.getPath().getArcs().remove(arcToRemove);
|
||||
path.getArcs().remove(arcToRemove);
|
||||
originArcToRemove.removeArc(arcToRemove);
|
||||
|
||||
// Creations du chemin entre les 2 noeuds dont l'arc a été supprimé
|
||||
|
@ -65,11 +65,11 @@ public class MarathonAlgorithm extends ShortestPathAlgorithm {
|
|||
|
||||
if (newPath.getPath() != null) {
|
||||
// Ajout du path trouvé à l'indice où on l'a enlevé
|
||||
path.getPath().getArcs().addAll(newPath.getPath().getArcs());
|
||||
path.getArcs().addAll(newPath.getPath().getArcs());
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
return solution;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue