*/
public class WGSGravityModel implements GravityModel {
+ // Cache the previously computed value
private WorldCoordinate lastWorldCoordinate;
private double lastg;
-
- private static int hit = 0;
- private static int miss = 0;
-
@Override
public double getGravity(WorldCoordinate wc) {
if (wc != this.lastWorldCoordinate) {
this.lastg = calcGravity(wc);
this.lastWorldCoordinate = wc;
-
- miss++;
- } else {
- hit++;
}
- System.out.println("GRAVITY MODEL: hit=" + hit + " miss=" + miss);
return this.lastg;