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-math.git
The following commit(s) were added to refs/heads/master by this push: new d9715f6 Remove useless "throws" clauses. d9715f6 is described below commit d9715f64ab54a82f25e9c61be331a02d8d1c7394 Author: Gilles Sadowski <gillese...@gmail.com> AuthorDate: Tue Nov 10 14:26:01 2020 +0100 Remove useless "throws" clauses. --- .../math4/analysis/integration/MidPointIntegrator.java | 14 ++++---------- .../math4/analysis/integration/RombergIntegrator.java | 10 +++------- .../math4/analysis/integration/SimpsonIntegrator.java | 6 ++---- .../math4/analysis/integration/TrapezoidIntegrator.java | 15 ++++----------- .../math4/analysis/integration/UnivariateIntegrator.java | 5 +---- .../math4/analysis/integration/gauss/BaseRuleFactory.java | 11 ++++------- .../math4/analysis/integration/gauss/GaussIntegrator.java | 6 ++---- .../integration/gauss/GaussIntegratorFactory.java | 12 ++++-------- .../analysis/integration/gauss/HermiteRuleFactory.java | 4 +--- .../analysis/integration/gauss/LaguerreRuleFactory.java | 4 +--- .../gauss/LegendreHighPrecisionRuleFactory.java | 4 +--- .../analysis/integration/gauss/LegendreRuleFactory.java | 4 +--- .../integration/gauss/SymmetricGaussIntegrator.java | 6 ++---- 13 files changed, 30 insertions(+), 71 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java index f4a5285..d010fbd 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java @@ -57,8 +57,7 @@ public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator { public MidPointIntegrator(final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount); if (maximalIterationCount > MIDPOINT_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, @@ -78,8 +77,7 @@ public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator { * is greater than 39. */ public MidPointIntegrator(final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(minimalIterationCount, maximalIterationCount); if (maximalIterationCount > MIDPOINT_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, @@ -117,9 +115,7 @@ public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator { private double stage(final int n, double previousStageResult, double min, - double diffMaxMin) - throws TooManyEvaluationsException { - + double diffMaxMin) { // number of points in the previous stage. This stage will contribute // 2*3^{n-1} more points. final long np = (long) FastMath.pow(3, n - 1); @@ -148,9 +144,7 @@ public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator { /** {@inheritDoc} */ @Override - protected double doIntegrate() - throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { - + protected double doIntegrate() { final double min = getMin(); final double diff = getMax() - min; final double midPoint = min + 0.5 * diff; diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java index 6205caa..50179df 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java @@ -57,8 +57,7 @@ public class RombergIntegrator extends BaseAbstractUnivariateIntegrator { public RombergIntegrator(final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount); if (maximalIterationCount > ROMBERG_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, @@ -79,8 +78,7 @@ public class RombergIntegrator extends BaseAbstractUnivariateIntegrator { * is greater than {@link #ROMBERG_MAX_ITERATIONS_COUNT} */ public RombergIntegrator(final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(minimalIterationCount, maximalIterationCount); if (maximalIterationCount > ROMBERG_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, @@ -98,9 +96,7 @@ public class RombergIntegrator extends BaseAbstractUnivariateIntegrator { /** {@inheritDoc} */ @Override - protected double doIntegrate() - throws TooManyEvaluationsException, MaxCountExceededException { - + protected double doIntegrate() { final int m = iterations.getMaximalCount() + 1; double previousRow[] = new double[m]; double currentRow[] = new double[m]; diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java index 19e6108..554be75 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java @@ -54,8 +54,7 @@ public class SimpsonIntegrator extends BaseAbstractUnivariateIntegrator { public SimpsonIntegrator(final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount); if (maximalIterationCount > SIMPSON_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, @@ -76,8 +75,7 @@ public class SimpsonIntegrator extends BaseAbstractUnivariateIntegrator { * is greater than {@link #SIMPSON_MAX_ITERATIONS_COUNT} */ public SimpsonIntegrator(final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(minimalIterationCount, maximalIterationCount); if (maximalIterationCount > SIMPSON_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java index 0d8a7fb..5a7e0e8 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java @@ -58,8 +58,7 @@ public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator { public TrapezoidIntegrator(final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount); if (maximalIterationCount > TRAPEZOID_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, @@ -79,8 +78,7 @@ public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator { * is greater than 63. */ public TrapezoidIntegrator(final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException { + final int maximalIterationCount) { super(minimalIterationCount, maximalIterationCount); if (maximalIterationCount > TRAPEZOID_MAX_ITERATIONS_COUNT) { throw new NumberIsTooLargeException(maximalIterationCount, @@ -111,9 +109,7 @@ public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator { * @throws TooManyEvaluationsException if the maximal number of evaluations * is exceeded. */ - double stage(final BaseAbstractUnivariateIntegrator baseIntegrator, final int n) - throws TooManyEvaluationsException { - + double stage(final BaseAbstractUnivariateIntegrator baseIntegrator, final int n) { if (n == 0) { final double max = baseIntegrator.getMax(); final double min = baseIntegrator.getMin(); @@ -141,9 +137,7 @@ public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator { /** {@inheritDoc} */ @Override - protected double doIntegrate() - throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { - + protected double doIntegrate() { double oldt = stage(this, 0); iterations.increment(); while (true) { @@ -162,5 +156,4 @@ public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator { } } - } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java index 60b8a44..994985c 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java @@ -73,10 +73,7 @@ public interface UnivariateIntegrator { * satisfy the requirements specified by the integrator * @throws NullArgumentException if {@code f} is {@code null}. */ - double integrate(int maxEval, UnivariateFunction f, double min, - double max) - throws TooManyEvaluationsException, MaxCountExceededException, - MathIllegalArgumentException, NullArgumentException; + double integrate(int maxEval, UnivariateFunction f, double min, double max); /** * Get the number of function evaluations of the last run of the integrator. diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java index bd05c5e..9e73f06 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java @@ -52,8 +52,7 @@ public abstract class BaseRuleFactory<T extends Number> { * @throws DimensionMismatchException if the elements of the rule pair do not * have the same length. */ - public Pair<double[], double[]> getRule(int numberOfPoints) - throws NotStrictlyPositiveException, DimensionMismatchException { + public Pair<double[], double[]> getRule(int numberOfPoints) { if (numberOfPoints <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, @@ -90,8 +89,7 @@ public abstract class BaseRuleFactory<T extends Number> { * @throws DimensionMismatchException if the elements of the rule pair do not * have the same length. */ - protected synchronized Pair<T[], T[]> getRuleInternal(int numberOfPoints) - throws DimensionMismatchException { + protected synchronized Pair<T[], T[]> getRuleInternal(int numberOfPoints) { final Pair<T[], T[]> rule = pointsAndWeights.get(numberOfPoints); if (rule == null) { addRule(computeRule(numberOfPoints)); @@ -108,7 +106,7 @@ public abstract class BaseRuleFactory<T extends Number> { * @throws DimensionMismatchException if the elements of the pair do not * have the same length. */ - protected void addRule(Pair<T[], T[]> rule) throws DimensionMismatchException { + protected void addRule(Pair<T[], T[]> rule) { if (rule.getFirst().length != rule.getSecond().length) { throw new DimensionMismatchException(rule.getFirst().length, rule.getSecond().length); @@ -125,8 +123,7 @@ public abstract class BaseRuleFactory<T extends Number> { * @throws DimensionMismatchException if the elements of the pair do not * have the same length. */ - protected abstract Pair<T[], T[]> computeRule(int numberOfPoints) - throws DimensionMismatchException; + protected abstract Pair<T[], T[]> computeRule(int numberOfPoints); /** * Converts the from the actual {@code Number} type to {@code double} diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java index f934ce6..de86f48 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java @@ -47,8 +47,7 @@ public class GaussIntegrator { * @throws DimensionMismatchException if points and weights don't have the same length */ public GaussIntegrator(double[] points, - double[] weights) - throws NonMonotonicSequenceException, DimensionMismatchException { + double[] weights) { if (points.length != weights.length) { throw new DimensionMismatchException(points.length, weights.length); @@ -70,8 +69,7 @@ public class GaussIntegrator { * * @see #GaussIntegrator(double[], double[]) */ - public GaussIntegrator(Pair<double[], double[]> pointsAndWeights) - throws NonMonotonicSequenceException { + public GaussIntegrator(Pair<double[], double[]> pointsAndWeights) { this(pointsAndWeights.getFirst(), pointsAndWeights.getSecond()); } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java index 2504692..3b1c2eb 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java @@ -85,8 +85,7 @@ public class GaussIntegratorFactory { */ public GaussIntegrator legendre(int numberOfPoints, double lowerBound, - double upperBound) - throws NotStrictlyPositiveException { + double upperBound) { return new GaussIntegrator(transform(getRule(legendre, numberOfPoints), lowerBound, upperBound)); } @@ -102,8 +101,7 @@ public class GaussIntegratorFactory { * @return a Gauss-Legendre integrator. * @throws NotStrictlyPositiveException if number of points is not positive */ - public GaussIntegrator legendreHighPrecision(int numberOfPoints) - throws NotStrictlyPositiveException { + public GaussIntegrator legendreHighPrecision(int numberOfPoints) { return new GaussIntegrator(getRule(legendreHighPrecision, numberOfPoints)); } @@ -120,8 +118,7 @@ public class GaussIntegratorFactory { */ public GaussIntegrator legendreHighPrecision(int numberOfPoints, double lowerBound, - double upperBound) - throws NotStrictlyPositiveException { + double upperBound) { return new GaussIntegrator(transform(getRule(legendreHighPrecision, numberOfPoints), lowerBound, upperBound)); } @@ -153,8 +150,7 @@ public class GaussIntegratorFactory { * have the same length. */ private static Pair<double[], double[]> getRule(BaseRuleFactory<? extends Number> factory, - int numberOfPoints) - throws NotStrictlyPositiveException, DimensionMismatchException { + int numberOfPoints) { return factory.getRule(numberOfPoints); } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java index e65f5bd..c680ed9 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java @@ -58,9 +58,7 @@ public class HermiteRuleFactory extends BaseRuleFactory<Double> { /** {@inheritDoc} */ @Override - protected Pair<Double[], Double[]> computeRule(int numberOfPoints) - throws DimensionMismatchException { - + protected Pair<Double[], Double[]> computeRule(int numberOfPoints) { if (numberOfPoints == 1) { // Break recursion. return new Pair<>(new Double[] { 0d }, diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LaguerreRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LaguerreRuleFactory.java index 25031e8..fc9eb3b 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LaguerreRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LaguerreRuleFactory.java @@ -35,9 +35,7 @@ import org.apache.commons.math4.util.Pair; public class LaguerreRuleFactory extends BaseRuleFactory<Double> { /** {@inheritDoc} */ @Override - protected Pair<Double[], Double[]> computeRule(int numberOfPoints) - throws DimensionMismatchException { - + protected Pair<Double[], Double[]> computeRule(int numberOfPoints) { final RealMatrix companionMatrix = companionMatrix(numberOfPoints); final EigenDecomposition eigen = new EigenDecomposition(companionMatrix); final double[] roots = eigen.getRealEigenvalues(); diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java index 1790c72..811f6d1 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java @@ -61,9 +61,7 @@ public class LegendreHighPrecisionRuleFactory extends BaseRuleFactory<BigDecimal /** {@inheritDoc} */ @Override - protected Pair<BigDecimal[], BigDecimal[]> computeRule(int numberOfPoints) - throws DimensionMismatchException { - + protected Pair<BigDecimal[], BigDecimal[]> computeRule(int numberOfPoints) { if (numberOfPoints == 1) { // Break recursion. return new Pair<>(new BigDecimal[] { BigDecimal.ZERO }, diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java index 29684bf..657f594 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java @@ -32,9 +32,7 @@ import org.apache.commons.math4.util.Pair; public class LegendreRuleFactory extends BaseRuleFactory<Double> { /** {@inheritDoc} */ @Override - protected Pair<Double[], Double[]> computeRule(int numberOfPoints) - throws DimensionMismatchException { - + protected Pair<Double[], Double[]> computeRule(int numberOfPoints) { if (numberOfPoints == 1) { // Break recursion. return new Pair<>(new Double[] { 0d }, diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java index ee3a466..083b848 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java @@ -41,8 +41,7 @@ public class SymmetricGaussIntegrator extends GaussIntegrator { * @throws DimensionMismatchException if points and weights don't have the same length */ public SymmetricGaussIntegrator(double[] points, - double[] weights) - throws NonMonotonicSequenceException, DimensionMismatchException { + double[] weights) { super(points, weights); } @@ -56,8 +55,7 @@ public class SymmetricGaussIntegrator extends GaussIntegrator { * * @see #SymmetricGaussIntegrator(double[], double[]) */ - public SymmetricGaussIntegrator(Pair<double[], double[]> pointsAndWeights) - throws NonMonotonicSequenceException { + public SymmetricGaussIntegrator(Pair<double[], double[]> pointsAndWeights) { this(pointsAndWeights.getFirst(), pointsAndWeights.getSecond()); }