diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/Label.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/Label.java index a5e1f58..8482a2c 100644 --- a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/Label.java +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/Label.java @@ -56,10 +56,19 @@ { this.currentNode = currentNode; } + + public double getTotalCost() + { + return this.getCost(); + } public int compareTo(Label label) { - return Double.compare(getCost(), label.getCost()); + int i = Double.compare(this.getTotalCost(), label.getTotalCost()); + if (i == 0){ + i = Double.compare(label.getCost(), this.getCost()); + } + return i; } } \ No newline at end of file diff --git a/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java new file mode 100644 index 0000000..c78bafb --- /dev/null +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java @@ -0,0 +1,25 @@ +package org.insa.graphs.algorithm.shortestpath; + +import org.insa.graphs.model.*; + +public class LabelStar extends Label { + private double CostEstime; + + public LabelStar(Node node){ + super(node); + this.CostEstime = Double.POSITIVE_INFINITY ; + } + + public double getCostEstime(){ + return CostEstime; + } + + public void setCostEstime(double CostEstime){ + this.CostEstime = CostEstime; + } + + @Override + public double getTotalCost(){ + return super.getCost() + getCostEstime(); + } +}