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:02 UTC
[sis] branch geoapi-4.0 updated (cf73da5dd6 -> 6f8c006837)
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
from cf73da5dd6 Allow deferred loading of slice in a concatenated coverage.
new 9f6cae9a76 Rename `range` argument as `ranges`. There is no significant code change in this commit.
new a26b7f4015 Fix a spelling error: "fist" → "first".
new 99646bbeb7 Remove reference to source `Resource` in metadata of derived resource. This is a partial revert of f2f389fa68f4112a35733d85182b06951e0de3ca.
new 6f8c006837 Make `GridExtent.intersect(…)` and `union(…)` methods public.
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../org/apache/sis/coverage/grid/GridExtent.java | 42 +++--
.../apache/sis/coverage/grid/GridExtentTest.java | 18 ++
.../MultiResolutionCoverageLoaderTest.java | 2 +-
.../java/org/apache/sis/geometry/Envelope2D.java | 2 +-
.../org/apache/sis/io/wkt/WKTDictionaryTest.java | 2 +-
.../operation/CoordinateOperationFinderTest.java | 2 +-
.../java/org/apache/sis/util/CharSequences.java | 2 +-
.../sis/util/collection/TreeTableFormat.java | 2 +-
.../java/org/apache/sis/util/resources/Errors.java | 5 +
.../apache/sis/util/resources/Errors.properties | 1 +
.../apache/sis/util/resources/Errors_fr.properties | 1 +
.../org/apache/sis/storage/geotiff/DataCube.java | 8 +-
.../sis/storage/geotiff/MultiResolutionImage.java | 8 +-
.../apache/sis/internal/netcdf/RasterResource.java | 48 +++---
.../sis/internal/netcdf/impl/ChannelDecoder.java | 2 +-
.../sis/internal/storage/GridResourceWrapper.java | 8 +-
.../sis/internal/storage/MemoryGridResource.java | 14 +-
.../sis/internal/storage/MetadataBuilder.java | 46 +++---
.../apache/sis/internal/storage/RangeArgument.java | 42 ++---
.../sis/internal/storage/ResourceLineage.java | 184 +++++++--------------
.../sis/internal/storage/StoreUtilities.java | 26 ---
.../storage/aggregate/AggregatedResource.java | 7 -
.../aggregate/ConcatenatedGridResource.java | 20 ---
.../storage/aggregate/CoverageAggregator.java | 22 +--
.../storage/aggregate/GridSliceLocator.java | 2 +-
.../internal/storage/aggregate/GroupAggregate.java | 19 ---
.../sis/internal/storage/esri/AsciiGridStore.java | 13 +-
.../sis/internal/storage/esri/RawRasterStore.java | 6 +-
.../apache/sis/internal/storage/folder/Store.java | 1 -
.../internal/storage/image/SingleImageStore.java | 8 +-
.../internal/storage/image/WorldFileResource.java | 26 +--
.../org/apache/sis/storage/CoverageSubset.java | 22 +--
.../java/org/apache/sis/storage/FeatureSubset.java | 2 +-
.../apache/sis/storage/GridCoverageResource.java | 12 +-
.../org/apache/sis/storage/CoverageQueryTest.java | 8 +-
.../org/apache/sis/storage/FeatureQueryTest.java | 6 -
.../org/apache/sis/storage/GridResourceMock.java | 6 +-
37 files changed, 267 insertions(+), 378 deletions(-)
[sis] 03/04: Remove reference to source `Resource` in metadata of derived resource. This is a partial revert of f2f389fa68f4112a35733d85182b06951e0de3ca.
Posted by de...@apache.org.
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 99646bbeb716490485d6541f732a460288dedf63
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 14 15:18:30 2022 +0200
Remove reference to source `Resource` in metadata of derived resource.
This is a partial revert of f2f389fa68f4112a35733d85182b06951e0de3ca.
---
.../sis/internal/storage/MetadataBuilder.java | 46 +++---
.../sis/internal/storage/ResourceLineage.java | 184 +++++++--------------
.../sis/internal/storage/StoreUtilities.java | 26 ---
.../storage/aggregate/AggregatedResource.java | 7 -
.../aggregate/ConcatenatedGridResource.java | 20 ---
.../storage/aggregate/CoverageAggregator.java | 22 +--
.../internal/storage/aggregate/GroupAggregate.java | 19 ---
.../apache/sis/internal/storage/folder/Store.java | 1 -
.../org/apache/sis/storage/CoverageSubset.java | 2 +-
.../java/org/apache/sis/storage/FeatureSubset.java | 2 +-
.../org/apache/sis/storage/CoverageQueryTest.java | 8 +-
.../org/apache/sis/storage/FeatureQueryTest.java | 6 -
12 files changed, 92 insertions(+), 251 deletions(-)
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
index e6fbad0cd9..7b2e0d2c55 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/MetadataBuilder.java
@@ -73,7 +73,6 @@ import org.apache.sis.metadata.iso.maintenance.*;
import org.apache.sis.metadata.iso.spatial.*;
import org.apache.sis.metadata.sql.MetadataStoreException;
import org.apache.sis.metadata.sql.MetadataSource;
-import org.apache.sis.storage.Resource;
import org.apache.sis.storage.AbstractResource;
import org.apache.sis.storage.AbstractFeatureSet;
import org.apache.sis.storage.AbstractGridCoverageResource;
@@ -1199,7 +1198,7 @@ public class MetadataBuilder {
* This operation does nothing if the title is already defined and the given
* title is already used as an identifier (this policy is a complement of the
* {@link #addTitleOrIdentifier(String, Scope)} behavior).
- * Storage location is:
+ * Storage locations are:
*
* <ul>
* <li>{@code metadata/identificationInfo/citation/title} if not yet used</li>
@@ -1980,7 +1979,7 @@ parse: for (int i = 0; i < length;) {
/**
* Adds descriptions for the given feature.
- * Storage location is:
+ * Storage locations are:
*
* <ul>
* <li>{@code metadata/contentInfo/featureTypes/featureTypeName}</li>
@@ -2009,7 +2008,7 @@ parse: for (int i = 0; i < length;) {
/**
* Adds descriptions for a feature of the given name.
- * Storage location is:
+ * Storage locations are:
*
* <ul>
* <li>{@code metadata/contentInfo/featureTypes/featureTypeName}</li>
@@ -2187,7 +2186,7 @@ parse: for (int i = 0; i < length;) {
/**
* Sets whether parameters for transformation, control/check point(s) or orientation parameters are available.
- * Storage location are:
+ * Storage locations are:
*
* <ul>
* <li>If georeferenceable:<ul>
@@ -2242,7 +2241,7 @@ parse: for (int i = 0; i < length;) {
* Adds <cite>check points</cite> (if georectified) or <cite>ground control points</cite> (if georeferenceable).
* Ground control points (GCP) are large marked targets on the ground. GCP should not be used for storing the
* localization grid (e.g. "model tie points" in a GeoTIFF file).
- * Storage location is:
+ * Storage locations are:
*
* <ul>
* <li>{@code metadata/spatialRepresentationInfo/checkPoint/geographicCoordinates} if georectified</li>
@@ -2607,7 +2606,7 @@ parse: for (int i = 0; i < length;) {
/**
* Sets the scale factor and offset which have been applied to the cell value.
* The transfer function type is declared {@linkplain TransferFunctionType#LINEAR linear}
- * Storage location is:
+ * Storage locations are:
*
* <ul>
* <li>{@code metadata/contentInfo/attributeGroup/attribute/scale}</li>
@@ -2895,32 +2894,35 @@ parse: for (int i = 0; i < length;) {
}
/**
- * Adds metadata about the sources of a resource.
- * Storage location is:
+ * Adds a source described by the given metadata.
+ * Storage locations are:
*
* <ul>
- * <li>{@code metadata/resourceLineage/source}</li>
+ * <li>{@code metadata/resourceLineage/source/description}</li>
+ * <li>{@code metadata/resourceLineage/source/citation}</li>
+ * <li>{@code metadata/resourceLineage/source/scope/level}</li>
+ * <li>{@code metadata/resourceLineage/source/scope/extent}</li>
+ * <li>{@code metadata/resourceLineage/source/sourceReferenceSystem}</li>
+ * <li>{@code metadata/resourceLineage/source/sourceSpatialResolution}</li>
* </ul>
*
- * @param sources the sources of the resource for which to describe the lineage.
- * @throws DataStoreException if an error occurred while fetching metadata from a resource.
+ * @param source metadata about a source of the resource for which to describe the lineage.
*
* @see #addLineage(CharSequence)
* @see #addProcessDescription(CharSequence)
*/
- public final void addSources(final Resource... sources) throws DataStoreException {
- if (sources != null && sources.length != 0) {
- final ResourceLineage[] wrappers = new ResourceLineage[sources.length];
- for (int i=0; i<wrappers.length; i++) {
- wrappers[i] = new ResourceLineage(sources[i]);
+ public final void addSource(final Metadata source) {
+ if (source != null) {
+ final ResourceLineage r = new ResourceLineage(source);
+ if (!r.isEmpty()) {
+ addIfNotPresent(lineage().getSources(), r.build());
}
- lineage().getSources().addAll(Arrays.asList(wrappers));
}
}
/**
* Adds information about a source of data used for producing the resource.
- * Storage location is:
+ * Storage locations are:
*
* <ul>
* <li>{@code metadata/resourceLineage/source/description}</li>
@@ -2936,7 +2938,7 @@ parse: for (int i = 0; i < length;) {
* @param level hierarchical level of the source (e.g. model), or {@code null} if unspecified.
* @param feature more detailed name for {@code level}, or {@code null} if none.
*
- * @see #addSources(Resource...)
+ * @see #addSource(Metadata)
* @see #addProcessing(CharSequence, String)
* @see #addProcessDescription(CharSequence)
*/
@@ -2958,7 +2960,7 @@ parse: for (int i = 0; i < length;) {
/**
* Adds information about a source of data used for producing the resource.
- * Storage location is:
+ * Storage locations are:
*
* <ul>
* <li>{@code metadata/resourceLineage/source/scope/level}</li>
@@ -2978,7 +2980,7 @@ parse: for (int i = 0; i < length;) {
* @param level hierarchical level of the source (e.g. feature). Should not be null.
* @param features names of dataset, features or attributes used in the source.
*
- * @see #addSources(Resource...)
+ * @see #addSource(Metadata)
*/
public final void addSource(final Metadata metadata, final ScopeCode level, final CharSequence... features) {
if (metadata != null) {
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ResourceLineage.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ResourceLineage.java
index 6e81c658e0..a5e3aba17e 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ResourceLineage.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/ResourceLineage.java
@@ -20,20 +20,16 @@ import java.util.Collection;
import org.opengis.metadata.Metadata;
import org.opengis.metadata.MetadataScope;
import org.opengis.metadata.extent.Extent;
-import org.opengis.metadata.lineage.Source;
-import org.opengis.metadata.maintenance.Scope;
-import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.metadata.citation.Citation;
+import org.opengis.metadata.maintenance.ScopeCode;
import org.opengis.metadata.identification.Resolution;
import org.opengis.metadata.identification.Identification;
import org.opengis.referencing.ReferenceSystem;
import org.opengis.util.InternationalString;
import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.metadata.ModifiableMetadata;
import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.metadata.iso.lineage.DefaultSource;
import org.apache.sis.metadata.iso.maintenance.DefaultScope;
-import org.apache.sis.storage.DataStoreException;
-import org.apache.sis.storage.Resource;
import static org.apache.sis.internal.util.CollectionsExt.nonNull;
@@ -47,95 +43,77 @@ import static org.apache.sis.internal.util.CollectionsExt.nonNull;
* @since 1.3
* @module
*/
-final class ResourceLineage implements Source {
+final class ResourceLineage {
/**
- * The source of the derived resource described by the lineage.
+ * Description of the level of the source data, or {@code null} if none.
+ * Current implementation uses the first non-null title of a citation.
*/
- public final Resource source;
+ private InternationalString description;
/**
- * Metadata of the source, or {@code null} if none.
- * All properties returned by this class are inferred from those metadata.
+ * Recommended reference to be used for the source data, or {@code null}.
+ * Current implementation uses the first citation provided by {@link Metadata#getIdentificationInfo()}.
*/
- private final Metadata metadata;
+ private Citation sourceCitation;
/**
- * The scope, computed when first requested.
- *
- * @see #getScope()
+ * The type and extent of the source, or {@code null} if none.
+ * Current implementation uses the resource scope declared in source metadata,
+ * together with the source extents.
*/
- private transient Scope scope;
+ private DefaultScope scope;
/**
- * Whether {@link #scope} has been initialized. The result may still be null.
+ * She spatial reference system used by the source data, or {@code null} if none.
+ * Current implementation uses the first reference system declared by metadata.
*/
- private boolean scopeInitialized;
+ private ReferenceSystem referenceSystem;
/**
- * Creates a new source wrapping the given resource.
- *
- * @param source the source of the derived resource described by the resource lineage.
- * @throws DataStoreException if an error occurred while fetching metadata from the source.
+ * Spatial resolution expressed as a scale factor, an angle or a level of detail.
+ * Current implementation uses the first resolution found in identification information.
*/
- ResourceLineage(final Resource source) throws DataStoreException {
- this.source = source;
- metadata = source.getMetadata();
- }
+ private Resolution resolution;
/**
- * Returns a description of the level of the source data.
- * Default implementation returns the title of the {@linkplain #getSourceCitation() source citation}.
- *
- * @return description of the level of the source data, or {@code null} if none.
+ * Returns {@code false} if this object has at least one non-null value.
*/
- @Override
- public InternationalString getDescription() {
- final Citation citation = getSourceCitation();
- return (citation != null) ? citation.getTitle() : null;
+ final boolean isEmpty() {
+ return description == null && sourceCitation == null && scope == null
+ && referenceSystem == null && resolution == null;
}
/**
- * Returns the recommended reference to be used for the source data.
- * Default implementation returns the first citation having a non-null title
- * among the citations provided by {@link Metadata#getIdentificationInfo()}.
+ * Collects information about a source of the derived resource for which to provide lineage.
*
- * @return recommended reference to be used for the source data, or {@code null}.
+ * @param source metadata of a source of the derived resource for which to provide lineage.
*/
- @Override
- public Citation getSourceCitation() {
- if (metadata != null) {
- for (final Identification info : nonNull(metadata.getIdentificationInfo())) {
- final Citation citation = info.getCitation();
- if (citation != null) {
- if (citation.getTitle() != null) {
- return citation;
+ ResourceLineage(final Metadata source) {
+ referenceSystem = CollectionsExt.first(source.getReferenceSystemInfo());
+ for (final Identification info : nonNull(source.getIdentificationInfo())) {
+ final Citation citation = info.getCitation();
+ if (citation != null) {
+ if (sourceCitation == null) {
+ sourceCitation = citation;
+ }
+ if (description == null) {
+ description = citation.getTitle();
+ }
+ }
+ if (resolution == null) {
+ for (final Resolution candidate : nonNull(info.getSpatialResolutions())) {
+ if (candidate != null) {
+ resolution = candidate;
}
}
}
}
- return null;
- }
-
- /**
- * Returns the type and extent of the source. Default implementation returns the resource scope
- * declared in source metadata, together with the {@linkplain #getSourceExtents() source extents}.
- *
- * @return type and extent of the source, or {@code null} if none.
- */
- @Override
- public synchronized Scope getScope() {
- if (!scopeInitialized) {
- scopeInitialized = true;
- final ScopeCode level = getScopeLevel();
- final Collection<? extends Extent> extents = getSourceExtents();
- if (level != null || !extents.isEmpty()) {
- final DefaultScope scope = new DefaultScope(level);
- scope.setExtents(extents);
- scope.transitionTo(ModifiableMetadata.State.FINAL);
- this.scope = scope;
- }
+ final ScopeCode level = getScopeLevel(source);
+ final Collection<? extends Extent> extents = Extents.fromIdentificationInfo(source);
+ if (level != null || !extents.isEmpty()) {
+ scope = new DefaultScope(level);
+ scope.setExtents(extents);
}
- return scope;
}
/**
@@ -143,18 +121,16 @@ final class ResourceLineage implements Source {
*
* @return scope level (coverage, feature, …), or {@code null} if none.
*/
- private ScopeCode getScopeLevel() {
+ private static ScopeCode getScopeLevel(final Metadata source) {
ScopeCode level = null;
- if (metadata != null) {
- for (final MetadataScope ms : nonNull(metadata.getMetadataScopes())) {
- final ScopeCode c = ms.getResourceScope();
- if (c != null) {
- if (level == null) {
- level = c;
- } else if (!level.equals(c)) {
- level = null;
- break;
- }
+ for (final MetadataScope ms : nonNull(source.getMetadataScopes())) {
+ final ScopeCode c = ms.getResourceScope();
+ if (c != null) {
+ if (level == null) {
+ level = c;
+ } else if (!level.equals(c)) {
+ level = null;
+ break;
}
}
}
@@ -162,47 +138,15 @@ final class ResourceLineage implements Source {
}
/**
- * Information about the spatial, vertical and temporal extent of the source data.
- * Default implementation returns all extents declared in {@link Metadata#getIdentificationInfo()}.
- *
- * @return information about the extent of the source data, or an empty collection if none.
- *
- * @deprecated As of ISO 19115:2014, moved to {@link Scope#getExtents()}.
- */
- @Override
- @Deprecated
- public Collection<? extends Extent> getSourceExtents() {
- return Extents.fromIdentificationInfo(metadata);
- }
-
- /**
- * Returns the spatial reference system used by the source data.
- * Default implementation returns the first reference system declared by metadata.
- *
- * @return spatial reference system used by the source data, or {@code null}.
+ * Creates an ISO 19115 metadata object from the information collected in this class.
*/
- @Override
- public ReferenceSystem getSourceReferenceSystem() {
- return (metadata != null) ? CollectionsExt.first(metadata.getReferenceSystemInfo()) : null;
- }
-
- /**
- * Spatial resolution expressed as a scale factor, an angle or a level of detail.
- * Default implementation returns the first resolution found in identification information.
- *
- * @return spatial resolution, or {@code null} if none.
- */
- @Override
- public Resolution getSourceSpatialResolution() {
- if (metadata != null) {
- for (final Identification info : nonNull(metadata.getIdentificationInfo())) {
- for (final Resolution candidate : nonNull(info.getSpatialResolutions())) {
- if (candidate != null) {
- return candidate;
- }
- }
- }
- }
- return null;
+ final DefaultSource build() {
+ final DefaultSource source = new DefaultSource();
+ source.setDescription(description);
+ source.setSourceCitation(sourceCitation);
+ source.setScope(scope);
+ source.setSourceReferenceSystem(referenceSystem);
+ source.setSourceSpatialResolution(resolution);
+ return source;
}
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
index e9b9586c91..eaeb355bab 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
@@ -18,8 +18,6 @@ package org.apache.sis.internal.storage;
import java.util.Set;
import java.util.EnumSet;
-import java.util.List;
-import java.util.ArrayList;
import java.util.Optional;
import java.util.stream.Stream;
import java.util.logging.Filter;
@@ -36,8 +34,6 @@ import org.opengis.metadata.extent.GeographicExtent;
import org.opengis.metadata.extent.GeographicBoundingBox;
import org.opengis.metadata.identification.Identification;
import org.opengis.metadata.identification.DataIdentification;
-import org.opengis.metadata.lineage.Lineage;
-import org.opengis.metadata.lineage.Source;
import org.apache.sis.util.Static;
import org.apache.sis.storage.FeatureSet;
import org.apache.sis.storage.Resource;
@@ -56,8 +52,6 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Classes;
-import static org.apache.sis.internal.util.CollectionsExt.nonNull;
-
// Branch-dependent imports
import org.opengis.feature.Feature;
@@ -214,26 +208,6 @@ public final class StoreUtilities extends Static {
return bounds;
}
- /**
- * Fetches all resources that are the sources of a resource described by given metadata.
- *
- * @param metadata metadata of the resource for which to get the sources, or {@code null} if none.
- * @return sources found in given metadata.
- */
- public static List<Resource> getSources(final Metadata metadata) {
- final List<Resource> sources = new ArrayList<>();
- if (metadata != null) {
- for (final Lineage lineage : nonNull(metadata.getResourceLineages())) {
- for (final Source candidate : nonNull(lineage.getSources())) {
- if (candidate instanceof ResourceLineage) {
- sources.add(((ResourceLineage) candidate).source);
- }
- }
- }
- }
- return sources;
- }
-
/**
* Returns the most specific interface implemented by the given class.
* For indicative purpose only, as this method has arbitrary behavior if more than one leaf is found.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/AggregatedResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/AggregatedResource.java
index 315d96d246..2537d356b6 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/AggregatedResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/AggregatedResource.java
@@ -16,8 +16,6 @@
*/
package org.apache.sis.internal.storage.aggregate;
-import org.apache.sis.storage.Resource;
-
/**
* The result of an aggregation computed by {@link CoverageAggregator}.
@@ -34,9 +32,4 @@ interface AggregatedResource {
* @param name new name of the resource.
*/
void setName(String name);
-
- /**
- * Specifies the resource to declare in lineage metadata as the source of this resource.
- */
- void setSourceMetadata(Resource source);
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedGridResource.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedGridResource.java
index 9bf705d312..0b5f48fa67 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedGridResource.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedGridResource.java
@@ -29,7 +29,6 @@ import org.apache.sis.coverage.grid.GridExtent;
import org.apache.sis.coverage.grid.GridGeometry;
import org.apache.sis.coverage.grid.GridRoundingMode;
import org.apache.sis.geometry.ImmutableEnvelope;
-import org.apache.sis.storage.Resource;
import org.apache.sis.storage.AbstractGridCoverageResource;
import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.GridCoverageResource;
@@ -130,12 +129,6 @@ final class ConcatenatedGridResource extends AbstractGridCoverageResource implem
*/
private double[][] resolutions;
- /**
- * An optional resource to declare as the source of this aggregate in lineage metadata.
- * This is reset to {@code null} when no longer needed.
- */
- private Resource sourceMetadata;
-
/**
* Creates a new aggregated resource.
*
@@ -177,15 +170,6 @@ final class ConcatenatedGridResource extends AbstractGridCoverageResource implem
this.name = name;
}
- /**
- * Specifies the resource to declare in lineage metadata as the source of this resource.
- * This information is used for metadata.
- */
- @Override
- public void setSourceMetadata(final Resource source) {
- sourceMetadata = source;
- }
-
/**
* Creates when first requested the metadata about this resource.
*/
@@ -194,10 +178,6 @@ final class ConcatenatedGridResource extends AbstractGridCoverageResource implem
final MetadataBuilder builder = new MetadataBuilder();
builder.addTitle(name);
builder.addDefaultMetadata(this, listeners);
- if (sourceMetadata != null) {
- builder.addSources(sourceMetadata);
- sourceMetadata = null;
- }
return builder.build();
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/CoverageAggregator.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/CoverageAggregator.java
index b6e5cbfca9..b16486ddbe 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/CoverageAggregator.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/CoverageAggregator.java
@@ -58,11 +58,6 @@ public final class CoverageAggregator extends Group<GroupBySample> {
*/
private final Map<Set<Resource>, Queue<Aggregate>> aggregates;
- /**
- * An optional resource to declare as the source of this aggregate in lineage metadata.
- */
- private Resource sourceMetadata;
-
/**
* Creates an initially empty aggregator.
*
@@ -187,17 +182,6 @@ public final class CoverageAggregator extends Group<GroupBySample> {
return Optional.empty();
}
- /**
- * Sets the resource to declare as the source in lineage metadata.
- * Note that it will cause the aggregation returned by {@link #build()}
- * to hold a strong reference to the resource specified to this method.
- *
- * @param source the resource to declare as the source in lineage metadata.
- */
- public void setSourceMetadata(final Resource source) {
- sourceMetadata = source;
- }
-
/**
* Builds a resource which is the aggregation or concatenation of all components added to this aggregator.
* The returned resource will be an instance of {@link GridCoverageResource} if possible,
@@ -212,10 +196,6 @@ public final class CoverageAggregator extends Group<GroupBySample> {
public Resource build() {
final GroupAggregate aggregate = prepareAggregate(listeners);
aggregate.fillWithChildAggregates(this, GroupBySample::createComponents);
- final Resource result = aggregate.simplify(this);
- if (result instanceof AggregatedResource) {
- ((AggregatedResource) result).setSourceMetadata(sourceMetadata);
- }
- return result;
+ return aggregate.simplify(this);
}
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GroupAggregate.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GroupAggregate.java
index f28902ecf8..ace63ef45c 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GroupAggregate.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GroupAggregate.java
@@ -98,12 +98,6 @@ final class GroupAggregate extends AbstractResource implements Aggregate, Aggreg
*/
List<SampleDimension> sampleDimensions;
- /**
- * An optional resource to declare as the source of this aggregate in lineage metadata.
- * This is reset to {@code null} when no longer needed.
- */
- private Resource sourceMetadata;
-
/**
* Creates a new aggregate with the specified number of components.
* One of the {@code fill(…)} methods must be invoked after this constructor.
@@ -237,15 +231,6 @@ final class GroupAggregate extends AbstractResource implements Aggregate, Aggreg
this.name = name;
}
- /**
- * Specifies the resource to declare in lineage metadata as the source of this resource.
- * This information is used for metadata.
- */
- @Override
- public void setSourceMetadata(final Resource source) {
- sourceMetadata = source;
- }
-
/**
* Creates when first requested the metadata about this aggregate.
* The metadata contains the title for this aggregation, the sample dimensions
@@ -265,10 +250,6 @@ final class GroupAggregate extends AbstractResource implements Aggregate, Aggreg
builder.addNewBand(band);
}
}
- if (sourceMetadata != null) {
- builder.addSources(sourceMetadata);
- sourceMetadata = null;
- }
return builder.build();
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
index 540bd1b6bf..364a1e4dda 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
@@ -417,7 +417,6 @@ class Store extends DataStore implements StoreResource, UnstructuredAggregate, D
if (structuredView == null) {
final CoverageAggregator aggregator = new CoverageAggregator(listeners);
aggregator.addComponents(this);
- aggregator.setSourceMetadata(this);
structuredView = aggregator.build();
}
return structuredView;
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 b8d90c82c6..dab4082bcd 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
@@ -78,7 +78,7 @@ final class CoverageSubset extends AbstractGridCoverageResource {
builder.addDefaultMetadata(this, listeners);
builder.addLineage(Resources.formatInternational(Resources.Keys.UnfilteredData));
builder.addProcessDescription(Resources.formatInternational(Resources.Keys.SubsetQuery_1, StoreUtilities.getLabel(source)));
- builder.addSources(source);
+ builder.addSource(source.getMetadata());
return builder.build();
}
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java
index 4ffd33face..cbd8acfc28 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java
@@ -81,7 +81,7 @@ final class FeatureSubset extends AbstractFeatureSet {
builder.addDefaultMetadata(this, listeners);
builder.addLineage(Resources.formatInternational(Resources.Keys.UnfilteredData));
builder.addProcessDescription(Resources.formatInternational(Resources.Keys.SubsetQuery_1, StoreUtilities.getLabel(source)));
- builder.addSources(source);
+ builder.addSource(source.getMetadata());
return builder.build();
}
diff --git a/storage/sis-storage/src/test/java/org/apache/sis/storage/CoverageQueryTest.java b/storage/sis-storage/src/test/java/org/apache/sis/storage/CoverageQueryTest.java
index ebe47db3cc..305908c2a8 100644
--- a/storage/sis-storage/src/test/java/org/apache/sis/storage/CoverageQueryTest.java
+++ b/storage/sis-storage/src/test/java/org/apache/sis/storage/CoverageQueryTest.java
@@ -23,20 +23,18 @@ import org.apache.sis.coverage.grid.GridCoverage;
import org.apache.sis.coverage.grid.GridExtent;
import org.apache.sis.coverage.grid.GridGeometry;
import org.apache.sis.internal.referencing.j2d.AffineTransform2D;
-import org.apache.sis.internal.storage.StoreUtilities;
import org.apache.sis.referencing.crs.HardCodedCRS;
import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;
-import static org.apache.sis.test.TestUtilities.getSingleton;
/**
* Tests {@link CoverageQuery} and (indirectly) {@link CoverageSubset}.
*
* @author Johann Sorel (Geomatys)
- * @version 1.3
+ * @version 1.1
* @since 1.1
*/
public final strictfp class CoverageQueryTest extends TestCase {
@@ -180,9 +178,5 @@ public final strictfp class CoverageQueryTest extends TestCase {
request = createSubGrid(-4 + expansion);
}
assertEquals(request, coverage.getGridGeometry());
- /*
- * Verify lineage metadata. They are stored in specialized sub-type of `Source`.
- */
- assertSame(resource, getSingleton(StoreUtilities.getSources(subset.getMetadata())));
}
}
diff --git a/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureQueryTest.java b/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureQueryTest.java
index 3e8313826a..5013f02848 100644
--- a/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureQueryTest.java
+++ b/storage/sis-storage/src/test/java/org/apache/sis/storage/FeatureQueryTest.java
@@ -22,14 +22,12 @@ import java.util.Iterator;
import java.util.stream.Collectors;
import org.apache.sis.feature.builder.FeatureTypeBuilder;
import org.apache.sis.internal.storage.MemoryFeatureSet;
-import org.apache.sis.internal.storage.StoreUtilities;
import org.apache.sis.filter.DefaultFilterFactory;
import org.apache.sis.test.TestUtilities;
import org.apache.sis.test.TestCase;
import org.junit.Test;
import static org.junit.Assert.*;
-import static org.apache.sis.test.TestUtilities.getSingleton;
// Branch-dependent imports
import org.opengis.feature.Feature;
@@ -143,10 +141,6 @@ public final strictfp class FeatureQueryTest extends TestCase {
+ "Actual:%n%s%n", i, expected, actual));
}
}
- /*
- * Verify lineage metadata. They are stored in specialized sub-type of `Source`.
- */
- assertSame(featureSet, getSingleton(StoreUtilities.getSources(fs.getMetadata())));
}
/**
[sis] 04/04: Make `GridExtent.intersect(…)` and `union(…)` methods public.
Posted by de...@apache.org.
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 6f8c006837313884f4751b0fb9e9a266464bbc12
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 14 16:29:37 2022 +0200
Make `GridExtent.intersect(…)` and `union(…)` methods public.
---
.../org/apache/sis/coverage/grid/GridExtent.java | 42 ++++++++++++++++------
.../apache/sis/coverage/grid/GridExtentTest.java | 18 ++++++++++
.../java/org/apache/sis/util/resources/Errors.java | 5 +++
.../apache/sis/util/resources/Errors.properties | 1 +
.../apache/sis/util/resources/Errors_fr.properties | 1 +
5 files changed, 57 insertions(+), 10 deletions(-)
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index ce9832b8fa..d7cbff64fe 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -31,6 +31,7 @@ import org.opengis.util.FactoryException;
import org.opengis.util.InternationalString;
import org.opengis.geometry.Envelope;
import org.opengis.geometry.DirectPosition;
+import org.opengis.geometry.MismatchedDimensionException;
import org.opengis.metadata.spatial.DimensionNameType;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystem;
@@ -1731,29 +1732,35 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
/**
* Returns the intersection of this grid extent with to the given grid extent.
- * The given extent shall have the same number of dimensions.
- *
- * <p>This method is not public because we do not yet have a policy
- * about whether we should verify if axis {@link #types} match.</p>
+ * The given extent shall have the same number of dimensions than this extent.
+ * The {@linkplain #getAxisType(int) axis types} (vertical, temporal, …) must
+ * be the same in all dimensions, ignoring types that are absent.
*
* @param other the grid to intersect with.
* @return the intersection result. May be one of the existing instances.
+ * @throws MismatchedDimensionException if the two extents do not have the same number of dimensions.
+ * @throws IllegalArgumentException} if axis types are specified but inconsistent for at least one dimension.
+ *
+ * @since 1.3
*/
- final GridExtent intersect(final GridExtent other) {
+ public GridExtent intersect(final GridExtent other) {
return combine(other, false);
}
/**
* Returns the union of this grid extent with to the given grid extent.
- * The given extent shall have the same number of dimensions.
- *
- * <p>This method is not public because we do not yet have a policy
- * about whether we should verify if axis {@link #types} match.</p>
+ * The given extent shall have the same number of dimensions than this extent.
+ * The {@linkplain #getAxisType(int) axis types} (vertical, temporal, …) must
+ * be the same in all dimensions, ignoring types that are absent.
*
* @param other the grid to combine with.
* @return the union result. May be one of the existing instances.
+ * @throws MismatchedDimensionException if the two extents do not have the same number of dimensions.
+ * @throws IllegalArgumentException} if axis types are specified but inconsistent for at least one dimension.
+ *
+ * @since 1.3
*/
- final GridExtent union(final GridExtent other) {
+ public GridExtent union(final GridExtent other) {
return combine(other, true);
}
@@ -1763,6 +1770,21 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
private GridExtent combine(final GridExtent other, final boolean union) {
final int n = coordinates.length;
final int m = n >>> 1;
+ if (n != other.coordinates.length) {
+ throw new MismatchedDimensionException(Errors.format(
+ Errors.Keys.MismatchedDimension_3, "other", m, other.getDimension()));
+ }
+ if (types != null && other.types != null) {
+ for (int i=0; i<m; i++) {
+ final DimensionNameType t1 = types[i];
+ if (t1 != null) {
+ final DimensionNameType t2 = other.types[i];
+ if (t2 != null && !t1.equals(t2)) {
+ throw new IllegalArgumentException(Errors.format(Errors.Keys.MismatchedAxes_3, i, t1, t2));
+ }
+ }
+ }
+ }
final long[] clipped = new long[n];
int i = 0;
while (i < m) {clipped[i] = extremum(coordinates[i], other.coordinates[i], !union); i++;}
diff --git a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
index 4a7b022bd5..71081a3b2e 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/coverage/grid/GridExtentTest.java
@@ -297,6 +297,24 @@ public final strictfp class GridExtentTest extends TestCase {
assertSame(extent.union(domain), extent);
}
+ /**
+ * Tests {@link GridExtent#intersect(GridExtent)} with inconsistent axis types.
+ * An exception should be thrown.
+ */
+ @Test
+ public void testCombineInvalid() {
+ final GridExtent domain = createOther();
+ final GridExtent other = new GridExtent(
+ new DimensionNameType[] {DimensionNameType.COLUMN, DimensionNameType.TRACK, DimensionNameType.TIME},
+ new long[] {100, 200, 40}, new long[] {500, 800, 50}, false);
+ try {
+ domain.intersect(other);
+ fail("Should not be allowed");
+ } catch (IllegalArgumentException e) {
+ assertNotNull(e.getMessage());
+ }
+ }
+
/**
* Tests {@link GridExtent#slice(DirectPosition, int[])}.
*/
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
index 195d419288..746408fe44 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
@@ -536,6 +536,11 @@ public final class Errors extends IndexedResourceBundle {
*/
public static final short MismatchedArrayLengths = 77;
+ /**
+ * Mismatched axes “{1}” and “{2}” at dimension {0}.
+ */
+ public static final short MismatchedAxes_3 = 200;
+
/**
* The coordinate reference system must be the same for all objects.
*/
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
index 9919d73574..41715c196c 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
@@ -118,6 +118,7 @@ InvalidVersionIdentifier_1 = \u201c{0}\u201d is an invalid version identi
KeyCollision_1 = Key \u201c{0}\u201d is associated twice to different values.
MandatoryAttribute_2 = Attribute \u201c{0}\u201d is mandatory for an object of type \u2018{1}\u2019.
MismatchedArrayLengths = Mismatched array lengths.
+MismatchedAxes_3 = Mismatched axes \u201c{1}\u201d and \u201c{2}\u201d at dimension {0}.
MismatchedCRS = The coordinate reference system must be the same for all objects.
MismatchedDimension_2 = Mismatched object dimensions: {0}D and {1}D.
MismatchedDimension_3 = Argument \u2018{0}\u2019 has {2} dimension{2,choice,1#|2#s}, while {1} was expected.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
index 2f74f10f84..6a056fe34b 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
@@ -115,6 +115,7 @@ InvalidVersionIdentifier_1 = \u00ab\u202f{0}\u202f\u00bb n\u2019est pas u
KeyCollision_1 = La cl\u00e9 \u00ab\u202f{0}\u202f\u00bb est associ\u00e9e deux fois \u00e0 des valeurs diff\u00e9rentes.
MandatoryAttribute_2 = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb est obligatoire pour un objet de type \u2018{1}\u2019.
MismatchedArrayLengths = Les dimensions des tableaux ne correspondent pas.
+MismatchedAxes_3 = Les axes \u00ab\u202f{1}\u202f\u00bb et \u00ab\u202f{2}\u202f\u00bb \u00e0 la dimension {0} ne correspondent pas.
MismatchedCRS = Le syst\u00e8me de r\u00e9f\u00e9rence des coordonn\u00e9es doit \u00eatre le m\u00eame pour tous les objets.
MismatchedDimension_2 = Les dimensions des objets ({0}D et {1}D) ne concordent pas.
MismatchedDimension_3 = L\u2019argument \u2018{0}\u2019 a {2} dimension{2,choice,1#|2#s}, alors qu\u2019on en attendait {1}.
[sis] 01/04: Rename `range` argument as `ranges`. There is no significant code change in this commit.
Posted by de...@apache.org.
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 {
[sis] 02/04: Fix a spelling error: "fist" → "first".
Posted by de...@apache.org.
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 a26b7f40155b7a3cc225a7dbff75eb18e5f608e8
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed Sep 14 11:15:16 2022 +0200
Fix a spelling error: "fist" → "first".
---
.../src/main/java/org/apache/sis/geometry/Envelope2D.java | 2 +-
.../src/test/java/org/apache/sis/io/wkt/WKTDictionaryTest.java | 2 +-
.../apache/sis/referencing/operation/CoordinateOperationFinderTest.java | 2 +-
core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java | 2 +-
.../src/main/java/org/apache/sis/util/collection/TreeTableFormat.java | 2 +-
.../main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java | 2 +-
.../org/apache/sis/internal/storage/aggregate/GridSliceLocator.java | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
index a4339ef56b..35df305de9 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelope2D.java
@@ -174,7 +174,7 @@ public class Envelope2D extends Rectangle2D.Double implements Envelope, Emptiabl
* the minimal and maximal values respectively.
* See the class javadoc about crossing the anti-meridian for more details.
*
- * @param lowerCorner the fist position.
+ * @param lowerCorner the first position.
* @param upperCorner the second position.
* @throws MismatchedReferenceSystemException if the two positions don't use the same CRS.
* @throws MismatchedDimensionException if the two positions are not two-dimensional.
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTDictionaryTest.java b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTDictionaryTest.java
index 809e62e886..63230da7ed 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTDictionaryTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTDictionaryTest.java
@@ -129,7 +129,7 @@ public final strictfp class WKTDictionaryTest extends TestCase {
*/
new SharedValuesCheck().verify(factory);
/*
- * "TEST" code space should be fist because it is the most frequently used
+ * "TEST" code space should be first because it is the most frequently used
* in the test file. The authority should be "TEST" for the same reason.
* Codes can be in any order. Code spaces are omitted when there is no ambiguity.
*/
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
index 64c1a7024f..7ac174cc25 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java
@@ -134,7 +134,7 @@ public final strictfp class CoordinateOperationFinderTest extends MathTransformT
factory = new DefaultCoordinateOperationFactory();
parser = new WKTFormat(null, null);
/*
- * The fist keyword in WKT below should be "GeodeticCRS" in WKT 2, but we use the WKT 1 keyword ("GEOGCS")
+ * The first keyword in WKT below should be "GeodeticCRS" in WKT 2, but we use the WKT 1 keyword ("GEOGCS")
* for allowing inclusion in ProjectedCRS. SIS is okay with mixed WKT versions, but this is of course not
* something to recommend in production.
*/
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java b/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
index da114b333b..235e89a04f 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
@@ -2121,7 +2121,7 @@ cmp: while (ia < lga) {
* </ul>
*
* @param text the text for which to get the token.
- * @param fromIndex index of the fist character to consider in the given text.
+ * @param fromIndex index of the first character to consider in the given text.
* @return a sub-sequence of {@code text} starting at the given offset, or an empty string
* if there are no non-blank character at or after the given offset.
* @throws NullPointerException if the {@code text} argument is null.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java b/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
index 2f79f6fcf5..8d1aeed711 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
@@ -450,7 +450,7 @@ public class TreeTableFormat extends TabularFormat<TreeTable> {
break; // The line contains only whitespaces.
}
/*
- * Go back to the fist non-space character (should be '─'). We do that in case the
+ * Go back to the first non-space character (should be '─'). We do that in case the
* user puts some spaces in the text of the node label, since we don't want those
* user-spaces to interfer with the calculation of indentation.
*/
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
index 9fcfecb56c..6b82e8e78a 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
@@ -1058,7 +1058,7 @@ nextVar: for (final VariableInfo variable : variables) {
/**
* Adds netCDF attributes to the given node, including variables attributes.
- * Variables attributes are shown fist, and global attributes are last.
+ * Variables attributes are shown first, and global attributes are last.
*
* @param root the node where to add netCDF attributes.
*/
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GridSliceLocator.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GridSliceLocator.java
index 2269efc19e..1cc91e89f2 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GridSliceLocator.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/GridSliceLocator.java
@@ -169,7 +169,7 @@ final class GridSliceLocator {
}
/**
- * Returns the index of the fist slice which intersect the given extent.
+ * Returns the index of the first slice which intersect the given extent.
* This method performs a linear search. For better performance, it should be invoked
* with {@code toIndex} parameter set to {@link #getUpper(GridExtent, int, int)} value.
*