@Test public void testThatGetRecordsFulfillsIterableContract() throws Exception { DefaultRecordSource input = new DefaultRecordSource(new TestHeader(true, "lat", "lon")); RecordUtils.addPointRecord(input, 1F, 0F); RecordUtils.addPointRecord(input, 1F, 1F - EPS); RecordUtils.addPointRecord(input, -2F, 1F - EPS); RecordUtils.addPointRecord(input, 0F, 0F); RecordUtils.addPointRecord(input, 0F, 1F - EPS); RecordUtils.addPointRecord(input, 0F, -1F - EPS); RecordUtils.addPointRecord(input, 5F, 0F); MAConfig config = new MAConfig(); config.setMacroPixelSize(1); ProductRecordSource output = createProductRecordSource(2, 3, input, config); Iterable<Record> records = output.getRecords(); assertNotNull(records); Iterator<Record> iterator = records.iterator(); assertTrue(iterator.hasNext()); assertNotNull(iterator.next()); assertTrue(iterator.hasNext()); assertNotNull(iterator.next()); assertTrue(iterator.hasNext()); assertNotNull(iterator.next()); assertTrue(iterator.hasNext()); assertNotNull(iterator.next()); assertFalse(iterator.hasNext()); assertFalse(iterator.hasNext()); assertFalse(iterator.hasNext()); try { iterator.next(); fail("NSEE expected"); } catch (NoSuchElementException e) { } }
@Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } ProductRecordSource(Product product,
                               Header referenceRecordHeader,
                               Iterable<PixelPosProvider.PixelPosRecord> pixelPosRecords,
                               MAConfig config,
                               AffineTransform transform); }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } ProductRecordSource(Product product,
                               Header referenceRecordHeader,
                               Iterable<PixelPosProvider.PixelPosRecord> pixelPosRecords,
                               MAConfig config,
                               AffineTransform transform); @Override Header getHeader(); @Override Iterable<Record> getRecords(); @Override String getTimeAndLocationColumnDescription(); }
ProductRecordSource implements RecordSource { @Override public Iterable<Record> getRecords() throws Exception { return new Iterable<Record>() { @Override public Iterator<Record> iterator() { return new PixelPosRecordGenerator(pixelPosRecords.iterator()); } }; } ProductRecordSource(Product product,
                               Header referenceRecordHeader,
                               Iterable<PixelPosProvider.PixelPosRecord> pixelPosRecords,
                               MAConfig config,
                               AffineTransform transform); @Override Header getHeader(); @Override Iterable<Record> getRecords(); @Override String getTimeAndLocationColumnDescription(); static final String SOURCE_NAME_ATT_NAME; static final String PIXEL_X_ATT_NAME; static final String PIXEL_Y_ATT_NAME; static final String PIXEL_LAT_ATT_NAME; static final String PIXEL_LON_ATT_NAME; static final String PIXEL_TIME_ATT_NAME; static final String PIXEL_MASK_ATT_NAME; }