Created
March 30, 2013 18:37
-
-
Save aybabtme/5277848 to your computer and use it in GitHub Desktop.
that = this in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Comparator<Vertex<Value>> getComparator(){ | |
final Vertex<Value> that = this; | |
return new Comparator<Vertex<Value>>() { | |
@Override | |
public int compare(Vertex<Value> v1, Vertex<Value> v2) { | |
double h1 = heuristic.getCost(that, v1); | |
double h2 = heuristic.getCost(that, v2); | |
double d1 = that.distanceTo(v1); | |
double d2 = that.distanceTo(v2); | |
double costOfV1 = h1 + d1; | |
double costOfV2 = h2 + d2; | |
return (int) (costOfV1 - costOfV2); | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment