commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [47/50] commons-numbers git commit: NUMBERS-59: Removed null checking in Complex()
Date Fri, 02 Feb 2018 13:29:42 GMT
NUMBERS-59: Removed null checking in Complex()

Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/b077fd57
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/b077fd57
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/b077fd57

Branch: refs/heads/feature__NUMBERS-51__field
Commit: b077fd577c26357c9abde43f261c9029c8891ae9
Parents: ac1975c
Author: Eric Barnhill <ericbarnhill@apache.org>
Authored: Fri Feb 2 10:06:32 2018 +0100
Committer: Eric Barnhill <ericbarnhill@apache.org>
Committed: Fri Feb 2 10:06:32 2018 +0100

----------------------------------------------------------------------
 .../org/apache/commons/numbers/complex/Complex.java | 16 ----------------
 1 file changed, 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/b077fd57/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
----------------------------------------------------------------------
diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
index 7187507..f3295c3 100644
--- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
+++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java
@@ -221,7 +221,6 @@ public class Complex implements Serializable  {
      * @return {@code this + addend}.
      */
     public Complex add(Complex addend) {
-        checkNotNull(addend);
         return new Complex(real + addend.real,
                            imaginary + addend.imaginary);
     }
@@ -297,7 +296,6 @@ public class Complex implements Serializable  {
      * @return {@code this / divisor}.
      */
     public Complex divide(Complex divisor) {
-        checkNotNull(divisor);
 
         final double c = divisor.real;
         final double d = divisor.imaginary;
@@ -571,7 +569,6 @@ public class Complex implements Serializable  {
      * @return {@code this * factor}.
      */
     public Complex multiply(Complex factor) {
-        checkNotNull(factor);
         return new Complex(real * factor.real - imaginary * factor.imaginary,
                            real * factor.imaginary + imaginary * factor.real);
     }
@@ -623,7 +620,6 @@ public class Complex implements Serializable  {
      * @return {@code this - subtrahend}.
      */
     public Complex subtract(Complex subtrahend) {
-        checkNotNull(subtrahend);
         return new Complex(real - subtrahend.real,
                            imaginary - subtrahend.imaginary);
     }
@@ -961,7 +957,6 @@ public class Complex implements Serializable  {
      * @return <code> this<sup>x</sup></code>.
      */
     public Complex pow(Complex x) {
-        checkNotNull(x);
         if (real == 0 &&
             imaginary == 0) {
             if (x.real > 0 &&
@@ -1316,17 +1311,6 @@ public class Complex implements Serializable  {
     }
 
     /**
-     * Checks that an object is not null.
-     *
-     * @param o Object to be checked.
-     */
-    private static void checkNotNull(Object o) {
-        if (o == null) {
-            throw new IllegalArgumentException("Null Argument to Complex Method");
-        }
-    }
-
-    /**
      * Check that the argument is positive and throw a RuntimeException
      * if it is not.
      * @param arg {@code double} to check


Mime
View raw message