ParticleFilter { public void updateAction(double x, double y) { for (Particle particle : particleList) { final double val = nextGaussian() * sigmaAction * scale; particle.setXY(particle.getX() + x + val, particle.getY() + y + val); } showParticles(); } ParticleFilter(final Context ctx, UserPositionManager userPositionManager); void initialize(double curX, double curY); void updateAction(double x, double y); void updateSensor(double x, double y); void resampling(); void clearParticles(); void setShowParticles(boolean enabled); void setNumParticles(int particles); void setScale(float scale); NicGeoPoint calculatePosition();  }
@Test public void testUpdateAction() { double deltaX = 2.f; double deltaY = 0.5f; pf = new ParticleFilterTestable(); pf.setNumParticles(2); Particle tmp = new Particle(1.f, 2.f, 0.6f); pf.particleList.add(tmp); tmp = new Particle(4.f, 5.f, 0.4f); pf.particleList.add(tmp); pf.sigmaAction = 1.f; pf.setScale(1.f); pf.updateAction(deltaX, deltaY); assertEquals(3.1f, pf.particleList.get(0).getX(), 0.01f); assertEquals(2.6f, pf.particleList.get(0).getY(), 0.01f); assertEquals(6.1f, pf.particleList.get(1).getX(), 0.01f); assertEquals(5.6f, pf.particleList.get(1).getY(), 0.01f); }