LMSEstimator { public synchronized void update(Filter filter, long numFound) { double[] updatedWeights = new double[weights.length]; long estimate = estimate(filter); long residual = numFound - estimate; double delta = Math.pow(residual, 2); if (Math.abs(delta) > threshold) { for (int i = 0; i < updatedWeights.length; i++) { updatedWeights[i] = weights[i] + alpha * residual * getInput(filter, i); } weights = Arrays.copyOf(updatedWeights, 5); } } private  LMSEstimator(double alpha, double[] weights, long threshold);  LMSEstimator(); synchronized void update(Filter filter, long numFound); long estimate(Filter filter);  }
@Test public void testUpdate() throws Exception { LMSEstimator lmsEstimator = new LMSEstimator(); Filter filter = mock(Filter.class); long numDocs = 100L; lmsEstimator.update(filter, numDocs); }