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 834dab14057a8f8d1689bcf9f927aa668a8bb601
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Tue Aug 16 18:12:54 2022 +0200

    Documentation, localisation, minor code formatting.
---
 .../apache/sis/coverage/grid/GridDerivation.java   |  1 +
 .../org/apache/sis/internal/storage/Resources.java |  5 ++++
 .../sis/internal/storage/Resources.properties      |  1 +
 .../sis/internal/storage/Resources_fr.properties   |  1 +
 .../storage/aggregate/ConcatenatedFeatureSet.java  | 34 +++++++++++++---------
 .../apache/sis/storage/GridCoverageResource.java   |  3 ++
 6 files changed, 31 insertions(+), 14 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
index d1eb24b974..6a5ef345ef 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
@@ -1199,6 +1199,7 @@ public class GridDerivation {
      * <p>This method can be invoked after {@link #build()} for getting 
additional information.</p>
      *
      * @return intersection of grid geometry extents in units of {@link #base} 
grid cells.
+     * @throws IncompleteGridGeometryException if the base grid geometry has 
no extent.
      */
     public GridExtent getIntersection() {
         return getBaseExtentExpanded(true);
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
index 39b136756a..a4fe0b30c9 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
@@ -316,6 +316,11 @@ public final class Resources extends IndexedResourceBundle 
{
          */
         public static final short MissingSchemeInURI_1 = 11;
 
+        /**
+         * No feature type is common to all the features to aggregate.
+         */
+        public static final short NoCommonFeatureType = 75;
+
         /**
          * No directory of resources found at “{0}”.
          */
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
index 0f863cd896..ad995bb769 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
@@ -70,6 +70,7 @@ LoadedGridCoverage_6              = Loaded grid coverage 
between {1} \u2013 {2}
 MarkNotSupported_1                = Marks are not supported on \u201c{0}\u201d 
stream.
 MissingResourceIdentifier_1       = Resource \u201c{0}\u201d does not have an 
identifier.
 MissingSchemeInURI_1              = Missing scheme in \u201c{0}\u201d URI.
+NoCommonFeatureType               = No feature type is common to all the 
features to aggregate.
 NoSuchResourceDirectory_1         = No directory of resources found at 
\u201c{0}\u201d.
 NoSuchResourceInAggregate_2       = Resource \u201c{1}\u201d is not part of 
aggregate \u201c{0}\u201d.
 NotAWritableFeatureSet_1          = Resource \u201c{0}\u201d is not a writable 
feature set.
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
index 3a5d43e79b..bae8560190 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
@@ -75,6 +75,7 @@ LoadedGridCoverage_6              = Lecture d\u2019une 
couverture de donn\u00e9e
 MarkNotSupported_1                = Les marques ne sont pas support\u00e9es 
sur le flux \u00ab\u202f{0}\u202f\u00bb.
 MissingResourceIdentifier_1       = La ressource \u00ab\u202f{0}\u202f\u00bb 
n\u2019a pas d\u2019identifiant.
 MissingSchemeInURI_1              = Il manque le sch\u00e9ma dans l\u2019URI 
\u00ab\u202f{0}\u202f\u00bb.
+NoCommonFeatureType               = Il n\u2019y a pas de type commun \u00e0 
toutes les entit\u00e9s \u00e0 agr\u00e9ger.
 NoSuchResourceDirectory_1         = Aucun r\u00e9pertoire de ressources 
n\u2019a \u00e9t\u00e9 trouv\u00e9 \u00e0 l\u2019emplacement 
\u00ab\u202f{0}\u202f\u00bb.
 NoSuchResourceInAggregate_2       = La ressource \u00ab\u202f{1}\u202f\u00bb 
n\u2019est pas une partie de l\u2019agr\u00e9gat \u00ab\u202f{0}\u202f\u00bb.
 NotAWritableFeatureSet_1          = La ressource \u00ab\u202f{0}\u202f\u00bb 
n\u2019est pas un ensemble d\u2019entit\u00e9s accessibles en \u00e9criture.
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedFeatureSet.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedFeatureSet.java
index e20f898012..3aa4aac9a2 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedFeatureSet.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/aggregate/ConcatenatedFeatureSet.java
@@ -30,6 +30,7 @@ import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.BackingStoreException;
 import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
+import org.apache.sis.internal.storage.Resources;
 import org.apache.sis.storage.AbstractFeatureSet;
 import org.apache.sis.storage.event.StoreListeners;
 import org.apache.sis.storage.Query;
@@ -40,15 +41,19 @@ import org.opengis.feature.FeatureType;
 
 
 /**
- * Exposes a sequence of {@link FeatureSet}s as a single one. A few notes:
- * <ol>
- *   <li>The feature set concatenation must be built with a non-empty array or 
collection of feature set.
- *     It is copied verbatim in an unmodifiable list, meaning that duplicated 
instances won't be removed,
- *     and iteration order is driven by input sequence.</li>
- *   <li>All input feature sets must share a common type, or at least a common 
super-type. If you want to sequence
- *     sets which does not share any common parent, please pre-process them to 
modify their public type.</li>
- *   <li>There is no {@linkplain #getIdentifier() identifier} since this 
feature set is a computation result.</li>
- * </ol>
+ * Exposes a sequence of {@link FeatureSet}s as a single one.
+ * The concatenation is built from an array or collection of input feature 
sets,
+ * copied verbatim in iteration order and without removal of duplicated 
elements.
+ * All input feature sets must share a common type, or at least a common 
super-type.
+ * The {@linkplain #getType() feature type of this concatenated set} will be 
the
+ * {@linkplain Features#findCommonParent(Iterable) most specific type} found 
among all input feature sets.
+ *
+ * <h2>Identification</h2>
+ * There is no {@linkplain #getIdentifier() identifier} since this feature set 
is a computation result.
+ *
+ * <h2>Multi-threading</h2>
+ * Concatenated feature set is immutable and thread-safe if all input feature 
sets
+ * are immutable and thread-safe.
  *
  * @author  Alexis Manin (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -101,7 +106,7 @@ public class ConcatenatedFeatureSet extends 
AggregatedFeatureSet {
         commonType = Features.findCommonParent(Arrays.asList(types));
         if (commonType == null) {
             // TODO: localize.
-            throw new DataStoreContentException("Cannot find a common super 
type across all feature sets to concatenate");
+            throw new 
DataStoreContentException(Resources.format(Resources.Keys.NoCommonFeatureType));
         }
     }
 
@@ -136,7 +141,9 @@ public class ConcatenatedFeatureSet extends 
AggregatedFeatureSet {
         ArgumentChecks.ensureNonNull("sources", sources);
         final int size = sources.size();
         switch (size) {
-            case 0: throw new 
IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, "sources"));
+            case 0: {
+                throw new 
IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, "sources"));
+            }
             case 1: {
                 final FeatureSet fs = CollectionsExt.first(sources);
                 ArgumentChecks.ensureNonNullElement("sources", 0, fs);
@@ -184,8 +191,7 @@ public class ConcatenatedFeatureSet extends 
AggregatedFeatureSet {
                 if (count.isPresent()) {
                     final long c = count.getAsLong();
                     if (c >= 0) {                               // Paranoiac 
check.
-                        sum += c;
-                        if (sum < 0) {                          // Integer 
overflow.
+                        if ((sum += c) < 0) {                   // Integer 
overflow.
                             sum = Long.MAX_VALUE;
                             break;
                         }
@@ -234,7 +240,7 @@ public class ConcatenatedFeatureSet extends 
AggregatedFeatureSet {
         for (int i=0; i<subsets.length; i++) {
             FeatureSet source = sources.get(i);
             subsets[i] = source.subset(query);
-            modified |= subsets[i] != source;
+            modified |= (subsets[i] != source);
         }
         return modified ? new ConcatenatedFeatureSet(subsets, this) : this;
     }
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 9b96bb9d25..f82af4a493 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
@@ -21,6 +21,7 @@ import java.util.Collections;
 import org.apache.sis.coverage.SampleDimension;
 import org.apache.sis.coverage.grid.GridGeometry;
 import org.apache.sis.coverage.grid.GridCoverage;
+import org.apache.sis.coverage.grid.DisjointExtentException;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.ArraysExt;
 
@@ -197,6 +198,8 @@ public interface GridCoverageResource extends DataSet {
      * @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.
+     * @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 DataStoreException if an error occurred while reading the grid 
coverage data.
      */
     GridCoverage read(GridGeometry domain, int... range) throws 
DataStoreException;

Reply via email to