You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/07/20 10:33:36 UTC
[commons-geometry] 05/09: GEOEMTRY-3: removing RealFunction
interfaces from public API and renaming to DoubleFunction?N
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git
commit 5cce17145097bb598b6db546437366d7b2474e53
Author: Matt Juntunen <ma...@hotmail.com>
AuthorDate: Tue Jul 10 21:56:05 2018 -0400
GEOEMTRY-3: removing RealFunction interfaces from public API and renaming to DoubleFunction?N
---
.../DoubleFunction1N.java} | 6 +++---
.../DoubleFunction2N.java} | 6 +++---
.../DoubleFunction3N.java} | 6 +++---
.../{util => }/internal/SimpleTupleFormat.java | 16 ++++++---------
.../core/{util => }/internal/package-info.java | 2 +-
.../commons/geometry/core/util/package-info.java | 23 ----------------------
.../{util => }/internal/SimpleTupleFormatTest.java | 11 ++++-------
.../geometry/euclidean/oned/Cartesian1D.java | 4 ++--
.../commons/geometry/euclidean/oned/Point1D.java | 15 ++++----------
.../commons/geometry/euclidean/oned/Vector1D.java | 15 ++++----------
.../geometry/euclidean/threed/Cartesian3D.java | 4 ++--
.../commons/geometry/euclidean/threed/Point3D.java | 15 ++++----------
.../geometry/euclidean/threed/Vector3D.java | 15 ++++----------
.../geometry/euclidean/twod/Cartesian2D.java | 4 ++--
.../commons/geometry/euclidean/twod/Point2D.java | 15 ++++----------
.../commons/geometry/euclidean/twod/Vector2D.java | 15 ++++----------
.../geometry/euclidean/oned/Point1DTest.java | 11 -----------
.../geometry/euclidean/oned/Vector1DTest.java | 11 -----------
.../geometry/euclidean/threed/Point3DTest.java | 11 -----------
.../geometry/euclidean/threed/Vector3DTest.java | 11 -----------
.../geometry/euclidean/twod/Point2DTest.java | 11 -----------
.../geometry/euclidean/twod/Vector2DTest.java | 12 -----------
.../commons/geometry/spherical/oned/S1Point.java | 15 ++++----------
.../commons/geometry/spherical/twod/S2Point.java | 15 ++++----------
.../geometry/spherical/oned/S1PointTest.java | 12 -----------
.../geometry/spherical/twod/S2PointTest.java | 11 -----------
26 files changed, 58 insertions(+), 234 deletions(-)
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction1N.java
similarity index 86%
rename from commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction.java
rename to commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction1N.java
index 1b9acb6..6396bbb 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction1N.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.geometry.core.util;
+package org.apache.commons.geometry.core.internal;
-/** Represents a function that accepts a single real number and returns
+/** Represents a function that accepts a single double value and returns
* a result.
* @param <T> The function return type.
*/
@FunctionalInterface
-public interface RealFunction<T> {
+public interface DoubleFunction1N<T> {
/** Apply the function and return the result.
* @param n the function argument
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction2N.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction2N.java
similarity index 87%
rename from commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction2N.java
rename to commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction2N.java
index 20df7c7..36cbf7a 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction2N.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction2N.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.geometry.core.util;
+package org.apache.commons.geometry.core.internal;
-/** Represents a function that accepts two real numbers and returns
+/** Represents a function that accepts two double values and returns
* a result.
* @param <T> The function return type.
*/
@FunctionalInterface
-public interface RealFunction2N<T> {
+public interface DoubleFunction2N<T> {
/** Apply the function and return the result.
* @param n1 first function argument
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction3N.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction3N.java
similarity index 87%
rename from commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction3N.java
rename to commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction3N.java
index 08e22e2..086f003 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/RealFunction3N.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/DoubleFunction3N.java
@@ -14,14 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.geometry.core.util;
+package org.apache.commons.geometry.core.internal;
-/** Represents a function that accepts three real numbers and returns
+/** Represents a function that accepts three double values and returns
* a result.
* @param <T> The function return type.
*/
@FunctionalInterface
-public interface RealFunction3N<T> {
+public interface DoubleFunction3N<T> {
/** Apply the function and return the result.
* @param n1 first function argument
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/internal/SimpleTupleFormat.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/SimpleTupleFormat.java
similarity index 96%
rename from commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/internal/SimpleTupleFormat.java
rename to commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/SimpleTupleFormat.java
index 84641cb..041380f 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/internal/SimpleTupleFormat.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/SimpleTupleFormat.java
@@ -14,14 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.geometry.core.util.internal;
+package org.apache.commons.geometry.core.internal;
import java.text.ParsePosition;
-import org.apache.commons.geometry.core.util.RealFunction;
-import org.apache.commons.geometry.core.util.RealFunction2N;
-import org.apache.commons.geometry.core.util.RealFunction3N;
-
/** Class for performing simple formatting and parsing of real number tuples.
*/
public class SimpleTupleFormat {
@@ -172,7 +168,7 @@ public class SimpleTupleFormat {
* @return object returned by {@code fn}
* @throws IllegalArgumentException if the input string format is invalid
*/
- public <T> T parse(String str, RealFunction<T> factory) throws IllegalArgumentException {
+ public <T> T parse(String str, DoubleFunction1N<T> fn) throws IllegalArgumentException {
final ParsePosition pos = new ParsePosition(0);
readPrefix(str, pos);
@@ -180,7 +176,7 @@ public class SimpleTupleFormat {
readSuffix(str, pos);
endParse(str, pos);
- return factory.apply(v);
+ return fn.apply(v);
}
/** Parse the given string as a 2-tuple and passes the tuple values to the
@@ -191,7 +187,7 @@ public class SimpleTupleFormat {
* @return object returned by {@code fn}
* @throws IllegalArgumentException if the input string format is invalid
*/
- public <T> T parse(String str, RealFunction2N<T> factory) throws IllegalArgumentException {
+ public <T> T parse(String str, DoubleFunction2N<T> fn) throws IllegalArgumentException {
final ParsePosition pos = new ParsePosition(0);
readPrefix(str, pos);
@@ -200,7 +196,7 @@ public class SimpleTupleFormat {
readSuffix(str, pos);
endParse(str, pos);
- return factory.apply(v1, v2);
+ return fn.apply(v1, v2);
}
/** Parse the given string as a 3-tuple and passes the parsed values to the
@@ -211,7 +207,7 @@ public class SimpleTupleFormat {
* @return object returned by {@code fn}
* @throws IllegalArgumentException if the input string format is invalid
*/
- public <T> T parse(String str, RealFunction3N<T> fn) throws IllegalArgumentException {
+ public <T> T parse(String str, DoubleFunction3N<T> fn) throws IllegalArgumentException {
ParsePosition pos = new ParsePosition(0);
readPrefix(str, pos);
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/internal/package-info.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/package-info.java
similarity index 94%
rename from commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/internal/package-info.java
rename to commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/package-info.java
index 547fc6b..1e4be0a 100644
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/internal/package-info.java
+++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/package-info.java
@@ -21,4 +21,4 @@
* No guarantees are made for the stability of the contained APIs.
* </p>
*/
-package org.apache.commons.geometry.core.util.internal;
+package org.apache.commons.geometry.core.internal;
diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/package-info.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/package-info.java
deleted file mode 100644
index 526cca0..0000000
--- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/util/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- *
- * <p>
- * This package contains common geometry utilities.
- * </p>
- */
-package org.apache.commons.geometry.core.util;
diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/util/internal/SimpleTupleFormatTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/internal/SimpleTupleFormatTest.java
similarity index 97%
rename from commons-geometry-core/src/test/java/org/apache/commons/geometry/core/util/internal/SimpleTupleFormatTest.java
rename to commons-geometry-core/src/test/java/org/apache/commons/geometry/core/internal/SimpleTupleFormatTest.java
index a3e554b..6f1467d 100644
--- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/util/internal/SimpleTupleFormatTest.java
+++ b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/internal/SimpleTupleFormatTest.java
@@ -14,11 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.commons.geometry.core.util.internal;
+package org.apache.commons.geometry.core.internal;
-import org.apache.commons.geometry.core.util.RealFunction;
-import org.apache.commons.geometry.core.util.RealFunction2N;
-import org.apache.commons.geometry.core.util.RealFunction3N;
import org.junit.Assert;
import org.junit.Test;
@@ -29,7 +26,7 @@ public class SimpleTupleFormatTest {
private static final String OPEN_PAREN = "(";
private static final String CLOSE_PAREN = ")";
- private static RealFunction<Stub1D> FACTORY_1D = new RealFunction<Stub1D>() {
+ private static DoubleFunction1N<Stub1D> FACTORY_1D = new DoubleFunction1N<Stub1D>() {
@Override
public Stub1D apply(double v) {
@@ -40,7 +37,7 @@ public class SimpleTupleFormatTest {
}
};
- private static RealFunction2N<Stub2D> FACTORY_2D = new RealFunction2N<Stub2D>() {
+ private static DoubleFunction2N<Stub2D> FACTORY_2D = new DoubleFunction2N<Stub2D>() {
@Override
public Stub2D apply(double v1, double v2) {
@@ -52,7 +49,7 @@ public class SimpleTupleFormatTest {
}
};
- private static RealFunction3N<Stub3D> FACTORY_3D = new RealFunction3N<Stub3D>() {
+ private static DoubleFunction3N<Stub3D> FACTORY_3D = new DoubleFunction3N<Stub3D>() {
@Override
public Stub3D apply(double v1, double v2, double v3) {
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Cartesian1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Cartesian1D.java
index 19ea67f..047a0ff 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Cartesian1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Cartesian1D.java
@@ -19,7 +19,7 @@ package org.apache.commons.geometry.euclidean.oned;
import java.io.Serializable;
import org.apache.commons.geometry.core.Spatial;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
/** This class represents a Cartesian coordinate value in
* one-dimensional Euclidean space.
@@ -27,7 +27,7 @@ import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
public abstract class Cartesian1D implements Spatial, Serializable {
/** Serializable UID. */
- private static final long serialVersionUID = -1178039568877797126L;
+ private static final long serialVersionUID = 20180710L;
/** Abscissa (coordinate value). */
private final double x;
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java
index 870ac6e..acc12f8 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Point1D.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.geometry.euclidean.oned;
-import org.apache.commons.geometry.core.util.RealFunction;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction1N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.EuclideanPoint;
import org.apache.commons.numbers.arrays.LinearCombination;
@@ -46,10 +46,10 @@ public final class Point1D extends Cartesian1D implements EuclideanPoint<Point1D
new Point1D(Double.NEGATIVE_INFINITY);
/** Serializable UID. */
- private static final long serialVersionUID = 7556674948671647925L;
+ private static final long serialVersionUID = 20180710L;
/** Factory for delegating instance creation. */
- private static RealFunction<Point1D> FACTORY = new RealFunction<Point1D>() {
+ private static DoubleFunction1N<Point1D> FACTORY = new DoubleFunction1N<Point1D>() {
/** {@inheritDoc} */
@Override
@@ -171,13 +171,6 @@ public final class Point1D extends Cartesian1D implements EuclideanPoint<Point1D
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
- /** Returns a factory object that can be used to created new point instances.
- * @return point factory instance
- */
- public static RealFunction<Point1D> getFactory() {
- return FACTORY;
- }
-
/** Returns a point with coordinates calculated by multiplying each input coordinate
* with its corresponding factor and adding the results.
*
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
index d9fd0c2..1a915f6 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/oned/Vector1D.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.geometry.euclidean.oned;
-import org.apache.commons.geometry.core.util.RealFunction;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction1N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.EuclideanVector;
import org.apache.commons.numbers.arrays.LinearCombination;
@@ -46,10 +46,10 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point
new Vector1D(Double.NEGATIVE_INFINITY);
/** Serializable UID. */
- private static final long serialVersionUID = 1582116020164328846L;
+ private static final long serialVersionUID = 20180710L;
/** Factory for delegating instance creation. */
- private static RealFunction<Vector1D> FACTORY = new RealFunction<Vector1D>() {
+ private static DoubleFunction1N<Vector1D> FACTORY = new DoubleFunction1N<Vector1D>() {
/** {@inheritDoc} */
@Override
@@ -255,13 +255,6 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
- /** Returns a factory object that can be used to created new vector instances.
- * @return vector factory instance
- */
- public static RealFunction<Vector1D> getFactory() {
- return FACTORY;
- }
-
/** Returns a vector consisting of the linear combination of the inputs.
* <p>
* A linear combination is the sum of all of the inputs multiplied by their
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Cartesian3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Cartesian3D.java
index 8d680e9..6dbe753 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Cartesian3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Cartesian3D.java
@@ -20,7 +20,7 @@ package org.apache.commons.geometry.euclidean.threed;
import java.io.Serializable;
import org.apache.commons.geometry.core.Spatial;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
/** This class represents a Cartesian coordinate value in
* three-dimensional Euclidean space.
@@ -28,7 +28,7 @@ import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
public abstract class Cartesian3D implements Spatial, Serializable {
/** Serializable UID. */
- private static final long serialVersionUID = 6249091865814886817L;
+ private static final long serialVersionUID = 20180710L;
/** Abscissa (first coordinate value) */
private final double x;
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java
index c9841ac..7c2b3f7 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Point3D.java
@@ -17,8 +17,8 @@
package org.apache.commons.geometry.euclidean.threed;
-import org.apache.commons.geometry.core.util.RealFunction3N;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction3N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.EuclideanPoint;
import org.apache.commons.numbers.arrays.LinearCombination;
@@ -44,10 +44,10 @@ public final class Point3D extends Cartesian3D implements EuclideanPoint<Point3D
new Point3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
/** Serializable version identifier. */
- private static final long serialVersionUID = 1313493323784566947L;
+ private static final long serialVersionUID = 20180710L;
/** Factory for delegating instance creation. */
- private static RealFunction3N<Point3D> FACTORY = new RealFunction3N<Point3D>() {
+ private static DoubleFunction3N<Point3D> FACTORY = new DoubleFunction3N<Point3D>() {
/** {@inheritDoc} */
@Override
@@ -194,13 +194,6 @@ public final class Point3D extends Cartesian3D implements EuclideanPoint<Point3D
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
- /** Returns a factory object that can be used to created new point instances.
- * @return point factory instance
- */
- public static RealFunction3N<Point3D> getFactory() {
- return FACTORY;
- }
-
/** Returns a point with coordinates calculated by multiplying each input coordinate
* with its corresponding factor and adding the results.
*
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
index 5e9d952..a96dffd 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Vector3D.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.geometry.euclidean.threed;
-import org.apache.commons.geometry.core.util.RealFunction3N;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction3N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.EuclideanVector;
import org.apache.commons.numbers.arrays.LinearCombination;
@@ -61,13 +61,13 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
new Vector3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
/** Serializable UID */
- private static final long serialVersionUID = 3695385854431542858L;
+ private static final long serialVersionUID = 20180710L;
/** Error message when norms are zero. */
private static final String ZERO_NORM_MSG = "Norm is zero";
/** Factory for delegating instance creation. */
- private static RealFunction3N<Vector3D> FACTORY = new RealFunction3N<Vector3D>() {
+ private static DoubleFunction3N<Vector3D> FACTORY = new DoubleFunction3N<Vector3D>() {
/** {@inheritDoc} */
@Override
@@ -474,13 +474,6 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
- /** Returns a factory object that can be used to created new vector instances.
- * @return vector factory instance
- */
- public static RealFunction3N<Vector3D> getFactory() {
- return FACTORY;
- }
-
/** Returns a vector consisting of the linear combination of the inputs.
* <p>
* A linear combination is the sum of all of the inputs multiplied by their
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Cartesian2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Cartesian2D.java
index 8ddb6a0..8d35fed 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Cartesian2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Cartesian2D.java
@@ -20,7 +20,7 @@ package org.apache.commons.geometry.euclidean.twod;
import java.io.Serializable;
import org.apache.commons.geometry.core.Spatial;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
/** This class represents a set of Cartesian coordinates in
* two-dimensional Euclidean space.
@@ -28,7 +28,7 @@ import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
public abstract class Cartesian2D implements Spatial, Serializable {
/** Serializable UID */
- private static final long serialVersionUID = 2918583078965478552L;
+ private static final long serialVersionUID = 20180710L;
/** Abscissa (first coordinate) */
private final double x;
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java
index 0d2af49..c9fde1f 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Point2D.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.geometry.euclidean.twod;
-import org.apache.commons.geometry.core.util.RealFunction2N;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction2N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.EuclideanPoint;
import org.apache.commons.numbers.arrays.LinearCombination;
@@ -43,10 +43,10 @@ public final class Point2D extends Cartesian2D implements EuclideanPoint<Point2D
new Point2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
/** Serializable UID. */
- private static final long serialVersionUID = 266938651998679754L;
+ private static final long serialVersionUID = 20180710L;
/** Factory for delegating instance creation. */
- private static RealFunction2N<Point2D> FACTORY = new RealFunction2N<Point2D>() {
+ private static DoubleFunction2N<Point2D> FACTORY = new DoubleFunction2N<Point2D>() {
/** {@inheritDoc} */
@Override
@@ -182,13 +182,6 @@ public final class Point2D extends Cartesian2D implements EuclideanPoint<Point2D
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
- /** Returns a factory object that can be used to created new point instances.
- * @return point factory instance
- */
- public static RealFunction2N<Point2D> getFactory() {
- return FACTORY;
- }
-
/** Returns a point with coordinates calculated by multiplying each input coordinate
* with its corresponding factor and adding the results.
*
diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
index 42dc10d..e682b77 100644
--- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
+++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/Vector2D.java
@@ -16,8 +16,8 @@
*/
package org.apache.commons.geometry.euclidean.twod;
-import org.apache.commons.geometry.core.util.RealFunction2N;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction2N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.EuclideanVector;
import org.apache.commons.numbers.arrays.LinearCombination;
@@ -55,13 +55,13 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
new Vector2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
/** Serializable UID */
- private static final long serialVersionUID = 1746839897232305304L;
+ private static final long serialVersionUID = 20180710L;
/** Error message when norms are zero. */
private static final String ZERO_NORM_MSG = "Norm is zero";
/** Factory for delegating instance creation. */
- private static RealFunction2N<Vector2D> FACTORY = new RealFunction2N<Vector2D>() {
+ private static DoubleFunction2N<Vector2D> FACTORY = new DoubleFunction2N<Vector2D>() {
/** {@inheritDoc} */
@Override
@@ -381,13 +381,6 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
- /** Returns a factory object that can be used to created new vector instances.
- * @return vector factory instance
- */
- public static RealFunction2N<Vector2D> getFactory() {
- return FACTORY;
- }
-
/** Returns a vector consisting of the linear combination of the inputs.
* <p>
* A linear combination is the sum of all of the inputs multiplied by their
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Point1DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Point1DTest.java
index 2ac7379..4b65983 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Point1DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Point1DTest.java
@@ -19,7 +19,6 @@ package org.apache.commons.geometry.euclidean.oned;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.util.RealFunction;
import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
@@ -229,16 +228,6 @@ public class Point1DTest {
}
@Test
- public void testGetFactory() {
- // act
- RealFunction<Point1D> factory = Point1D.getFactory();
-
- // assert
- checkPoint(factory.apply(1), 1);
- checkPoint(factory.apply(-1), -1);
- }
-
- @Test
public void testVectorCombination() {
// act/assert
checkPoint(Point1D.vectorCombination(2, Point1D.of(3)), 6);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java
index 9e81737..15c864f 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/oned/Vector1DTest.java
@@ -2,7 +2,6 @@ package org.apache.commons.geometry.euclidean.oned;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.util.RealFunction;
import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
@@ -337,16 +336,6 @@ public class Vector1DTest {
}
@Test
- public void testGetFactory() {
- // act
- RealFunction<Vector1D> factory = Vector1D.getFactory();
-
- // assert
- checkVector(factory.apply(1), 1);
- checkVector(factory.apply(-1), -1);
- }
-
- @Test
public void testLinearCombination() {
// act/assert
checkVector(Vector1D.linearCombination(2, Vector1D.of(3)), 6);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Point3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Point3DTest.java
index d2959dc..62218a6 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Point3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Point3DTest.java
@@ -18,7 +18,6 @@ package org.apache.commons.geometry.euclidean.threed;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.util.RealFunction3N;
import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
@@ -243,16 +242,6 @@ public class Point3DTest {
}
@Test
- public void testGetFactory() {
- // act
- RealFunction3N<Point3D> factory = Point3D.getFactory();
-
- // assert
- checkPoint(factory.apply(1, 2, 3), 1, 2, 3);
- checkPoint(factory.apply(-1, -2, -3), -1, -2, -3);
- }
-
- @Test
public void testVectorCombination1() {
// arrange
Point3D p1 = Point3D.of(1, 2, 3);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java
index 17e6a36..c4017bd 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/Vector3DTest.java
@@ -20,7 +20,6 @@ package org.apache.commons.geometry.euclidean.threed;
import java.util.regex.Pattern;
import org.apache.commons.geometry.core.Geometry;
-import org.apache.commons.geometry.core.util.RealFunction3N;
import org.apache.commons.numbers.core.Precision;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
@@ -689,16 +688,6 @@ public class Vector3DTest {
}
@Test
- public void testGetFactory() {
- // act
- RealFunction3N<Vector3D> factory = Vector3D.getFactory();
-
- // assert
- checkVector(factory.apply(1, 2, 3), 1, 2, 3);
- checkVector(factory.apply(-1, -2, -3), -1, -2, -3);
- }
-
- @Test
public void testLinearCombination1() {
// arrange
Vector3D p1 = Vector3D.of(1, 2, 3);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Point2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Point2DTest.java
index d26f002..e6cf422 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Point2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Point2DTest.java
@@ -18,7 +18,6 @@ package org.apache.commons.geometry.euclidean.twod;
import java.util.regex.Pattern;
-import org.apache.commons.geometry.core.util.RealFunction2N;
import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
@@ -220,16 +219,6 @@ public class Point2DTest {
}
@Test
- public void testGetFactory() {
- // act
- RealFunction2N<Point2D> factory = Point2D.getFactory();
-
- // assert
- checkPoint(factory.apply(1, 2), 1, 2);
- checkPoint(factory.apply(-1, -2), -1, -2);
- }
-
- @Test
public void testVectorCombination1() {
// arrange
Point2D p1 = Point2D.of(1, 2);
diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java
index fa130e8..83d56a1 100644
--- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java
+++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/Vector2DTest.java
@@ -3,7 +3,6 @@ package org.apache.commons.geometry.euclidean.twod;
import java.util.regex.Pattern;
import org.apache.commons.geometry.core.Geometry;
-import org.apache.commons.geometry.core.util.RealFunction2N;
import org.apache.commons.numbers.core.Precision;
import org.junit.Assert;
import org.junit.Test;
@@ -483,17 +482,6 @@ public class Vector2DTest {
// act/assert
Vector2D.of(new double[] {0.0 });
}
-
- @Test
- public void testGetFactory() {
- // act
- RealFunction2N<Vector2D> factory = Vector2D.getFactory();
-
- // assert
- checkVector(factory.apply(1, 2), 1, 2);
- checkVector(factory.apply(-1, -2), -1, -2);
- }
-
@Test
public void testLinearCombination1() {
// arrange
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java
index 9dd2d32..915e7a3 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/S1Point.java
@@ -19,8 +19,8 @@ package org.apache.commons.geometry.spherical.oned;
import java.io.Serializable;
import org.apache.commons.geometry.core.Point;
-import org.apache.commons.geometry.core.util.RealFunction;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction1N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.twod.Vector2D;
import org.apache.commons.numbers.angle.PlaneAngleRadians;
@@ -35,10 +35,10 @@ public final class S1Point implements Point<S1Point>, Serializable {
// CHECKSTYLE: resume ConstantName
/** Serializable UID. */
- private static final long serialVersionUID = 20131218L;
+ private static final long serialVersionUID = 20180710L;
/** Factory for delegating instance creation. */
- private static RealFunction<S1Point> FACTORY = new RealFunction<S1Point>() {
+ private static DoubleFunction1N<S1Point> FACTORY = new DoubleFunction1N<S1Point>() {
/** {@inheritDoc} */
@Override
@@ -191,11 +191,4 @@ public final class S1Point implements Point<S1Point>, Serializable {
public static S1Point parse(String str) throws IllegalArgumentException {
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
-
- /** Returns a factory object that can be used to created new point instances.
- * @return point factory instance
- */
- public static RealFunction<S1Point> getFactory() {
- return FACTORY;
- }
}
diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java
index e5b2fbb..274552b 100644
--- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java
+++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/twod/S2Point.java
@@ -19,8 +19,8 @@ package org.apache.commons.geometry.spherical.twod;
import java.io.Serializable;
import org.apache.commons.geometry.core.Point;
-import org.apache.commons.geometry.core.util.RealFunction2N;
-import org.apache.commons.geometry.core.util.internal.SimpleTupleFormat;
+import org.apache.commons.geometry.core.internal.DoubleFunction2N;
+import org.apache.commons.geometry.core.internal.SimpleTupleFormat;
import org.apache.commons.geometry.euclidean.threed.Vector3D;
/** This class represents a point on the 2-sphere.
@@ -59,10 +59,10 @@ public final class S2Point implements Point<S2Point>, Serializable {
// CHECKSTYLE: resume ConstantName
/** Serializable UID. */
- private static final long serialVersionUID = 20131218L;
+ private static final long serialVersionUID = 20180710L;
/** Factory for delegating instance creation. */
- private static RealFunction2N<S2Point> FACTORY = new RealFunction2N<S2Point>() {
+ private static DoubleFunction2N<S2Point> FACTORY = new DoubleFunction2N<S2Point>() {
/** {@inheritDoc} */
@Override
@@ -265,11 +265,4 @@ public final class S2Point implements Point<S2Point>, Serializable {
public static S2Point parse(String str) throws IllegalArgumentException {
return SimpleTupleFormat.getDefault().parse(str, FACTORY);
}
-
- /** Returns a factory object that can be used to created new point instances.
- * @return point factory instance
- */
- public static RealFunction2N<S2Point> getFactory() {
- return FACTORY;
- }
}
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/S1PointTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/S1PointTest.java
index e4f8b08..ba81963 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/S1PointTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/S1PointTest.java
@@ -17,7 +17,6 @@
package org.apache.commons.geometry.spherical.oned;
import org.apache.commons.geometry.core.Geometry;
-import org.apache.commons.geometry.core.util.RealFunction;
import org.junit.Assert;
import org.junit.Test;
@@ -80,17 +79,6 @@ public class S1PointTest {
S1Point.parse("abc");
}
- @Test
- public void testGetFactory() {
- // act
- RealFunction<S1Point> factory = S1Point.getFactory();
-
- // assert
- checkPoint(factory.apply(0), 0);
- checkPoint(factory.apply(1), 1);
- checkPoint(factory.apply(Geometry.TWO_PI), 0);
- }
-
private void checkPoint(S1Point p, double alpha) {
Assert.assertEquals(alpha, p.getAlpha(), EPS);
}
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/S2PointTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/S2PointTest.java
index 1a04010..2e15d09 100644
--- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/S2PointTest.java
+++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/S2PointTest.java
@@ -18,7 +18,6 @@ package org.apache.commons.geometry.spherical.twod;
import org.apache.commons.geometry.core.Geometry;
-import org.apache.commons.geometry.core.util.RealFunction2N;
import org.junit.Assert;
import org.junit.Test;
@@ -97,16 +96,6 @@ public class S2PointTest {
S2Point.parse("abc");
}
- @Test
- public void testGetFactory() {
- // act
- RealFunction2N<S2Point> factory = S2Point.getFactory();
-
- // assert
- checkPoint(factory.apply(0, 0), 0, 0);
- checkPoint(factory.apply(1, 2), 1, 2);
- }
-
private void checkPoint(S2Point p, double theta, double phi) {
Assert.assertEquals(theta, p.getTheta(), EPS);
Assert.assertEquals(phi, p.getPhi(), EPS);