Repository: commons-math Updated Branches: refs/heads/master 1fe7a4350 -> 387880a63
Use utility method for "not null" checks. Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/387880a6 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/387880a6 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/387880a6 Branch: refs/heads/master Commit: 387880a630c65b955a3329a2f7b987214c41f6da Parents: 1fe7a43 Author: Gilles <[email protected]> Authored: Sun Jul 12 00:44:14 2015 +0200 Committer: Gilles <[email protected]> Committed: Sun Jul 12 00:44:14 2015 +0200 ---------------------------------------------------------------------- .../commons/math4/fraction/BigFraction.java | 28 +++++--------------- 1 file changed, 7 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/387880a6/src/main/java/org/apache/commons/math4/fraction/BigFraction.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math4/fraction/BigFraction.java b/src/main/java/org/apache/commons/math4/fraction/BigFraction.java index 1be1eea..69e8dc8 100644 --- a/src/main/java/org/apache/commons/math4/fraction/BigFraction.java +++ b/src/main/java/org/apache/commons/math4/fraction/BigFraction.java @@ -519,9 +519,7 @@ public class BigFraction */ @Override public BigFraction add(final BigFraction fraction) { - if (fraction == null) { - throw new NullArgumentException(LocalizedFormats.FRACTION); - } + MathUtils.checkNotNull(fraction, LocalizedFormats.FRACTION); if (fraction.numerator.signum() == 0) { return this; } @@ -642,9 +640,7 @@ public class BigFraction * @throws MathArithmeticException if the fraction to divide by is zero */ public BigFraction divide(final BigInteger bg) { - if (bg == null) { - throw new NullArgumentException(LocalizedFormats.FRACTION); - } + MathUtils.checkNotNull(bg); if (bg.signum() == 0) { throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR); } @@ -695,9 +691,7 @@ public class BigFraction */ @Override public BigFraction divide(final BigFraction fraction) { - if (fraction == null) { - throw new NullArgumentException(LocalizedFormats.FRACTION); - } + MathUtils.checkNotNull(fraction, LocalizedFormats.FRACTION); if (fraction.numerator.signum() == 0) { throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR); } @@ -902,9 +896,7 @@ public class BigFraction * @throws NullArgumentException if {@code bg} is {@code null}. */ public BigFraction multiply(final BigInteger bg) { - if (bg == null) { - throw new NullArgumentException(); - } + MathUtils.checkNotNull(bg); if (numerator.signum() == 0 || bg.signum() == 0) { return ZERO; } @@ -960,9 +952,7 @@ public class BigFraction */ @Override public BigFraction multiply(final BigFraction fraction) { - if (fraction == null) { - throw new NullArgumentException(LocalizedFormats.FRACTION); - } + MathUtils.checkNotNull(fraction, LocalizedFormats.FRACTION); if (numerator.signum() == 0 || fraction.numerator.signum() == 0) { return ZERO; @@ -1130,9 +1120,7 @@ public class BigFraction * @throws NullArgumentException if the {@link BigInteger} is {@code null}. */ public BigFraction subtract(final BigInteger bg) { - if (bg == null) { - throw new NullArgumentException(); - } + MathUtils.checkNotNull(bg); if (bg.signum() == 0) { return this; } @@ -1181,9 +1169,7 @@ public class BigFraction */ @Override public BigFraction subtract(final BigFraction fraction) { - if (fraction == null) { - throw new NullArgumentException(LocalizedFormats.FRACTION); - } + MathUtils.checkNotNull(fraction, LocalizedFormats.FRACTION); if (fraction.numerator.signum() == 0) { return this; }
