This is an automated email from the ASF dual-hosted git repository. alexismanin pushed a commit to branch fix/geotiff-flaky-test in repository https://gitbox.apache.org/repos/asf/sis.git
commit 2843f7b77fc8f8f26befe97c5fbe6ef6dc320f68 Author: Alexis Manin <[email protected]> AuthorDate: Wed May 20 16:14:45 2026 +0200 feat(Feature): Make SampleDimension lenient comparable --- .../main/org/apache/sis/coverage/SampleDimension.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/SampleDimension.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/SampleDimension.java index 4826bb42de..c491679ab8 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/SampleDimension.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/SampleDimension.java @@ -28,6 +28,9 @@ import java.util.Objects; import java.util.Optional; import java.io.Serializable; import javax.measure.Unit; +import org.apache.sis.util.ComparisonMode; +import org.apache.sis.util.LenientComparable; +import org.apache.sis.util.Utilities; import org.opengis.util.GenericName; import org.opengis.util.InternationalString; import org.opengis.referencing.operation.MathTransform1D; @@ -85,7 +88,7 @@ import org.opengis.feature.IdentifiedType; * * @since 1.0 */ -public class SampleDimension implements IdentifiedType, Serializable { +public class SampleDimension implements IdentifiedType, LenientComparable, Serializable { /** * Serial number for inter-operability with different versions. */ @@ -498,6 +501,18 @@ public class SampleDimension implements IdentifiedType, Serializable { return false; } + @Override + public boolean equals(Object other, ComparisonMode mode) { + if (other == this) return true; + if (mode.isApproximate() && other instanceof SampleDimension) { + final var otherDim = (SampleDimension) other; + return Utilities.deepEquals(this.transferFunction, otherDim.transferFunction, mode) + && Utilities.deepEquals(this.categories, otherDim.categories, mode) + && Utilities.deepEquals(this.background, otherDim.background, mode); + } + return equals(other); + } + /** * Returns a string representation of this sample dimension. * This string is for debugging purpose only and may change in future version.
