Spurious "throws" clauses.

This commit is contained in:
Gilles Sadowski 2021-09-01 11:25:20 +02:00
parent b222580737
commit 6e11126615
2 changed files with 9 additions and 17 deletions

View File

@ -148,9 +148,7 @@ public abstract class BaseOptimizer<PAIR> {
* @throws TooManyIterationsException if the maximal number of * @throws TooManyIterationsException if the maximal number of
* iterations is exceeded. * iterations is exceeded.
*/ */
public PAIR optimize(OptimizationData... optData) public PAIR optimize(OptimizationData... optData) {
throws TooManyEvaluationsException,
TooManyIterationsException {
// Parse options. // Parse options.
parseOptimizationData(optData); parseOptimizationData(optData);
// Reset counters. // Reset counters.
@ -168,9 +166,7 @@ public abstract class BaseOptimizer<PAIR> {
* @throws TooManyIterationsException if the maximal number of * @throws TooManyIterationsException if the maximal number of
* iterations is exceeded. * iterations is exceeded.
*/ */
public PAIR optimize() public PAIR optimize() {
throws TooManyEvaluationsException,
TooManyIterationsException {
// Reset counters. // Reset counters.
resetCounters(); resetCounters();
// Perform optimization. // Perform optimization.
@ -191,8 +187,7 @@ public abstract class BaseOptimizer<PAIR> {
* @throws TooManyEvaluationsException if the allowed evaluations * @throws TooManyEvaluationsException if the allowed evaluations
* have been exhausted. * have been exhausted.
*/ */
protected void incrementEvaluationCount() protected void incrementEvaluationCount() {
throws TooManyEvaluationsException {
evaluations.increment(); evaluations.increment();
} }
@ -202,8 +197,7 @@ public abstract class BaseOptimizer<PAIR> {
* @throws TooManyIterationsException if the allowed iterations * @throws TooManyIterationsException if the allowed iterations
* have been exhausted. * have been exhausted.
*/ */
protected void incrementIterationCount() protected void incrementIterationCount() {
throws TooManyIterationsException {
iterations.increment(); iterations.increment();
} }

View File

@ -17,7 +17,6 @@
package org.apache.commons.math4.legacy.optim.nonlinear.scalar; package org.apache.commons.math4.legacy.optim.nonlinear.scalar;
import org.apache.commons.math4.legacy.analysis.MultivariateFunction; import org.apache.commons.math4.legacy.analysis.MultivariateFunction;
import org.apache.commons.math4.legacy.exception.TooManyEvaluationsException;
import org.apache.commons.math4.legacy.optim.BaseMultivariateOptimizer; import org.apache.commons.math4.legacy.optim.BaseMultivariateOptimizer;
import org.apache.commons.math4.legacy.optim.ConvergenceChecker; import org.apache.commons.math4.legacy.optim.ConvergenceChecker;
import org.apache.commons.math4.legacy.optim.OptimizationData; import org.apache.commons.math4.legacy.optim.OptimizationData;
@ -53,12 +52,11 @@ public abstract class MultivariateOptimizer
* <li>{@link GoalType}</li> * <li>{@link GoalType}</li>
* </ul> * </ul>
* @return {@inheritDoc} * @return {@inheritDoc}
* @throws TooManyEvaluationsException if the maximal number of * @throws org.apache.commons.math4.legacy.exception.TooManyEvaluationsException
* evaluations is exceeded. * if the maximal number of evaluations is exceeded.
*/ */
@Override @Override
public PointValuePair optimize(OptimizationData... optData) public PointValuePair optimize(OptimizationData... optData) {
throws TooManyEvaluationsException {
// Set up base class and perform computation. // Set up base class and perform computation.
return super.optimize(optData); return super.optimize(optData);
} }
@ -107,8 +105,8 @@ public abstract class MultivariateOptimizer
* *
* @param params Point at which the objective function must be evaluated. * @param params Point at which the objective function must be evaluated.
* @return the objective function value at the specified point. * @return the objective function value at the specified point.
* @throws TooManyEvaluationsException if the maximal number of * @throws org.apache.commons.math4.legacy.exception.TooManyEvaluationsException
* evaluations is exceeded. * if the maximal number of evaluations is exceeded.
*/ */
public double computeObjectiveValue(double[] params) { public double computeObjectiveValue(double[] params) {
super.incrementEvaluationCount(); super.incrementEvaluationCount();