CopyYearEndPoints implements IEndPointsProcessor { @Override public void process(DataBlock in, DataBlock out) { for (int i = npoints - 1, j = out.getLength() - npoints; i >= 0; --i, ++j) { out.set(i, out.get(i + frequency)); out.set(j, out.get(j - frequency)); } } CopyYearEndPoints(int npoints, int freq); @Override void process(DataBlock in, DataBlock out);  }
@Test public void testProcess() { int N = 100, FREQ = 12; DataBlock in = new DataBlock(N); in.set(1); in.cumul(); for (int P = 0; P < (N - FREQ) / 2; ++P) { DataBlock out = in.deepClone(); CopyYearEndPoints cnp = new CopyYearEndPoints(P, FREQ); cnp.process(in, out); DataBlock beg = out.range(0, P + FREQ); DataBlock end = out.range(N - P - FREQ, N); for (int i = 0; i < P; ++i) { assertTrue(beg.extract(i, -1, FREQ).isConstant()); assertTrue(end.extract(i, -1, FREQ).isConstant()); } } }