Spurious "throws" clauses.

This commit is contained in:
Gilles Sadowski 2019-12-24 11:28:31 +01:00
parent 5828c2352d
commit 8bff9c35f3
2 changed files with 12 additions and 26 deletions

View File

@ -111,9 +111,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy, protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy,
final double absoluteAccuracy, final double absoluteAccuracy,
final int minimalIterationCount, final int minimalIterationCount,
final int maximalIterationCount) final int maximalIterationCount) {
throws NotStrictlyPositiveException, NumberIsTooSmallException {
// accuracy settings // accuracy settings
this.relativeAccuracy = relativeAccuracy; this.relativeAccuracy = relativeAccuracy;
this.absoluteAccuracy = absoluteAccuracy; this.absoluteAccuracy = absoluteAccuracy;
@ -150,8 +148,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
* is lesser than or equal to the minimal number of iterations * is lesser than or equal to the minimal number of iterations
*/ */
protected BaseAbstractUnivariateIntegrator(final int minimalIterationCount, protected BaseAbstractUnivariateIntegrator(final int minimalIterationCount,
final int maximalIterationCount) final int maximalIterationCount) {
throws NotStrictlyPositiveException, NumberIsTooSmallException {
this(DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY, this(DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
minimalIterationCount, maximalIterationCount); minimalIterationCount, maximalIterationCount);
} }
@ -213,8 +210,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
* @throws TooManyEvaluationsException if the maximal number of function * @throws TooManyEvaluationsException if the maximal number of function
* evaluations is exceeded. * evaluations is exceeded.
*/ */
protected double computeObjectiveValue(final double point) protected double computeObjectiveValue(final double point) {
throws TooManyEvaluationsException {
try { try {
evaluations.increment(); evaluations.increment();
} catch (MaxCountExceededException e) { } catch (MaxCountExceededException e) {
@ -237,8 +233,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
*/ */
protected void setup(final int maxEval, protected void setup(final int maxEval,
final UnivariateFunction f, final UnivariateFunction f,
final double lower, final double upper) final double lower, final double upper) {
throws NullArgumentException, MathIllegalArgumentException {
// Checks. // Checks.
MathUtils.checkNotNull(f); MathUtils.checkNotNull(f);
@ -257,9 +252,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double integrate(final int maxEval, final UnivariateFunction f, public double integrate(final int maxEval, final UnivariateFunction f,
final double lower, final double upper) final double lower, final double upper) {
throws TooManyEvaluationsException, MaxCountExceededException,
MathIllegalArgumentException, NullArgumentException {
// Initialization. // Initialization.
setup(maxEval, f, lower, upper); setup(maxEval, f, lower, upper);
@ -278,7 +271,5 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
* @throws MaxCountExceededException if the maximum iteration count is exceeded * @throws MaxCountExceededException if the maximum iteration count is exceeded
* or the integrator detects convergence problems otherwise * or the integrator detects convergence problems otherwise
*/ */
protected abstract double doIntegrate() protected abstract double doIntegrate() ;
throws TooManyEvaluationsException, MaxCountExceededException;
} }

View File

@ -69,8 +69,7 @@ public class IterativeLegendreGaussIntegrator
final double relativeAccuracy, final double relativeAccuracy,
final double absoluteAccuracy, final double absoluteAccuracy,
final int minimalIterationCount, final int minimalIterationCount,
final int maximalIterationCount) final int maximalIterationCount) {
throws NotStrictlyPositiveException, NumberIsTooSmallException {
super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount); super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
if (n <= 0) { if (n <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, n); throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, n);
@ -88,8 +87,7 @@ public class IterativeLegendreGaussIntegrator
*/ */
public IterativeLegendreGaussIntegrator(final int n, public IterativeLegendreGaussIntegrator(final int n,
final double relativeAccuracy, final double relativeAccuracy,
final double absoluteAccuracy) final double absoluteAccuracy) {
throws NotStrictlyPositiveException {
this(n, relativeAccuracy, absoluteAccuracy, this(n, relativeAccuracy, absoluteAccuracy,
DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT); DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
} }
@ -108,16 +106,14 @@ public class IterativeLegendreGaussIntegrator
*/ */
public IterativeLegendreGaussIntegrator(final int n, public IterativeLegendreGaussIntegrator(final int n,
final int minimalIterationCount, final int minimalIterationCount,
final int maximalIterationCount) final int maximalIterationCount) {
throws NotStrictlyPositiveException, NumberIsTooSmallException {
this(n, DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY, this(n, DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
minimalIterationCount, maximalIterationCount); minimalIterationCount, maximalIterationCount);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
protected double doIntegrate() protected double doIntegrate() {
throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
// Compute first estimate with a single step. // Compute first estimate with a single step.
double oldt = stage(1); double oldt = stage(1);
@ -160,8 +156,7 @@ public class IterativeLegendreGaussIntegrator
final UnivariateFunction f = new UnivariateFunction() { final UnivariateFunction f = new UnivariateFunction() {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public double value(double x) public double value(double x) {
throws MathIllegalArgumentException, TooManyEvaluationsException {
return computeObjectiveValue(x); return computeObjectiveValue(x);
} }
}; };