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 39c8542e4147760f07ffde30f135288e4dcc4c8a
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Wed Dec 8 15:05:46 2021 +0100

    Change Interpolation interface to an abstract class.
    Needed for addition of package-private method in next commit.
    
    https://issues.apache.org/jira/browse/SIS-530
---
 .../java/org/apache/sis/image/Interpolation.java   | 24 ++++++++++++++--------
 .../org/apache/sis/image/LanczosInterpolation.java |  4 ++--
 .../java/org/apache/sis/image/Visualization.java   |  2 +-
 3 files changed, 18 insertions(+), 12 deletions(-)

diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/Interpolation.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/Interpolation.java
index b610539..9943dc0 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/Interpolation.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/Interpolation.java
@@ -25,19 +25,25 @@ import java.nio.DoubleBuffer;
  * of pixels using a local neighborhood. The sampling is performed by the 
{@link ResampledImage} class, which
  * gives the sample values to the {@code interpolate(…)} method of this 
interpolation.
  *
- * <p>All methods in this interface shall be safe for concurrent use in 
multi-threading context.
+ * <p>All methods in this class shall be safe for concurrent use in 
multi-threading context.
  * For example interpolations may be executed in a different thread for each 
tile in an image.</p>
  *
- * <p>This interface is designed for interpolations in a two-dimensional space 
only.</p>
+ * <p>This class is designed for interpolations in a two-dimensional space 
only.</p>
  *
  * @author  Rémi Marechal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
- * @version 1.1
+ * @version 1.2
  * @since   1.1
  * @module
  */
-public interface Interpolation {
+public abstract class Interpolation {
+    /**
+     * Creates a new interpolation.
+     */
+    protected Interpolation() {
+    }
+
     /**
      * Returns the size of the area over which the resampling function needs 
to provide values.
      * Common values are:
@@ -53,7 +59,7 @@ public interface Interpolation {
      *
      * @return number of sample values required for interpolations.
      */
-    Dimension getSupportSize();
+    public abstract Dimension getSupportSize();
 
     /**
      * Interpolates sample values for all bands using the given pixel values 
in local neighborhood.
@@ -97,12 +103,12 @@ public interface Interpolation {
      * @param  writeTo        the array where this method shall write 
interpolated values.
      * @param  writeToOffset  index of the first value to put in the {@code 
writeTo} array.
      */
-    void interpolate(DoubleBuffer source, int numBands, double xfrac, double 
yfrac, double[] writeTo, int writeToOffset);
+    public abstract void interpolate(DoubleBuffer source, int numBands, double 
xfrac, double yfrac, double[] writeTo, int writeToOffset);
 
     /**
      * A nearest-neighbor interpolation using 1×1 pixel.
      */
-    Interpolation NEAREST = new Interpolation() {
+    public static final Interpolation NEAREST = new Interpolation() {
         /** Interpolation name for debugging purpose. */
         @Override public String toString() {
             return "NEAREST";
@@ -128,7 +134,7 @@ public interface Interpolation {
      * A bilinear interpolation using 2×2 pixels.
      * If the interpolation result is NaN, this method fallbacks on 
nearest-neighbor.
      */
-    Interpolation BILINEAR = new Interpolation() {
+    public static final Interpolation BILINEAR = new Interpolation() {
         /** Interpolation name for debugging purpose. */
         @Override public String toString() {
             return "BILINEAR";
@@ -167,5 +173,5 @@ public interface Interpolation {
      *
      * @see <a href="https://en.wikipedia.org/wiki/Lanczos_resampling";>Lanczos 
resampling on Wikipedia</a>
      */
-    Interpolation LANCZOS = new LanczosInterpolation(3);
+    public static final Interpolation LANCZOS = new LanczosInterpolation(3);
 }
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/LanczosInterpolation.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/LanczosInterpolation.java
index 8c238a8..fa3d0ae 100644
--- 
a/core/sis-feature/src/main/java/org/apache/sis/image/LanczosInterpolation.java
+++ 
b/core/sis-feature/src/main/java/org/apache/sis/image/LanczosInterpolation.java
@@ -31,14 +31,14 @@ import java.nio.DoubleBuffer;
  *
  * @author  Rémi Marechal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.1
+ * @version 1.2
  *
  * @see <a href="https://en.wikipedia.org/wiki/Lanczos_resampling";>Lanczos 
resampling on Wikipedia</a>
  *
  * @since 1.1
  * @module
  */
-final class LanczosInterpolation implements Interpolation {
+final class LanczosInterpolation extends Interpolation {
     /**
      * The Lanczos window size. This is denoted <var>a</var> in this class 
javadoc.
      */
diff --git 
a/core/sis-feature/src/main/java/org/apache/sis/image/Visualization.java 
b/core/sis-feature/src/main/java/org/apache/sis/image/Visualization.java
index 4e593eb..110aed7 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/Visualization.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/Visualization.java
@@ -317,7 +317,7 @@ final class Visualization extends ResampledImage {
      * destination image. This class is used for combining {@link 
ResampledImage} and {@link BandedSampleConverter}
      * in a single operation.
      */
-    static class InterpConvert implements Interpolation {
+    static class InterpConvert extends Interpolation {
         /**
          * The object to use for performing interpolations.
          *

Reply via email to