You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2019/11/09 00:03:06 UTC

[commons-numbers] 03/19: Fixed checkstyle for angle.

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit fa56e252a896d7718656c4cd1e14037719003e6c
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri Nov 8 20:41:46 2019 +0000

    Fixed checkstyle for angle.
---
 .../apache/commons/numbers/angle/PlaneAngle.java   |  8 +++++--
 .../commons/numbers/angle/PlaneAngleRadians.java   |  2 +-
 .../numbers/angle/PlaneAngleRadiansTest.java       | 23 +++++++++++---------
 .../commons/numbers/angle/PlaneAngleTest.java      | 25 ++++++++++++----------
 4 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java
index 6870386..2c99b16 100644
--- a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java
+++ b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngle.java
@@ -19,7 +19,7 @@ package org.apache.commons.numbers.angle;
 /**
  * Represents the <a href="https://en.wikipedia.org/wiki/Angle">angle</a> concept.
  */
-public class PlaneAngle {
+public final class PlaneAngle {
     /** Zero. */
     public static final PlaneAngle ZERO = new PlaneAngle(0);
     /** Half-turn (aka &pi; radians). */
@@ -51,6 +51,7 @@ public class PlaneAngle {
     public static PlaneAngle ofTurns(double angle) {
         return new PlaneAngle(angle);
     }
+
     /**
      * @param angle (in <a href="https://en.wikipedia.org/wiki/Radian">radians</a>).
      * @return a new intance.
@@ -58,6 +59,7 @@ public class PlaneAngle {
     public static PlaneAngle ofRadians(double angle) {
         return new PlaneAngle(angle * FROM_RADIANS);
     }
+
     /**
      * @param angle (in <a href="https://en.wikipedia.org/wiki/Degree_%28angle%29">degrees</a>).
      * @return a new intance.
@@ -72,12 +74,14 @@ public class PlaneAngle {
     public double toTurns() {
         return value;
     }
+
     /**
      * @return the value in <a href="https://en.wikipedia.org/wiki/Radian">radians</a>.
      */
     public double toRadians() {
         return value * TO_RADIANS;
     }
+
     /**
      * @return the value in <a href="https://en.wikipedia.org/wiki/Degree_%28angle%29">degrees</a>.
      */
@@ -125,7 +129,7 @@ public class PlaneAngle {
         if (this == other) {
             return true;
         }
-        if (other instanceof PlaneAngle){
+        if (other instanceof PlaneAngle) {
             return Double.doubleToLongBits(value) ==
                     Double.doubleToLongBits(((PlaneAngle) other).value);
         }
diff --git a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngleRadians.java b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngleRadians.java
index a8683da..f140b8b 100644
--- a/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngleRadians.java
+++ b/commons-numbers-angle/src/main/java/org/apache/commons/numbers/angle/PlaneAngleRadians.java
@@ -22,7 +22,7 @@ package org.apache.commons.numbers.angle;
  *
  * @see PlaneAngle
  */
-public class PlaneAngleRadians {
+public final class PlaneAngleRadians {
     /** Utility class. */
     private PlaneAngleRadians() {}
 
diff --git a/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleRadiansTest.java b/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleRadiansTest.java
index c22d94b..72ffd69 100644
--- a/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleRadiansTest.java
+++ b/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleRadiansTest.java
@@ -1,15 +1,18 @@
 /*
  * 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.
+ * 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.
  */
 package org.apache.commons.numbers.angle;
 
diff --git a/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java b/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java
index a424414..570edba 100644
--- a/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java
+++ b/commons-numbers-angle/src/test/java/org/apache/commons/numbers/angle/PlaneAngleTest.java
@@ -1,15 +1,18 @@
 /*
  * 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.
+ * 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.
  */
 package org.apache.commons.numbers.angle;
 
@@ -67,7 +70,7 @@ public class PlaneAngleTest {
                 final double c = aA.normalize(aB).toTurns();
                 Assertions.assertTrue((aB.toTurns() - 0.5) <= c);
                 Assertions.assertTrue(c <= (aB.toTurns() + 0.5));
-                double twoK = Math.rint((aA.toTurns() - c));
+                double twoK = Math.rint(aA.toTurns() - c);
                 Assertions.assertEquals(c, aA.toTurns() - twoK, 1e-14);
             }
         }