TileImpl implements Tile { @Override public void setSamples(byte[] samples) { int i = 0; for (int y = minY; y <= maxY; y++) { for (int x = minX; x <= maxX; x++) { setSample(x, y, samples[i++]); } } } TileImpl(RasterDataNode rasterDataNode, Raster raster);  TileImpl(RasterDataNode rasterDataNode, WritableRaster raster, Rectangle rectangle);  TileImpl(RasterDataNode rasterDataNode, Raster raster, Rectangle rectangle, boolean target); @Override float toGeoPhysical(float sample); @Override double toGeoPhysical(double sample); @Override float toRaw(float sample); @Override double toRaw(double sample); @Override final boolean isTarget(); @Override boolean isSampleValid(int x, int y); @Override final Rectangle getRectangle(); @Override final int getMinX(); @Override final int getMaxX(); @Override final int getMinY(); @Override final int getMaxY(); @Override final int getWidth(); @Override final int getHeight(); @Override final RasterDataNode getRasterDataNode(); @Override int getDataBufferIndex(int x, int y); @Override synchronized ProductData getDataBuffer(); @Override final byte[] getDataBufferByte(); @Override final short[] getDataBufferShort(); @Override final int[] getDataBufferInt(); @Override final float[] getDataBufferFloat(); @Override final double[] getDataBufferDouble(); @Override final int getScanlineOffset(); @Override final int getScanlineStride(); @Override synchronized ProductData getRawSamples(); @Override synchronized void setRawSamples(ProductData rawSamples); @Override byte[] getSamplesByte(); @Override short[] getSamplesShort(); @Override int[] getSamplesInt(); @Override float[] getSamplesFloat(); @Override double[] getSamplesDouble(); @Override void setSamples(byte[] samples); @Override void setSamples(short[] samples); @Override void setSamples(int[] samples); @Override void setSamples(float[] samples); @Override void setSamples(double[] samples); @Override boolean getSampleBoolean(int x, int y); @Override void setSample(int x, int y, boolean sample); @Override int getSampleInt(int x, int y); @Override void setSample(int x, int y, int sample); @Override float getSampleFloat(int x, int y); @Override void setSample(int x, int y, float sample); @Override double getSampleDouble(int x, int y); @Override void setSample(int x, int y, double sample); @Override boolean getSampleBit(int x, int y, int bitIndex); @Override void setSample(int x, int y, int bitIndex, boolean sample); @Override Iterator<Pos> iterator();  }
@Test public void testSetSamples() { Tile tile = createScaledTileWithNaNs(ProductData.TYPE_UINT16, 2.5, 7.5); double[] samples; float[] newSamplesF = new float[N]; Arrays.fill(newSamplesF, 5.1F); tile.setSamples(newSamplesF); samples = tile.getSamplesDouble(); assertNotNull(samples); assertEquals(N, samples.length); assertEquals(5.0F, samples[0], 1.0e-5F); assertEquals(5.0F, samples[N - 1], 1.0e-5F); double[] newSamplesD = new double[N]; Arrays.fill(newSamplesD, 12.2); tile.setSamples(newSamplesD); samples = tile.getSamplesDouble(); assertNotNull(samples); assertEquals(N, samples.length); assertEquals(10.0, samples[0], 1.0e-10); assertEquals(10.0, samples[N - 1], 1.0e-10); }