This is an automated email from the ASF dual-hosted git repository. erans pushed a commit to branch GEOMETRY-3__TBR in repository https://gitbox.apache.org/repos/asf/commons-geometry.git
commit 9cdec0393b650ad54d1be9d3c198da76c7b924c7 Author: Matt Juntunen <[email protected]> AuthorDate: Wed Jun 6 21:10:33 2018 -0400 GEOMETRY-3: replacing class internal use of factory method with calls to constructor --- .../commons/geometry/euclidean/oned/Point1D.java | 12 +++---- .../commons/geometry/euclidean/oned/Vector1D.java | 22 ++++++------ .../commons/geometry/euclidean/threed/Point3D.java | 10 +++--- .../geometry/euclidean/threed/Vector3D.java | 40 +++++++++++----------- .../commons/geometry/euclidean/twod/Point2D.java | 10 +++--- .../commons/geometry/euclidean/twod/Vector2D.java | 28 +++++++-------- 6 files changed, 61 insertions(+), 61 deletions(-) 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 c6e6910..3715c69 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 @@ -27,23 +27,23 @@ import org.apache.commons.numbers.arrays.LinearCombination; public final class Point1D extends Cartesian1D implements EuclideanPoint<Point1D, Vector1D> { /** Origin (coordinates: 0). */ - public static final Point1D ZERO = Point1D.of(0.0); + public static final Point1D ZERO = new Point1D(0.0); /** Unit (coordinates: 1). */ - public static final Point1D ONE = Point1D.of(1.0); + public static final Point1D ONE = new Point1D(1.0); // CHECKSTYLE: stop ConstantName /** A vector with all coordinates set to NaN. */ - public static final Point1D NaN = Point1D.of(Double.NaN); + public static final Point1D NaN = new Point1D(Double.NaN); // CHECKSTYLE: resume ConstantName /** A point with all coordinates set to positive infinity. */ public static final Point1D POSITIVE_INFINITY = - Point1D.of(Double.POSITIVE_INFINITY); + new Point1D(Double.POSITIVE_INFINITY); /** A point with all coordinates set to negative infinity. */ public static final Point1D NEGATIVE_INFINITY = - Point1D.of(Double.NEGATIVE_INFINITY); + new Point1D(Double.NEGATIVE_INFINITY); /** Serializable UID. */ private static final long serialVersionUID = 7556674948671647925L; @@ -92,7 +92,7 @@ public final class Point1D extends Cartesian1D implements EuclideanPoint<Point1D /** {@inheritDoc} */ @Override public Point1D add(Vector1D v) { - return Point1D.of(getX() + v.getX()); + return new Point1D(getX() + v.getX()); } /** 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 5d79379..0aab089 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 @@ -27,23 +27,23 @@ import org.apache.commons.numbers.arrays.LinearCombination; public final class Vector1D extends Cartesian1D implements EuclideanVector<Point1D, Vector1D> { /** Zero vector (coordinates: 0). */ - public static final Vector1D ZERO = Vector1D.of(0.0); + public static final Vector1D ZERO = new Vector1D(0.0); /** Unit vector (coordinates: 1). */ - public static final Vector1D ONE = Vector1D.of(1.0); + public static final Vector1D ONE = new Vector1D(1.0); // CHECKSTYLE: stop ConstantName /** A vector with all coordinates set to NaN. */ - public static final Vector1D NaN = Vector1D.of(Double.NaN); + public static final Vector1D NaN = new Vector1D(Double.NaN); // CHECKSTYLE: resume ConstantName /** A vector with all coordinates set to positive infinity. */ public static final Vector1D POSITIVE_INFINITY = - Vector1D.of(Double.POSITIVE_INFINITY); + new Vector1D(Double.POSITIVE_INFINITY); /** A vector with all coordinates set to negative infinity. */ public static final Vector1D NEGATIVE_INFINITY = - Vector1D.of(Double.NEGATIVE_INFINITY); + new Vector1D(Double.NEGATIVE_INFINITY); /** Serializable UID. */ private static final long serialVersionUID = 1582116020164328846L; @@ -104,31 +104,31 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector1D add(Vector1D v) { - return Vector1D.of(getX() + v.getX()); + return new Vector1D(getX() + v.getX()); } /** {@inheritDoc} */ @Override public Vector1D add(double factor, Vector1D v) { - return Vector1D.of(getX() + (factor * v.getX())); + return new Vector1D(getX() + (factor * v.getX())); } /** {@inheritDoc} */ @Override public Vector1D subtract(Vector1D v) { - return Vector1D.of(getX() - v.getX()); + return new Vector1D(getX() - v.getX()); } /** {@inheritDoc} */ @Override public Vector1D subtract(double factor, Vector1D v) { - return Vector1D.of(getX() - (factor * v.getX())); + return new Vector1D(getX() - (factor * v.getX())); } /** {@inheritDoc} */ @Override public Vector1D negate() { - return Vector1D.of(-getX()); + return new Vector1D(-getX()); } /** {@inheritDoc} */ @@ -144,7 +144,7 @@ public final class Vector1D extends Cartesian1D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector1D scalarMultiply(double a) { - return Vector1D.of(a * getX()); + return new Vector1D(a * getX()); } /** {@inheritDoc} */ 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 2093292..f257425 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 @@ -28,20 +28,20 @@ import org.apache.commons.numbers.arrays.LinearCombination; public final class Point3D extends Cartesian3D implements EuclideanPoint<Point3D, Vector3D> { /** Zero point (coordinates: 0, 0, 0). */ - public static final Point3D ZERO = Point3D.of(0, 0, 0); + public static final Point3D ZERO = new Point3D(0, 0, 0); // CHECKSTYLE: stop ConstantName /** A point with all coordinates set to NaN. */ - public static final Point3D NaN = Point3D.of(Double.NaN, Double.NaN, Double.NaN); + public static final Point3D NaN = new Point3D(Double.NaN, Double.NaN, Double.NaN); // CHECKSTYLE: resume ConstantName /** A point with all coordinates set to positive infinity. */ public static final Point3D POSITIVE_INFINITY = - Point3D.of(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + new Point3D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); /** A point with all coordinates set to negative infinity. */ public static final Point3D NEGATIVE_INFINITY = - Point3D.of(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); + new Point3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); /** Serializable version identifier. */ private static final long serialVersionUID = 1313493323784566947L; @@ -97,7 +97,7 @@ public final class Point3D extends Cartesian3D implements EuclideanPoint<Point3D /** {@inheritDoc} */ @Override public Point3D add(Vector3D v) { - return Point3D.of( + return new Point3D( getX() + v.getX(), getY() + v.getY(), getZ() + v.getZ() 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 85246ab..9d1f258 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 @@ -27,38 +27,38 @@ import org.apache.commons.numbers.arrays.LinearCombination; public final class Vector3D extends Cartesian3D implements EuclideanVector<Point3D, Vector3D> { /** Zero (null) vector (coordinates: 0, 0, 0). */ - public static final Vector3D ZERO = Vector3D.of(0, 0, 0); + public static final Vector3D ZERO = new Vector3D(0, 0, 0); /** First canonical vector (coordinates: 1, 0, 0). */ - public static final Vector3D PLUS_X = Vector3D.of(1, 0, 0); + public static final Vector3D PLUS_X = new Vector3D(1, 0, 0); /** Opposite of the first canonical vector (coordinates: -1, 0, 0). */ - public static final Vector3D MINUS_X = Vector3D.of(-1, 0, 0); + public static final Vector3D MINUS_X = new Vector3D(-1, 0, 0); /** Second canonical vector (coordinates: 0, 1, 0). */ - public static final Vector3D PLUS_Y = Vector3D.of(0, 1, 0); + public static final Vector3D PLUS_Y = new Vector3D(0, 1, 0); /** Opposite of the second canonical vector (coordinates: 0, -1, 0). */ - public static final Vector3D MINUS_Y = Vector3D.of(0, -1, 0); + public static final Vector3D MINUS_Y = new Vector3D(0, -1, 0); /** Third canonical vector (coordinates: 0, 0, 1). */ - public static final Vector3D PLUS_Z = Vector3D.of(0, 0, 1); + public static final Vector3D PLUS_Z = new Vector3D(0, 0, 1); /** Opposite of the third canonical vector (coordinates: 0, 0, -1). */ - public static final Vector3D MINUS_Z = Vector3D.of(0, 0, -1); + public static final Vector3D MINUS_Z = new Vector3D(0, 0, -1); // CHECKSTYLE: stop ConstantName /** A vector with all coordinates set to NaN. */ - public static final Vector3D NaN = Vector3D.of(Double.NaN, Double.NaN, Double.NaN); + public static final Vector3D NaN = new Vector3D(Double.NaN, Double.NaN, Double.NaN); // CHECKSTYLE: resume ConstantName /** A vector with all coordinates set to positive infinity. */ public static final Vector3D POSITIVE_INFINITY = - Vector3D.of(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + new Vector3D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); /** A vector with all coordinates set to negative infinity. */ public static final Vector3D NEGATIVE_INFINITY = - Vector3D.of(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); + new Vector3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); /** Serializable UID */ private static final long serialVersionUID = 3695385854431542858L; @@ -147,7 +147,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector3D add(Vector3D v) { - return Vector3D.of( + return new Vector3D( getX() + v.getX(), getY() + v.getY(), getZ() + v.getZ() @@ -157,7 +157,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector3D add(double factor, Vector3D v) { - return Vector3D.of( + return new Vector3D( getX() + (factor * v.getX()), getY() + (factor * v.getY()), getZ() + (factor * v.getZ()) @@ -167,7 +167,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector3D subtract(Vector3D v) { - return Vector3D.of( + return new Vector3D( getX() - v.getX(), getY() - v.getY(), getZ() - v.getZ() @@ -177,7 +177,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector3D subtract(double factor, Vector3D v) { - return Vector3D.of( + return new Vector3D( getX() - (factor * v.getX()), getY() - (factor * v.getY()), getZ() - (factor * v.getZ()) @@ -187,7 +187,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector3D negate() { - return Vector3D.of(-getX(), -getY(), -getZ()); + return new Vector3D(-getX(), -getY(), -getZ()); } /** {@inheritDoc} */ @@ -227,13 +227,13 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point if (Math.abs(x) <= threshold) { double inverse = 1 / Math.sqrt(y * y + z * z); - return Vector3D.of(0, inverse * z, -inverse * y); + return new Vector3D(0, inverse * z, -inverse * y); } else if (Math.abs(y) <= threshold) { double inverse = 1 / Math.sqrt(x * x + z * z); - return Vector3D.of(-inverse * z, 0, inverse * x); + return new Vector3D(-inverse * z, 0, inverse * x); } double inverse = 1 / Math.sqrt(x * x + y * y); - return Vector3D.of(inverse * y, -inverse * x, 0); + return new Vector3D(inverse * y, -inverse * x, 0); } /** Compute the angular separation between two vectors. @@ -272,7 +272,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point * @return the cross product this ^ v as a new Cartesian3D */ public Vector3D crossProduct(final Vector3D v) { - return Vector3D.of(LinearCombination.value(getY(), v.getZ(), -getZ(), v.getY()), + return new Vector3D(LinearCombination.value(getY(), v.getZ(), -getZ(), v.getY()), LinearCombination.value(getZ(), v.getX(), -getX(), v.getZ()), LinearCombination.value(getX(), v.getY(), -getY(), v.getX())); } @@ -280,7 +280,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector3D scalarMultiply(double a) { - return Vector3D.of(a * getX(), a * getY(), a * getZ()); + return new Vector3D(a * getX(), a * getY(), a * getZ()); } /** {@inheritDoc} */ 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 4175d11..c32777a 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 @@ -27,20 +27,20 @@ import org.apache.commons.numbers.arrays.LinearCombination; public final class Point2D extends Cartesian2D implements EuclideanPoint<Point2D, Vector2D> { /** Origin (coordinates: 0, 0). */ - public static final Point2D ZERO = Point2D.of(0, 0); + public static final Point2D ZERO = new Point2D(0, 0); // CHECKSTYLE: stop ConstantName /** A point with all coordinates set to NaN. */ - public static final Point2D NaN = Point2D.of(Double.NaN, Double.NaN); + public static final Point2D NaN = new Point2D(Double.NaN, Double.NaN); // CHECKSTYLE: resume ConstantName /** A point with all coordinates set to positive infinity. */ public static final Point2D POSITIVE_INFINITY = - Point2D.of(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + new Point2D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); /** A point with all coordinates set to negative infinity. */ public static final Point2D NEGATIVE_INFINITY = - Point2D.of(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); + new Point2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); /** Serializable UID. */ private static final long serialVersionUID = 266938651998679754L; @@ -91,7 +91,7 @@ public final class Point2D extends Cartesian2D implements EuclideanPoint<Point2D /** {@inheritDoc} */ @Override public Point2D add(Vector2D v) { - return Point2D.of(getX() + v.getX(), getY() + v.getY()); + return new Point2D(getX() + v.getX(), getY() + v.getY()); } /** 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 e6285b1..ac8e380 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 @@ -27,32 +27,32 @@ import org.apache.commons.numbers.arrays.LinearCombination; public final class Vector2D extends Cartesian2D implements EuclideanVector<Point2D, Vector2D> { /** Zero vector (coordinates: 0, 0). */ - public static final Vector2D ZERO = Vector2D.of(0, 0); + public static final Vector2D ZERO = new Vector2D(0, 0); /** Unit vector pointing in the direction of the positive x-axis. */ - public static final Vector2D PLUS_X = Vector2D.of(1, 0); + public static final Vector2D PLUS_X = new Vector2D(1, 0); /** Unit vector pointing in the direction of the negative x-axis. */ - public static final Vector2D MINUS_X = Vector2D.of(-1, 0); + public static final Vector2D MINUS_X = new Vector2D(-1, 0); /** Unit vector pointing in the direction of the positive y-axis. */ - public static final Vector2D PLUS_Y = Vector2D.of(0, 1); + public static final Vector2D PLUS_Y = new Vector2D(0, 1); /** Unit vector pointing in the direction of the negative y-axis. */ - public static final Vector2D MINUS_Y = Vector2D.of(0, -1); + public static final Vector2D MINUS_Y = new Vector2D(0, -1); // CHECKSTYLE: stop ConstantName /** A vector with all coordinates set to NaN. */ - public static final Vector2D NaN = Vector2D.of(Double.NaN, Double.NaN); + public static final Vector2D NaN = new Vector2D(Double.NaN, Double.NaN); // CHECKSTYLE: resume ConstantName /** A vector with all coordinates set to positive infinity. */ public static final Vector2D POSITIVE_INFINITY = - Vector2D.of(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + new Vector2D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); /** A vector with all coordinates set to negative infinity. */ public static final Vector2D NEGATIVE_INFINITY = - Vector2D.of(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); + new Vector2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); /** Serializable UID */ private static final long serialVersionUID = 1746839897232305304L; @@ -129,31 +129,31 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector2D add(Vector2D v) { - return Vector2D.of(getX() + v.getX(), getY() + v.getY()); + return new Vector2D(getX() + v.getX(), getY() + v.getY()); } /** {@inheritDoc} */ @Override public Vector2D add(double factor, Vector2D v) { - return Vector2D.of(getX() + (factor * v.getX()), getY() + (factor * v.getY())); + return new Vector2D(getX() + (factor * v.getX()), getY() + (factor * v.getY())); } /** {@inheritDoc} */ @Override public Vector2D subtract(Vector2D v) { - return Vector2D.of(getX() - v.getX(), getY() - v.getY()); + return new Vector2D(getX() - v.getX(), getY() - v.getY()); } /** {@inheritDoc} */ @Override public Vector2D subtract(double factor, Vector2D v) { - return Vector2D.of(getX() - (factor * v.getX()), getY() - (factor * v.getY())); + return new Vector2D(getX() - (factor * v.getX()), getY() - (factor * v.getY())); } /** {@inheritDoc} */ @Override public Vector2D negate() { - return Vector2D.of(-getX(), -getY()); + return new Vector2D(-getX(), -getY()); } /** {@inheritDoc} */ @@ -169,7 +169,7 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point /** {@inheritDoc} */ @Override public Vector2D scalarMultiply(double a) { - return Vector2D.of(a * getX(), a * getY()); + return new Vector2D(a * getX(), a * getY()); } /** {@inheritDoc} */
