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 6dc7b9bbea81086358dca033d4faaec4873de6aa Author: Matt Juntunen <[email protected]> AuthorDate: Fri Jul 20 23:42:11 2018 -0400 GEOMETRY-7: fixing Javadoc and CheckStyle issues --- .../org/apache/commons/geometry/core/Geometry.java | 2 +- .../commons/geometry/euclidean/threed/Point3D.java | 8 ++++---- .../euclidean/threed/SphericalCoordinates.java | 19 +++++++++---------- .../commons/geometry/euclidean/threed/Vector3D.java | 16 ++++++++-------- .../commons/geometry/euclidean/twod/Point2D.java | 8 ++++---- .../geometry/euclidean/twod/PolarCoordinates.java | 8 ++++---- .../commons/geometry/euclidean/twod/Vector2D.java | 14 +++++++------- .../commons/geometry/spherical/oned/S1Point.java | 1 - .../commons/geometry/spherical/twod/S2Point.java | 2 +- 9 files changed, 38 insertions(+), 40 deletions(-) diff --git a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Geometry.java b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Geometry.java index d227755..fe319c4 100644 --- a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Geometry.java +++ b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/Geometry.java @@ -18,7 +18,7 @@ package org.apache.commons.geometry.core; /** Class containing geometric constants. */ -public class Geometry { +public final class Geometry { /** Alias for {@link Math#PI}, placed here for completeness. */ public static final double PI = Math.PI; 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 5ddb722..e099130 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 @@ -43,11 +43,8 @@ public final class Point3D extends Cartesian3D implements EuclideanPoint<Point3D public static final Point3D NEGATIVE_INFINITY = new Point3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); - /** Serializable version identifier. */ - private static final long serialVersionUID = 20180710L; - /** Package private factory for delegating instance creation. */ - static DoubleFunction3N<Point3D> FACTORY = new DoubleFunction3N<Point3D>() { + static final DoubleFunction3N<Point3D> FACTORY = new DoubleFunction3N<Point3D>() { /** {@inheritDoc} */ @Override @@ -56,6 +53,9 @@ public final class Point3D extends Cartesian3D implements EuclideanPoint<Point3D } }; + /** Serializable version identifier. */ + private static final long serialVersionUID = 20180710L; + /** Simple constructor. * Build a point from its coordinates * @param x abscissa diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java index 02ace69..86b664c 100644 --- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java +++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/SphericalCoordinates.java @@ -30,10 +30,10 @@ import org.apache.commons.numbers.angle.PlaneAngleRadians; * * <p>Spherical coordinates for a point are defined by three values: * <ol> - * <li><em>Radius</em> - The distance from the point to a fixed referenced point.</li> - * <li><em>Azimuth angle</em> - The angle measured from a fixed reference direction in a plane to + * <li><em>Radius</em> - The distance from the point to a fixed referenced point.</li> + * <li><em>Azimuth angle</em> - The angle measured from a fixed reference direction in a plane to * the orthogonal projection of the point on that plane.</li> - * <li><em>Polar angle</em> - The angle measured from a fixed zenith direction to the point. The zenith + * <li><em>Polar angle</em> - The angle measured from a fixed zenith direction to the point. The zenith *direction must be orthogonal to the reference plane.</li> * </ol> * This class follows the convention of using the origin as the reference point; the positive x-axis as the @@ -45,20 +45,18 @@ import org.apache.commons.numbers.angle.PlaneAngleRadians; * y = r sin(θ) sin(Φ) * z = r cos(Φ) * - * r = √(x<sup>2</sup>+y<sup>2</sup>+z<sup>2</sup>) + * r = √(x^2 + y^2 + z^2) * θ = atan2(y, x) * Φ = acos(z/r) * </pre> * where <em>r</em> is the radius, <em>θ</em> is the azimuth angle, and <em>Φ</em> is the polar angle * of the spherical coordinates. - * </p> * * <p>There are numerous, competing conventions for the symbols used to represent spherical coordinate values. For * example, the mathematical convention is to use <em>(r, θ, Φ)</em> to represent radius, azimuth angle, and * polar angle, whereas the physics convention flips the angle values and uses <em>(r, Φ, θ)</em>. As such, * this class avoids the use of these symbols altogether in favor of the less ambiguous formal names of the values, - * e.g. {@code radius}, {@code azimuth}, and {@code polar}. - * </p> + * e.g. {@code radius}, {@code azimuth}, and {@code polar}.</p> * * <p>In order to ensure the uniqueness of coordinate sets, coordinate values * are normalized so that {@code radius} is in the range {@code [0, +Infinity)}, @@ -186,9 +184,9 @@ public final class SphericalCoordinates implements Spatial, Serializable { * </p> * <p> * <code>NaN</code> values are considered to globally affect the coordinates - * and be equal to each other - i.e, if either (or all) values of the - * coordinate set are equal to <code>Double.NaN</code>, the set is equal to - * {@link #NaN}. + * and be equal to each other - i.e, if any (or all) values of the + * coordinate set are equal to <code>Double.NaN</code>, the set as a whole + * is considered to equal NaN. * </p> * * @param other Object to test for equality to this @@ -293,6 +291,7 @@ public final class SphericalCoordinates implements Spatial, Serializable { /** Package private method to convert the given set of spherical coordinates to * Cartesian coordinates. The Cartesian coordinates are computed and passed to the given * factory instance. The factory's return value is returned. + * @param <T> Factory return type. * @param radius The spherical radius value. * @param azimuth The spherical azimuth angle in radians. * @param polar The spherical polar angle in radians. 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 c35b2d0..078a5d3 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 @@ -47,7 +47,7 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point /** Opposite of the third canonical vector (coordinates: 0, 0, -1). */ public static final Vector3D MINUS_Z = new Vector3D(0, 0, -1); - // CHECKSTYLE: stop ConstantName + // CHECKSTYLE: stop ConstantName /** A vector with all coordinates set to NaN. */ public static final Vector3D NaN = new Vector3D(Double.NaN, Double.NaN, Double.NaN); // CHECKSTYLE: resume ConstantName @@ -60,14 +60,8 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point public static final Vector3D NEGATIVE_INFINITY = new Vector3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); - /** Serializable UID */ - private static final long serialVersionUID = 20180710L; - - /** Error message when norms are zero. */ - private static final String ZERO_NORM_MSG = "Norm is zero"; - /** Package private factory for delegating instance creation. */ - static DoubleFunction3N<Vector3D> FACTORY = new DoubleFunction3N<Vector3D>() { + static final DoubleFunction3N<Vector3D> FACTORY = new DoubleFunction3N<Vector3D>() { /** {@inheritDoc} */ @Override @@ -76,6 +70,12 @@ public final class Vector3D extends Cartesian3D implements EuclideanVector<Point } }; + /** Serializable UID */ + private static final long serialVersionUID = 20180710L; + + /** Error message when norms are zero. */ + private static final String ZERO_NORM_MSG = "Norm is zero"; + /** Simple constructor. * Build a vector from its coordinates * @param x abscissa 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 4009398..94c2272 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 @@ -42,11 +42,8 @@ public final class Point2D extends Cartesian2D implements EuclideanPoint<Point2D public static final Point2D NEGATIVE_INFINITY = new Point2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); - /** Serializable UID. */ - private static final long serialVersionUID = 20180710L; - /** Package private factory for delegating instance creation. */ - static DoubleFunction2N<Point2D> FACTORY = new DoubleFunction2N<Point2D>() { + static final DoubleFunction2N<Point2D> FACTORY = new DoubleFunction2N<Point2D>() { /** {@inheritDoc} */ @Override @@ -55,6 +52,9 @@ public final class Point2D extends Cartesian2D implements EuclideanPoint<Point2D } }; + /** Serializable UID. */ + private static final long serialVersionUID = 20180710L; + /** Simple constructor. * Build a point from its coordinates * @param x abscissa diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java index d1c6aca..c910629 100644 --- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java +++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/twod/PolarCoordinates.java @@ -39,11 +39,11 @@ import org.apache.commons.numbers.angle.PlaneAngleRadians; * x = r * cos(θ) * y = r * sin(θ) * - * r = √(x<sup>2</sup> + y<sup>2</sup>) + * r = √(x^2 + y^2) * θ = atan2(y, x) * </pre> * where <em>r</em> is the radius and <em>θ</em> is the azimuth of the polar coordinates. - * </p> + * * <p>In order to ensure the uniqueness of coordinate sets, coordinate values * are normalized so that {@code radius} is in the range {@code [0, +Infinity)} * and {@code azimuth} is in the range {@code [0, 2pi)}.</p> @@ -158,8 +158,8 @@ public final class PolarCoordinates implements Spatial, Serializable { * <p> * <code>NaN</code> values are considered to globally affect the coordinates * and be equal to each other - i.e, if either (or all) values of the - * coordinate set are equal to <code>Double.NaN</code>, the set is equal to - * {@link #NaN}. + * coordinate set are equal to <code>Double.NaN</code>, the set as a whole is + * considered to equal <code>NaN</code>. * </p> * * @param other Object to test for equality to this 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 6d8f10e..36c300e 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 @@ -54,14 +54,8 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point public static final Vector2D NEGATIVE_INFINITY = new Vector2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY); - /** Serializable UID */ - private static final long serialVersionUID = 20180710L; - - /** Error message when norms are zero. */ - private static final String ZERO_NORM_MSG = "Norm is zero"; - /** Package private factory for delegating instance creation. */ - static DoubleFunction2N<Vector2D> FACTORY = new DoubleFunction2N<Vector2D>() { + static final DoubleFunction2N<Vector2D> FACTORY = new DoubleFunction2N<Vector2D>() { /** {@inheritDoc} */ @Override @@ -70,6 +64,12 @@ public final class Vector2D extends Cartesian2D implements EuclideanVector<Point } }; + /** Serializable UID */ + private static final long serialVersionUID = 20180710L; + + /** Error message when norms are zero. */ + private static final String ZERO_NORM_MSG = "Norm is zero"; + /** Simple constructor. * @param x abscissa (first coordinate) * @param y ordinate (second coordinate) 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 d18b5a9..a9df1aa 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 @@ -55,7 +55,6 @@ public final class S1Point implements Point<S1Point>, Serializable { /** Build a point from its internal components. * @param azimuth azimuthal angle - * @param vector corresponding vector */ private S1Point(final double azimuth) { this.azimuth = PolarCoordinates.normalizeAzimuth(azimuth); 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 19cf154..1031b4b 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 @@ -212,7 +212,7 @@ public final class S2Point implements Point<S2Point>, Serializable { * @see #getAzimuth() * @see #getPolar() */ - public static S2Point of(final double azimuth, final double polar) throws IllegalArgumentException { + public static S2Point of(final double azimuth, final double polar) { return new S2Point(azimuth, polar, null); }
