This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 41b8832d0e416bffb84c2a838e31f55bcff9e5e1
Author: jsorel <[email protected]>
AuthorDate: Fri Jul 31 10:49:01 2026 +0200

    feat(GridExtent): add getLatticePointCount method
---
 .../main/org/apache/sis/coverage/grid/GridExtent.java  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java
 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java
index c259f8a1af..80ea706435 100644
--- 
a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java
+++ 
b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java
@@ -954,6 +954,24 @@ public class GridExtent implements GridEnvelope, 
LenientComparable, Serializable
         return Numerics.toUnsignedDouble(size);
     }
 
+    /**
+     * Returns the product of each dimension size in this grid extent.
+     *
+     * @return number of lattice points contained inside this grid extent.
+     * @throws ArithmeticException if the count is too large for the {@code 
long} primitive type.
+     * @see #latticePointStream(boolean).
+     * @since 1.7
+     */
+    public long getLatticePointCount() throws ArithmeticException{
+        final int dimension = getDimension();
+        if (dimension == 0) return 0;
+        long n = getSize(0);
+        for (int i = 1; i < dimension; i++) {
+            n = Math.multiplyExact(n, getSize(i));
+        }
+        return n;
+    }
+
     /**
      * A comparator of grid extent sizes where each dimension is compared in 
increasing index order.
      * For a given pair of {@code GridExtent} instances, the comparison begins 
with the

Reply via email to