@Test public void testMaterialize() { Series<String> s = new OffsetLeadSeries<>(Series.forData("a", "b", "c", "d"), 1, "X").materialize(); assertTrue(s instanceof ArraySeries); new SeriesAsserts(s).expectData("X", "a", "b", "c"); }
@Override public Series<T> materialize() { int size = size(); Object[] buffer = new Object[size]; if (filler != null) { Arrays.fill(buffer, 0, offset, filler); } delegate.copyTo(buffer, 0, offset, size - offset); return new ArraySeries<>((T[]) buffer); }
OffsetLeadSeries extends OffsetSeries<T> { @Override public Series<T> materialize() { int size = size(); Object[] buffer = new Object[size]; if (filler != null) { Arrays.fill(buffer, 0, offset, filler); } delegate.copyTo(buffer, 0, offset, size - offset); return new ArraySeries<>((T[]) buffer); } }
OffsetLeadSeries extends OffsetSeries<T> { @Override public Series<T> materialize() { int size = size(); Object[] buffer = new Object[size]; if (filler != null) { Arrays.fill(buffer, 0, offset, filler); } delegate.copyTo(buffer, 0, offset, size - offset); return new ArraySeries<>((T[]) buffer); } OffsetLeadSeries(Series<T> delegate, int offset, T filler); }
OffsetLeadSeries extends OffsetSeries<T> { @Override public Series<T> materialize() { int size = size(); Object[] buffer = new Object[size]; if (filler != null) { Arrays.fill(buffer, 0, offset, filler); } delegate.copyTo(buffer, 0, offset, size - offset); return new ArraySeries<>((T[]) buffer); } OffsetLeadSeries(Series<T> delegate, int offset, T filler); @Override Series<T> shift(int offset, T filler); @Override T get(int index); @Override void copyTo(Object[] to, int fromOffset, int toOffset, int len); @Override Series<T> materialize(); }
OffsetLeadSeries extends OffsetSeries<T> { @Override public Series<T> materialize() { int size = size(); Object[] buffer = new Object[size]; if (filler != null) { Arrays.fill(buffer, 0, offset, filler); } delegate.copyTo(buffer, 0, offset, size - offset); return new ArraySeries<>((T[]) buffer); } OffsetLeadSeries(Series<T> delegate, int offset, T filler); @Override Series<T> shift(int offset, T filler); @Override T get(int index); @Override void copyTo(Object[] to, int fromOffset, int toOffset, int len); @Override Series<T> materialize();  }