1
0
Fork 0

LabelStar Started

This commit is contained in:
Sebastien Moll 2026-05-12 15:48:24 +02:00
parent 5de1caec47
commit 91e95f7260

View file

@ -0,0 +1,34 @@
package org.insa.graphs.algorithm.shortestpath;
import org.insa.graphs.model.Node;
import org.insa.graphs.model.Point;
public class LabelStar extends Label {
private double volOiseau;
public LabelStar(Node sommetCourant) {
super(sommetCourant);
volOiseau = Double.POSITIVE_INFINITY;
}
public void setVolOiseau(Node sommetDestination) {
volOiseau = Point.distance(this.getSommetCourant().getPoint(), sommetDestination.getPoint());
}
public double getVolOiseau() {
return volOiseau;
}
public int compareTo(LabelStar o) {
double coutthis = this.volOiseau + this.getCost();
double coutautre = o.getVolOiseau() + o.getCost();
if (coutthis == coutautre) {
return Double.compare(this.volOiseau, o.getVolOiseau());
}
else {
return Double.compare(coutthis, coutautre);
}
}
}