From 8bff9c35f3722f8b1a550d06ba55950fddf17af0 Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Tue, 24 Dec 2019 11:28:31 +0100 Subject: [PATCH] Spurious "throws" clauses. --- .../BaseAbstractUnivariateIntegrator.java | 23 ++++++------------- .../IterativeLegendreGaussIntegrator.java | 15 ++++-------- 2 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java index 3cb31b63e..690615f4c 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java @@ -111,9 +111,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException { - + final int maximalIterationCount) { // accuracy settings this.relativeAccuracy = relativeAccuracy; this.absoluteAccuracy = absoluteAccuracy; @@ -135,7 +133,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte * @param absoluteAccuracy absolute accuracy of the result */ protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy, - final double absoluteAccuracy) { + final double absoluteAccuracy) { this(relativeAccuracy, absoluteAccuracy, DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT); } @@ -150,8 +148,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte * is lesser than or equal to the minimal number of iterations */ protected BaseAbstractUnivariateIntegrator(final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException { + final int maximalIterationCount) { this(DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY, minimalIterationCount, maximalIterationCount); } @@ -213,8 +210,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte * @throws TooManyEvaluationsException if the maximal number of function * evaluations is exceeded. */ - protected double computeObjectiveValue(final double point) - throws TooManyEvaluationsException { + protected double computeObjectiveValue(final double point) { try { evaluations.increment(); } catch (MaxCountExceededException e) { @@ -237,8 +233,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte */ protected void setup(final int maxEval, final UnivariateFunction f, - final double lower, final double upper) - throws NullArgumentException, MathIllegalArgumentException { + final double lower, final double upper) { // Checks. MathUtils.checkNotNull(f); @@ -257,9 +252,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte /** {@inheritDoc} */ @Override public double integrate(final int maxEval, final UnivariateFunction f, - final double lower, final double upper) - throws TooManyEvaluationsException, MaxCountExceededException, - MathIllegalArgumentException, NullArgumentException { + final double lower, final double upper) { // Initialization. setup(maxEval, f, lower, upper); @@ -278,7 +271,5 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte * @throws MaxCountExceededException if the maximum iteration count is exceeded * or the integrator detects convergence problems otherwise */ - protected abstract double doIntegrate() - throws TooManyEvaluationsException, MaxCountExceededException; - + protected abstract double doIntegrate() ; } diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java index 9701c216e..310b29082 100644 --- a/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java +++ b/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java @@ -69,8 +69,7 @@ public class IterativeLegendreGaussIntegrator final double relativeAccuracy, final double absoluteAccuracy, final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException { + final int maximalIterationCount) { super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount); if (n <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, n); @@ -88,8 +87,7 @@ public class IterativeLegendreGaussIntegrator */ public IterativeLegendreGaussIntegrator(final int n, final double relativeAccuracy, - final double absoluteAccuracy) - throws NotStrictlyPositiveException { + final double absoluteAccuracy) { this(n, relativeAccuracy, absoluteAccuracy, DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT); } @@ -108,16 +106,14 @@ public class IterativeLegendreGaussIntegrator */ public IterativeLegendreGaussIntegrator(final int n, final int minimalIterationCount, - final int maximalIterationCount) - throws NotStrictlyPositiveException, NumberIsTooSmallException { + final int maximalIterationCount) { this(n, DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY, minimalIterationCount, maximalIterationCount); } /** {@inheritDoc} */ @Override - protected double doIntegrate() - throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException { + protected double doIntegrate() { // Compute first estimate with a single step. double oldt = stage(1); @@ -160,8 +156,7 @@ public class IterativeLegendreGaussIntegrator final UnivariateFunction f = new UnivariateFunction() { /** {@inheritDoc} */ @Override - public double value(double x) - throws MathIllegalArgumentException, TooManyEvaluationsException { + public double value(double x) { return computeObjectiveValue(x); } };