/** * {@inheritDoc} * <p> * Strengthened return type. */ @Override public IChunkedOrderedStriterator<I, E> addFilter( final IFilter<I, ?, E> filter) { return (IChunkedOrderedStriterator<I, E>) super.addFilter(filter); }
/** * {@inheritDoc} * <p> * Strengthened return type. */ @Override public IChunkedOrderedStriterator<I, E> addFilter( final IFilter<I, ?, E> filter) { return (IChunkedOrderedStriterator<I, E>) super.addFilter(filter); }
/** * Unit test for chunk-at-a-time rewrite (multiplies the values in the chunk * by two). */ public void test_filter() { IChunkedIterator<Long> itr = new ChunkedStriterator(Arrays.asList( new Long[] { 1L, 2L, 3L }).iterator()) .addFilter(new ChunkedFilter<IChunkedIterator<Long>, Long, Long>() { @Override protected Long[] filterChunk(Long[] chunk) { for (int i = 0; i < chunk.length; i++) { chunk[i] *= 2; } return chunk; } }); assertEquals(new Long[] { 2L, 4L, 6L }, itr.nextChunk()); }
public void test_filter() { final IChunkedIterator<Long> actual = (IChunkedIterator<Long>) new ChunkedStriterator<IChunkedIterator<Long>, Long>( Arrays.asList(new Long[] { 1L, 3L, 5L }).iterator()) .addFilter(new Appender<IChunkedIterator<Long>, Long>( new ChunkedWrappedIterator<Long>(Arrays.asList( new Long[] { 2L, 3L, 4L }).iterator()))); assertEquals(new Long[] { // 1L, 3L, 5L, // src1 2L, 3L, 4L, // src2 }, actual.nextChunk()); }
public void test_filter() { final IChunkedIterator<Long> actual = (IChunkedIterator<Long>) new ChunkedStriterator<IChunkedIterator<Long>, Long>( Arrays.asList(new Long[] { 1L, 3L, 5L }).iterator()) .addFilter(new MergeFilter<IChunkedIterator<Long>, Long>( new ChunkedWrappedIterator<Long>(Arrays.asList( new Long[] { 2L, 3L, 4L }).iterator()))); assertEquals(new Long[] { 1L, 2L, 3L, 4L, 5L }, actual.nextChunk()); }
public void test_filter() { final IChunkedIterator<Long> actual = (IChunkedIterator<Long>) new ChunkedStriterator<IChunkedIterator<Long>, Long>( Arrays.asList(new Long[] { 1L, 3L, 5L }).iterator()) .addFilter(new Appender<IChunkedIterator<Long>, Long>( new ChunkedWrappedIterator<Long>(Arrays.asList( new Long[] { 2L, 3L, 4L }).iterator()))); assertEquals(new Long[] { // 1L, 3L, 5L, // src1 2L, 3L, 4L, // src2 }, actual.nextChunk()); }
public void test_filter() { final IChunkedIterator<Long> actual = (IChunkedIterator<Long>) new ChunkedStriterator<IChunkedIterator<Long>, Long>( Arrays.asList(new Long[] { 1L, 3L, 5L }).iterator()) .addFilter(new MergeFilter<IChunkedIterator<Long>, Long>( new ChunkedWrappedIterator<Long>(Arrays.asList( new Long[] { 2L, 3L, 4L }).iterator()))); assertEquals(new Long[] { 1L, 2L, 3L, 4L, 5L }, actual.nextChunk()); }
/** * Unit test for chunk-at-a-time rewrite (multiplies the values in the chunk * by two). */ public void test_filter() { IChunkedIterator<Long> itr = new ChunkedStriterator(Arrays.asList( new Long[] { 1L, 2L, 3L }).iterator()) .addFilter(new ChunkedFilter<IChunkedIterator<Long>, Long, Long>() { @Override protected Long[] filterChunk(Long[] chunk) { for (int i = 0; i < chunk.length; i++) { chunk[i] *= 2; } return chunk; } }); assertEquals(new Long[] { 2L, 4L, 6L }, itr.nextChunk()); }
/** * Unit test for correct rendering of a partial chunk when an element has * already been drawn from the iterator. */ public void test_filter2() { IChunkedIterator<Long> itr = new ChunkedStriterator(Arrays.asList( new Long[] { 1L, 2L, 3L }).iterator()) .addFilter(new ChunkedFilter<IChunkedIterator<Long>, Long, Long>() { @Override protected Long[] filterChunk(Long[] chunk) { for (int i = 0; i < chunk.length; i++) { chunk[i] *= 2; } return chunk; } }); assertEquals(Long.valueOf(2L), itr.next()); assertEquals(new Long[] { 4L, 6L }, itr.nextChunk()); }
/** * Unit test for correct rendering of a partial chunk when an element has * already been drawn from the iterator. */ public void test_filter2() { IChunkedIterator<Long> itr = new ChunkedStriterator(Arrays.asList( new Long[] { 1L, 2L, 3L }).iterator()) .addFilter(new ChunkedFilter<IChunkedIterator<Long>, Long, Long>() { @Override protected Long[] filterChunk(Long[] chunk) { for (int i = 0; i < chunk.length; i++) { chunk[i] *= 2; } return chunk; } }); assertEquals(Long.valueOf(2L), itr.next()); assertEquals(new Long[] { 4L, 6L }, itr.nextChunk()); }
new com.bigdata.striterator.ChunkedStriterator(src).addFilter(
}).addFilter(new com.bigdata.striterator.Resolver() {