Compare commits

..

No commits in common. "24012e3afc91fdb1d569e01f721ed4363ba62dee" and "224ab4a97d70f712c754bd691e774c7c1e7e6423" have entirely different histories.

2 changed files with 1 additions and 33 deletions

View file

@ -33,21 +33,8 @@ public class Label implements Comparable<Label> {
return pathCost;
}
public float getTotalCost() {
// will be overriden for A*
return pathCost;
}
public int compareTo(Label other) {
final float difference = this.getTotalCost() - other.getTotalCost();
final boolean equal = Math.abs(difference) < 1.0;
if (equal) {
return 0;
//TODO
}
// TODO ensure this works properly
// return (int)(this.pathCost - other.pathCost);
return this.pathCost - other.pathCost < 0 ? -1 : 1;
return (int)(this.pathCost - other.pathCost);
}
}

View file

@ -1,19 +0,0 @@
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;
}
}