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 35c729f92e3a617ce58466ca670000a54fe062d1 Author: jsorel <[email protected]> AuthorDate: Fri Nov 27 10:32:39 2026 +0100 refactor(Math): remove Vector.transform(Function) --- .../main/org/apache/sis/maths/Vector.java | 14 -------------- .../test/org/apache/sis/maths/AbstractVectorTest.java | 11 ----------- 2 files changed, 25 deletions(-) diff --git a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector.java b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector.java index 8dff66dc59..f59f6793a7 100644 --- a/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector.java +++ b/incubator/src/org.apache.sis.geometry/main/org/apache/sis/maths/Vector.java @@ -16,7 +16,6 @@ */ package org.apache.sis.maths; -import java.util.function.Function; import org.opengis.geometry.DirectPosition; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.operation.MathTransform; @@ -1080,19 +1079,6 @@ public sealed interface Vector<T extends Vector<T>> permits AbstractVector { return (T) Vectors.create(trs.transform(toArrayDouble(), new double[trs.getOutputDimensions()]), getDataType()); } - /** - * Apply the given function on this vector and return its result. - * This is a convenience method for chaining operations, for example - * {@code v.transform(Foo::bar)._normalize()}. This vector is unchanged. - * - * @param <R> type of the function result - * @param fn function to apply on this vector, not null - * @return function result - */ - default <R> R transform(Function<? super T, ? extends R> fn) { - return fn.apply((T) this); - } - /** * Create a direct position view of the given tuple, in the given reference system. * diff --git a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/maths/AbstractVectorTest.java b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/maths/AbstractVectorTest.java index fd99666123..e5f0ac7579 100644 --- a/incubator/src/org.apache.sis.geometry/test/org/apache/sis/maths/AbstractVectorTest.java +++ b/incubator/src/org.apache.sis.geometry/test/org/apache/sis/maths/AbstractVectorTest.java @@ -109,7 +109,6 @@ public abstract class AbstractVectorTest { testDot(vector); testDistance(vector); testVectorTo(vector); - testTransformFunction(vector); testNaNInfinite(tuple); testUnsignedArithmetic(tuple); testNewVectorOperations(tuple); @@ -396,16 +395,6 @@ public abstract class AbstractVectorTest { assertThrows(IllegalArgumentException.class, () -> vector.dot(Vector.of(new double[vector.getDimension() + 1]))); } - /** - * Test applying a function on a vector. - */ - private void testTransformFunction(Vector<?> vector) { - assertSame(vector, vector.transform((v) -> v)); - assertEquals(vector.getDimension(), (int) vector.transform(Vector::getDimension)); - final Vector<?> scaled = vector.transform((v) -> v.scale(2)); - assertArrayEquals(Vectors.scale(vector.toArrayDouble(), 2), scaled.toArrayDouble(), TOLERANCE); - } - /** * Test distance between two vectors. */
