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..434883b --- /dev/null +++ b/be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/LabelStar.java @@ -0,0 +1,19 @@ +package org.insa.graphs.algorithm.shortestpath; + +import org.insa.graphs.model.Node; +import org.insa.graphs.model.Point; + +public class LabelStar extends Label { + private float distanceToDestination; + + public LabelStar(Node node, Node destination) { + super(node); + // precision was never an answer + distanceToDestination = (float) Point.distance(node.getPoint(), destination.getPoint()); + } + + @Override + public float getTotalCost() { + return this.getCost() + distanceToDestination; + } +}