You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2022/09/14 14:38:03 UTC
[sis] 01/04: Rename `range` argument as `ranges`. There is no significant code change in this commit.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
commit 9f6cae9a767a160c226d88a2eb7b926cd72fc99c
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Tue Sep 13 19:10:12 2022 +0200
Rename `range` argument as `ranges`.
There is no significant code change in this commit.
---
.../MultiResolutionCoverageLoaderTest.java | 2 +-
.../org/apache/sis/storage/geotiff/DataCube.java | 8 ++--
.../sis/storage/geotiff/MultiResolutionImage.java | 8 ++--
.../apache/sis/internal/netcdf/RasterResource.java | 48 +++++++++++-----------
.../sis/internal/storage/GridResourceWrapper.java | 8 ++--
.../sis/internal/storage/MemoryGridResource.java | 14 +++----
.../apache/sis/internal/storage/RangeArgument.java | 42 +++++++++----------
.../sis/internal/storage/esri/AsciiGridStore.java | 13 +++---
.../sis/internal/storage/esri/RawRasterStore.java | 6 +--
.../internal/storage/image/SingleImageStore.java | 8 ++--
.../internal/storage/image/WorldFileResource.java | 26 ++++++------
.../org/apache/sis/storage/CoverageSubset.java | 20 ++++-----
.../apache/sis/storage/GridCoverageResource.java | 12 +++---
.../org/apache/sis/storage/GridResourceMock.java | 6 +--
14 files changed, 111 insertions(+), 110 deletions(-)
diff --git a/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/coverage/MultiResolutionCoverageLoaderTest.java b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/coverage/MultiResolutionCoverageLoaderTest.java
index 1368203d67..85c380d99a 100644
--- a/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/coverage/MultiResolutionCoverageLoaderTest.java
+++ b/core/sis-portrayal/src/test/java/org/apache/sis/internal/map/coverage/MultiResolutionCoverageLoaderTest.java
@@ -128,7 +128,7 @@ public final strictfp class MultiResolutionCoverageLoaderTest extends TestCase {
}
/** Returns a dummy value (will not be used by this test). */
- @Override public GridCoverage read(final GridGeometry domain, final int... range) {
+ @Override public GridCoverage read(final GridGeometry domain, final int... ranges) {
final SampleDimension band = new SampleDimension(Names.createLocalName(null, null, "dummy"), null, Collections.emptyList());
return new GridCoverage(domain, Collections.singletonList(band)) {
@Override public RenderedImage render(GridExtent sliceExtent) {
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataCube.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataCube.java
index 99b7a22a70..fe010e4f47 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataCube.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/DataCube.java
@@ -200,17 +200,17 @@ abstract class DataCube extends TiledGridResource implements ResourceOnFileSyste
* Creates a {@link GridCoverage} which will load pixel data in the given domain.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based index of sample dimensions to read, or an empty sequence for reading all ranges.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based index of sample dimensions to read, or an empty sequence for reading all ranges.
+ * @return the grid coverage for the specified domain and ranges.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public final GridCoverage read(final GridGeometry domain, final int... range) throws DataStoreException {
+ public final GridCoverage read(final GridGeometry domain, final int... ranges) throws DataStoreException {
final long startTime = System.nanoTime();
GridCoverage coverage;
try {
synchronized (getSynchronizationLock()) {
- final Subset subset = new Subset(domain, range);
+ final Subset subset = new Subset(domain, ranges);
final Compression compression = getCompression();
if (compression == null) {
throw new DataStoreContentException(reader.resources().getString(
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java
index 4ed3aca47a..68e5d906f2 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/MultiResolutionImage.java
@@ -250,12 +250,12 @@ final class MultiResolutionImage extends GridResourceWrapper implements Resource
* Loads a subset of the grid coverage represented by this resource.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public GridCoverage read(final GridGeometry domain, final int... range) throws DataStoreException {
+ public GridCoverage read(final GridGeometry domain, final int... ranges) throws DataStoreException {
final double[] request = getResolution(domain);
int level = (request != null) ? resolutions.length : 1;
synchronized (getSynchronizationLock()) {
@@ -275,7 +275,7 @@ finer: while (--level > 0) {
throw levels[level].reader.store.errorIO(e);
}
image.setLoadingStrategy(getLoadingStrategy());
- return image.read(domain, range);
+ return image.read(domain, ranges);
}
}
}
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
index 0108f1c911..cf8b4e26fd 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/RasterResource.java
@@ -124,12 +124,12 @@ public final class RasterResource extends AbstractGridCoverageResource implement
*
* @see #getSampleDimensions()
*/
- private final SampleDimension[] ranges;
+ private final SampleDimension[] sampleDimensions;
/**
- * The netCDF variables for each sample dimensions. The length of this array shall be equal to {@code ranges.length},
- * except if bands are stored as one variable dimension ({@link #bandDimension} ≥ 0) in which case the length shall
- * be exactly 1. Accesses to this array need to take in account that the length may be only 1. Example:
+ * The netCDF variables for each sample dimensions. The length of this array shall be equal to {@code sampleDimensions.length},
+ * except if bands are stored as one variable dimension ({@link #bandDimension} ≥ 0) in which case the length shall be exactly 1.
+ * Accesses to this array need to take in account that the length may be only 1. Example:
*
* {@preformat java
* Variable v = data[bandDimension >= 0 ? 0 : index];
@@ -193,15 +193,15 @@ public final class RasterResource extends AbstractGridCoverageResource implement
final int numBands, final int bandDim, final DataStore lock)
{
super(decoder.listeners, false);
- this.lock = lock;
- gridGeometry = grid;
- bandDimension = bandDim;
- location = decoder.location;
- identifier = decoder.nameFactory.createLocalName(decoder.namespace, name);
- visibleBand = decoder.convention().getVisibleBand();
- ranges = new SampleDimension[numBands];
- data = bands.toArray(new Variable[bands.size()]);
- assert data.length == (bandDimension >= 0 ? 1 : ranges.length);
+ this.lock = lock;
+ gridGeometry = grid;
+ bandDimension = bandDim;
+ location = decoder.location;
+ identifier = decoder.nameFactory.createLocalName(decoder.namespace, name);
+ visibleBand = decoder.convention().getVisibleBand();
+ sampleDimensions = new SampleDimension[numBands];
+ data = bands.toArray(new Variable[bands.size()]);
+ assert data.length == (bandDimension >= 0 ? 1 : sampleDimensions.length);
}
/**
@@ -448,12 +448,12 @@ public final class RasterResource extends AbstractGridCoverageResource implement
SampleDimension.Builder builder = null;
try {
synchronized (lock) {
- for (int i=0; i<ranges.length; i++) {
- if (ranges[i] == null) {
+ for (int i=0; i<sampleDimensions.length; i++) {
+ if (sampleDimensions[i] == null) {
if (builder == null) {
builder = new SampleDimension.Builder();
}
- ranges[i] = createSampleDimension(builder, getVariable(i), i);
+ sampleDimensions[i] = createSampleDimension(builder, getVariable(i), i);
builder.clear();
}
}
@@ -461,7 +461,7 @@ public final class RasterResource extends AbstractGridCoverageResource implement
} catch (RuntimeException e) {
throw new DataStoreContentException(e);
}
- return UnmodifiableArrayList.wrap(ranges);
+ return UnmodifiableArrayList.wrap(sampleDimensions);
}
/**
@@ -621,14 +621,14 @@ public final class RasterResource extends AbstractGridCoverageResource implement
* Loads a subset of the grid coverage represented by this resource.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public GridCoverage read(final GridGeometry domain, final int... range) throws DataStoreException {
+ public GridCoverage read(final GridGeometry domain, final int... ranges) throws DataStoreException {
final long startTime = System.nanoTime();
- final RangeArgument rangeIndices = RangeArgument.validate(ranges.length, range, listeners);
+ final RangeArgument rangeIndices = RangeArgument.validate(sampleDimensions.length, ranges, listeners);
final Variable first = data[bandDimension >= 0 ? 0 : rangeIndices.getFirstSpecified()];
final DataType dataType = first.getDataType();
if (bandDimension < 0) {
@@ -670,7 +670,7 @@ public final class RasterResource extends AbstractGridCoverageResource implement
}
/*
* Iterate over netCDF variables in the order they appear in the file, not in the order requested
- * by the `range` argument. The intent is to perform sequential I/O as much as possible, without
+ * by the `ranges` argument. The intent is to perform sequential I/O as much as possible, without
* seeking backward. In the (uncommon) case where bands are one of the variable dimension instead
* than different variables, the reading of the whole variable occurs during the first iteration.
*/
@@ -680,9 +680,9 @@ public final class RasterResource extends AbstractGridCoverageResource implement
int indexInResource = rangeIndices.getSourceIndex(i); // In strictly increasing order.
int indexInRaster = rangeIndices.getTargetIndex(i);
Variable variable = getVariable(indexInResource);
- SampleDimension b = ranges[indexInResource];
+ SampleDimension b = sampleDimensions[indexInResource];
if (b == null) {
- ranges[indexInResource] = b = createSampleDimension(rangeIndices.builder(), variable, i);
+ sampleDimensions[indexInResource] = b = createSampleDimension(rangeIndices.builder(), variable, i);
}
bands[indexInRaster] = b;
if (bandOffsets != null) {
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GridResourceWrapper.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GridResourceWrapper.java
index e922a12c72..48a7b6afe3 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GridResourceWrapper.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/GridResourceWrapper.java
@@ -165,13 +165,13 @@ public abstract class GridResourceWrapper implements GridCoverageResource {
* The default implementation delegates to the source.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public GridCoverage read(GridGeometry domain, int... range) throws DataStoreException {
- return source().read(domain, range);
+ public GridCoverage read(GridGeometry domain, int... ranges) throws DataStoreException {
+ return source().read(domain, ranges);
}
/**
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MemoryGridResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MemoryGridResource.java
index 57523f8747..1c85e1e59a 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MemoryGridResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MemoryGridResource.java
@@ -73,7 +73,7 @@ public class MemoryGridResource extends AbstractGridCoverageResource {
}
/**
- * Returns information about the <cite>range</cite> of wrapped grid coverage.
+ * Returns information about the <cite>ranges</cite> of wrapped grid coverage.
*
* @return ranges of sample values together with their mapping to "real values".
*/
@@ -89,19 +89,19 @@ public class MemoryGridResource extends AbstractGridCoverageResource {
* the original grid coverage.
*
* @param domain desired grid extent and resolution, or {@code null} for the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
*/
@Override
- public GridCoverage read(GridGeometry domain, final int... range) {
+ public GridCoverage read(GridGeometry domain, final int... ranges) {
List<SampleDimension> bands = coverage.getSampleDimensions();
- final RangeArgument rangeIndices = RangeArgument.validate(bands.size(), range, listeners);
+ final RangeArgument rangeIndices = RangeArgument.validate(bands.size(), ranges, listeners);
/*
* The given `domain` may use arbitrary `gridToCRS` and `CRS` properties.
* For this simple implementation we need the same `gridToCRS` and `CRS`
* than the wrapped coverage; only domain `extent` is allowed to differ.
* Subsampling is ignored for now because it is an expensive operation.
- * Clipping and range selection are light and do not copy any data.
+ * Clipping and ranges selection are light and do not copy any data.
*
* TODO: a future implementation may apply subsampling efficiently,
* by adjusting the pixel stride in SampleModel.
@@ -171,7 +171,7 @@ public class MemoryGridResource extends AbstractGridCoverageResource {
}
}
if (!sameBands) {
- data = new ImageProcessor().selectBands(data, range);
+ data = new ImageProcessor().selectBands(data, ranges);
bands = UnmodifiableArrayList.wrap(rangeIndices.select(bands));
}
return new GridCoverageBuilder()
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/RangeArgument.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/RangeArgument.java
index c828e43cdd..52efd2658a 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/RangeArgument.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/RangeArgument.java
@@ -35,7 +35,7 @@ import org.apache.sis.util.Localized;
/**
- * The user-provided {@code range} argument together with a set of convenience tools.
+ * The user-provided {@code ranges} argument together with a set of convenience tools.
*
* @author Martin Desruisseaux (Geomatys)
* @version 1.2
@@ -72,7 +72,7 @@ public final class RangeArgument {
private SampleDimension.Builder builder;
/**
- * Encapsulates the given {@code range} argument packed in high bits.
+ * Encapsulates the user-supplied {@code ranges} argument, packed in high bits of {@code packed}.
*/
private RangeArgument(final long[] packed, final boolean hasAllBands) {
this.packed = packed;
@@ -81,32 +81,32 @@ public final class RangeArgument {
}
/**
- * Validate the {@code range} argument given to {@link GridCoverageResource#read(GridGeometry, int...)}.
+ * Validate the {@code ranges} argument given to {@link GridCoverageResource#read(GridGeometry, int...)}.
* This method verifies that all indices are between 0 and {@code numSampleDimensions} and that there is
* no duplicated index.
*
* @param numSampleDimensions number of sample dimensions in the resource.
* Equal to <code>{@linkplain GridCoverageResource#getSampleDimensions()}.size()</code>.
- * @param range the {@code range} argument given by the user. May be null or empty.
+ * @param ranges the {@code ranges} argument given by the user. May be null or empty.
* @param listeners source of locale to use if an exception must be thrown.
- * @return the {@code range} argument encapsulated with a set of convenience tools.
+ * @return the {@code ranges} argument encapsulated with a set of convenience tools.
* @throws IllegalArgumentException if a range index is invalid.
*/
- public static RangeArgument validate(final int numSampleDimensions, final int[] range, final Localized listeners) {
+ public static RangeArgument validate(final int numSampleDimensions, final int[] ranges, final Localized listeners) {
ArgumentChecks.ensureStrictlyPositive("numSampleDimensions", numSampleDimensions);
final long[] packed;
- if (range == null || range.length == 0) {
+ if (ranges == null || ranges.length == 0) {
packed = new long[numSampleDimensions];
for (int i=1; i<numSampleDimensions; i++) {
packed[i] = (((long) i) << Integer.SIZE) | i;
}
} else {
/*
- * Pattern: [specified `range` value | index in `range` where the value was specified]
+ * Pattern: [specified `range` value | index in `ranges` where the value was specified]
*/
- packed = new long[range.length];
- for (int i=0; i<range.length; i++) {
- final int r = range[i];
+ packed = new long[ranges.length];
+ for (int i=0; i<ranges.length; i++) {
+ final int r = ranges[i];
if (r < 0 || r >= numSampleDimensions) {
throw new IllegalArgumentException(Resources.forLocale(listeners.getLocale()).getString(
Resources.Keys.InvalidSampleDimensionIndex_2, numSampleDimensions - 1, r));
@@ -114,7 +114,7 @@ public final class RangeArgument {
packed[i] = (((long) r) << Integer.SIZE) | i;
}
/*
- * Sort by increasing `range` value, but keep together with index in `range` where each
+ * Sort by increasing `range` value, but keep together with index in `ranges` where each
* value was specified. After sorting, it become easy to check for duplicated values.
*/
Arrays.sort(packed);
@@ -151,8 +151,8 @@ public final class RangeArgument {
}
/**
- * Returns the number of sample dimensions. This is the length of the range array supplied by user,
- * or the number of bands in the source coverage if the {@code range} array was null or empty.
+ * Returns the number of sample dimensions. This is the length of the {@code ranges} array supplied by user,
+ * or the number of bands in the source coverage if the {@code ranges} array was null or empty.
*
* @return the number of sample dimensions selected by user.
*/
@@ -162,10 +162,10 @@ public final class RangeArgument {
/**
* Returns the indices of bands selected by the user.
- * This is a copy of the {@code range} argument specified by the user, in same order.
+ * This is a copy of the {@code ranges} argument specified by the user, in same order.
* Note that this is not necessarily increasing order.
*
- * @return a copy of the {@code range} argument specified by the user.
+ * @return a copy of the {@code ranges} argument specified by the user.
*/
public int[] getSelectedBands() {
final int[] bands = new int[getNumBands()];
@@ -179,7 +179,7 @@ public final class RangeArgument {
* Returns the value of the first index specified by the user. This is not necessarily equal to
* {@code getSourceIndex(0)} if the user specified the bands out of order.
*
- * @return index of the first value in the user-specified {@code range} array.
+ * @return index of the first value in the user-specified {@code ranges} array.
*/
public int getFirstSpecified() {
for (final long p : packed) {
@@ -202,11 +202,11 @@ public final class RangeArgument {
}
/**
- * Returns the i<sup>th</sup> band position. This is the index in the user-supplied {@code range} array
+ * Returns the i<sup>th</sup> band position. This is the index in the user-supplied {@code ranges} array
* where the {@code getSourceIndex(i)} value was specified.
*
* @param i index of the range index to get, from 0 inclusive to {@link #getNumBands()} exclusive.
- * @return index in user-supplied {@code range} array where was specified the {@code getSourceIndex(i)} value.
+ * @return index in user-supplied {@code ranges} array where was specified the {@code getSourceIndex(i)} value.
*/
public int getTargetIndex(final int i) {
return (int) packed[i];
@@ -322,11 +322,11 @@ public final class RangeArgument {
* <ul class="verbose">
* <li>If {@code view} is {@code true}, the sample model returned by this method will expect the
* same {@link java.awt.image.DataBuffer} than the one expected by the original {@code model}.
- * Bands enumerated in the {@code range} argument will be used and other bands will be ignored.
+ * Bands enumerated in the {@code ranges} argument will be used and other bands will be ignored.
* This mode is efficient if the data are already in memory and we want to avoid copying them.
* An inconvenient is that all bands, including the ignored ones, are retained in memory.</li>
* <li>If {@code view} is {@code false}, then this method will "compress" bank indices and bit masks
- * for making them consecutive. For example if the {@code range} argument specifies that the bands
+ * for making them consecutive. For example if the {@code ranges} argument specifies that the bands
* to read are {1, 3, 4, 6, …}, then "compressed" sample model will use bands {0, 1, 2, 3, …}.
* This mode is efficient if the data are not yet in memory and the reader is capable to skip
* the bands to ignore. In such case, this mode save memory.</li>
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/AsciiGridStore.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/AsciiGridStore.java
index 0980ae4a0f..31788a9e29 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/AsciiGridStore.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/AsciiGridStore.java
@@ -420,18 +420,19 @@ cellsize: if (value != null) {
/**
* Loads the data if not already done and closes the channel if read-only.
* In current implementation the image is always fully loaded and cached.
- * The given domain is ignored. We do that in order to have determinist and stable values
- * for the sample range and for the data type. Loading the full image is reasonable if ASCII Grid
- * files contain only small images, which is usually the case given how inefficient this format is.
+ * The given domain is ignored. We do that in order to have determinist
+ * and stable values for the range of sample values and for the data type.
+ * Loading the full image is reasonable if ASCII Grid files contain only small images,
+ * which is usually the case given how inefficient this format is.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range shall be either 0 or a range containing only 0.
+ * @param ranges shall be either {@code null} or an array containing only 0.
* @return the grid coverage for the specified domain.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public synchronized GridCoverage read(final GridGeometry domain, final int... range) throws DataStoreException {
- final RangeArgument bands = RangeArgument.validate(1, range, listeners);
+ public synchronized GridCoverage read(final GridGeometry domain, final int... ranges) throws DataStoreException {
+ final RangeArgument bands = RangeArgument.validate(1, ranges, listeners);
if (coverage == null) try {
readHeader();
final CharactersView view = input();
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterStore.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterStore.java
index 41006b2a3a..ae60b63283 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterStore.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/esri/RawRasterStore.java
@@ -498,15 +498,15 @@ final class RawRasterStore extends RasterStore {
* Loads the data.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range indices of bands to load.
+ * @param ranges indices of bands to load.
* @return the grid coverage for the specified domain.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public synchronized GridCoverage read(GridGeometry domain, final int... range) throws DataStoreException {
+ public synchronized GridCoverage read(GridGeometry domain, final int... ranges) throws DataStoreException {
try {
getSampleDimensions(); // Force reading the header and building the list of sample dimensions.
- final RangeArgument bands = RangeArgument.validate(reader.layout.getNumBands(), range, listeners);
+ final RangeArgument bands = RangeArgument.validate(reader.layout.getNumBands(), ranges, listeners);
final WritableRaster raster = reader.read(domain, bands);
return createCoverage(reader.getEffectiveDomain(), bands, raster, null);
} catch (IOException e) {
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/SingleImageStore.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/SingleImageStore.java
index 1c540ca55e..6021c962b4 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/SingleImageStore.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/SingleImageStore.java
@@ -131,12 +131,12 @@ class SingleImageStore extends WorldFileStore implements GridCoverageResource {
* Loads a subset of the image wrapped by this resource.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
*/
@Override
- public final GridCoverage read(GridGeometry domain, int... range) throws DataStoreException {
- return delegate().read(domain, range);
+ public final GridCoverage read(GridGeometry domain, int... ranges) throws DataStoreException {
+ return delegate().read(domain, ranges);
}
/**
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/WorldFileResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/WorldFileResource.java
index 887d162dd4..e0db706b49 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/WorldFileResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/image/WorldFileResource.java
@@ -249,13 +249,13 @@ class WorldFileResource extends AbstractGridCoverageResource implements StoreRes
* Loads a subset of the image wrapped by this resource.
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public final GridCoverage read(GridGeometry domain, int... range) throws DataStoreException {
- final boolean isFullCoverage = (domain == null && range == null);
+ public final GridCoverage read(GridGeometry domain, int... ranges) throws DataStoreException {
+ final boolean isFullCoverage = (domain == null && ranges == null);
final WorldFileStore store = store();
try {
synchronized (store) {
@@ -310,18 +310,18 @@ class WorldFileResource extends AbstractGridCoverageResource implements StoreRes
* Those heuristic rules may be changed in any future version.
*/
List<SampleDimension> bands = getSampleDimensions();
- if (range != null) {
+ if (ranges != null) {
final ImageTypeSpecifier type = reader.getRawImageType(getImageIndex());
- final RangeArgument args = RangeArgument.validate(type.getNumBands(), range, listeners);
+ final RangeArgument args = RangeArgument.validate(type.getNumBands(), ranges, listeners);
if (args.isIdentity()) {
- range = null;
+ ranges = null;
} else {
bands = UnmodifiableArrayList.wrap(args.select(bands));
if (args.hasAllBands || type.getSampleModel() instanceof BandedSampleModel) {
- range = args.getSelectedBands();
- param.setSourceBands(range);
- param.setDestinationBands(ArraysExt.range(0, range.length));
- range = null;
+ ranges = args.getSelectedBands();
+ param.setSourceBands(ranges);
+ param.setDestinationBands(ArraysExt.range(0, ranges.length));
+ ranges = null;
}
}
}
@@ -331,8 +331,8 @@ class WorldFileResource extends AbstractGridCoverageResource implements StoreRes
* It waste some memory because unused bands still in memory. But we do that as a
* workaround for limitations in some `ImageReader` implementations.
*/
- if (range != null) {
- image = new ImageProcessor().selectBands(image, range);
+ if (ranges != null) {
+ image = new ImageProcessor().selectBands(image, ranges);
}
final GridCoverage coverage = new GridCoverage2D(domain, bands, image);
if (isFullCoverage) {
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java
index a5978ddf22..b8d90c82c6 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java
@@ -198,12 +198,12 @@ final class CoverageSubset extends AbstractGridCoverageResource {
* </ul>
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
@Override
- public GridCoverage read(GridGeometry domain, int... range) throws DataStoreException {
+ public GridCoverage read(GridGeometry domain, int... ranges) throws DataStoreException {
if (domain == null) {
domain = source.getGridGeometry();
}
@@ -213,21 +213,21 @@ final class CoverageSubset extends AbstractGridCoverageResource {
*/
domain = clip(domain, GridRoundingMode.ENCLOSING, GridClippingMode.BORDER_EXPANSION);
final int[] qr = query.getProjection();
- if (range == null) {
- range = qr;
+ if (ranges == null) {
+ ranges = qr;
} else if (qr != null) {
- final int[] sub = new int[range.length];
- for (int i=0; i<range.length; i++) {
- final int j = range[i];
+ final int[] sub = new int[ranges.length];
+ for (int i=0; i<ranges.length; i++) {
+ final int j = ranges[i];
if (j >= 0 && j < qr.length) {
sub[i] = qr[j];
} else {
throw new IllegalArgumentException(invalidRange(qr.length, j));
}
}
- range = sub;
+ ranges = sub;
}
- return source.read(domain, range);
+ return source.read(domain, ranges);
}
/**
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java
index f82af4a493..c28fe0cd62 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/GridCoverageResource.java
@@ -188,21 +188,21 @@ public interface GridCoverageResource extends DataSet {
* matching exactly the given geometry.
*
* <p>The returned coverage shall contain the exact set of sample dimensions specified by the {@code range} argument,
- * in the specified order (the "best-effort basis" flexibility applies only to the grid geometry, not to the range).
- * All {@code range} values shall be between 0 inclusive and <code>{@linkplain #getSampleDimensions()}.size()</code>
+ * in the specified order (the "best-effort basis" flexibility applies only to the grid geometry, not to the ranges).
+ * All {@code ranges} values shall be between 0 inclusive and <code>{@linkplain #getSampleDimensions()}.size()</code>
* exclusive, without duplicated values.</p>
*
* <p>While this method name suggests an immediate reading, some implementations may defer the actual reading
* at a later stage.</p>
*
* @param domain desired grid extent and resolution, or {@code null} for reading the whole domain.
- * @param range 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
- * @return the grid coverage for the specified domain and range.
+ * @param ranges 0-based indices of sample dimensions to read, or {@code null} or an empty sequence for reading them all.
+ * @return the grid coverage for the specified domain and ranges.
* @throws DisjointExtentException if the given domain does not intersect the resource extent.
- * @throws IllegalArgumentException if the given domain or range is invalid for another reason.
+ * @throws IllegalArgumentException if the given domain or ranges are invalid for another reason.
* @throws DataStoreException if an error occurred while reading the grid coverage data.
*/
- GridCoverage read(GridGeometry domain, int... range) throws DataStoreException;
+ GridCoverage read(GridGeometry domain, int... ranges) throws DataStoreException;
/**
* Returns an indication about when the "physical" loading of raster data will happen.
diff --git a/storage/sis-storage/src/test/java/org/apache/sis/storage/GridResourceMock.java b/storage/sis-storage/src/test/java/org/apache/sis/storage/GridResourceMock.java
index 08cc9f6573..d4fd7e8217 100644
--- a/storage/sis-storage/src/test/java/org/apache/sis/storage/GridResourceMock.java
+++ b/storage/sis-storage/src/test/java/org/apache/sis/storage/GridResourceMock.java
@@ -83,12 +83,12 @@ final strictfp class GridResourceMock extends AbstractGridCoverageResource {
* The image will always be a {@link BufferedImage} with pixel coordinates starting at (0,0).
*
* @param domain desired grid extent and resolution, or {@code null} for the whole domain.
- * @param range must be null, empty or a singleton containing only value 0.
+ * @param ranges must be null, empty or a singleton containing only value 0.
* @return the grid coverage for the specified domain.
*/
@Override
- public GridCoverage read(GridGeometry domain, final int... range) {
- assertTrue(range == null || range.length == 0 || (range.length == 1 && range[0] == 0));
+ public GridCoverage read(GridGeometry domain, final int... ranges) {
+ assertTrue(ranges == null || ranges.length == 0 || (ranges.length == 1 && ranges[0] == 0));
if (domain == null) {
domain = gridGeometry;
} else {