forked from lebotlan/BE-Graphes
LabelStar Started
This commit is contained in:
parent
5de1caec47
commit
91e95f7260
1 changed files with 34 additions and 0 deletions
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue