CopyEndPoints implements IEndPointsProcessor { @Override public void process(final DataBlock in, final DataBlock out) { out.range(0, npoints).set(out.get(npoints)); int n = out.getLength(); out.range(n - npoints, n).set(out.get(n - npoints - 1)); } CopyEndPoints(int npoints); @Override void process(final DataBlock in, final DataBlock out);  }
@Test public void testProcess() { int N = 19; DataBlock in = new DataBlock(N); in.set(1); in.cumul(); for (int P = 0; P < 10; ++P) { DataBlock out = in.deepClone(); CopyEndPoints cnp = new CopyEndPoints(P); cnp.process(in, out); assertTrue(out.range(0, P + 1).isConstant()); assertTrue(out.range(N - P - 1, N).isConstant()); } }