refactor(shortestPath): move pathCost from Dijkstra to parent class for testing

This commit is contained in:
Paul Alnet 2024-05-20 22:52:04 +02:00
parent f62e312156
commit 8e7d933e7a
2 changed files with 6 additions and 6 deletions

View file

@ -12,8 +12,6 @@ import org.insa.graphs.model.Path;
public class DijkstraAlgorithm extends ShortestPathAlgorithm {
private float pathCost;
public DijkstraAlgorithm(ShortestPathData data) {
super(data);
}
@ -146,8 +144,4 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
}
return solution;
}
public float getCostPath() {
return this.pathCost;
}
}

View file

@ -5,6 +5,8 @@ import org.insa.graphs.model.Node;
public abstract class ShortestPathAlgorithm extends AbstractAlgorithm<ShortestPathObserver> {
protected float pathCost;
protected ShortestPathAlgorithm(ShortestPathData data) {
super(data);
}
@ -66,4 +68,8 @@ public abstract class ShortestPathAlgorithm extends AbstractAlgorithm<ShortestPa
obs.notifyDestinationReached(node);
}
}
public float getCostPath() {
return this.pathCost;
}
}