From b0521ef7e0d2946fe237abe67e309d88108d9e4a Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Tue, 18 Feb 2014 14:33:57 +0000 Subject: [PATCH] Removed interfaces in the fluent API that do not add any value. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1569363 13f79535-47bb-0310-9956-ffa450edef68 --- .../math3/fitting/GaussianCurveFitter.java | 6 +-- .../math3/fitting/HarmonicCurveFitter.java | 6 +-- .../math3/fitting/PolynomialCurveFitter.java | 6 +-- .../leastsquares/WithConvergenceChecker.java | 39 ------------------ .../leastsquares/WithMaxEvaluations.java | 36 ---------------- .../leastsquares/WithMaxIterations.java | 36 ---------------- .../leastsquares/WithModelAndJacobian.java | 41 ------------------- .../fitting/leastsquares/WithStartPoint.java | 36 ---------------- .../fitting/leastsquares/WithTarget.java | 36 ---------------- .../fitting/leastsquares/WithWeight.java | 38 ----------------- 10 files changed, 3 insertions(+), 277 deletions(-) delete mode 100644 src/main/java/org/apache/commons/math3/fitting/leastsquares/WithConvergenceChecker.java delete mode 100644 src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxEvaluations.java delete mode 100644 src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxIterations.java delete mode 100644 src/main/java/org/apache/commons/math3/fitting/leastsquares/WithModelAndJacobian.java delete mode 100644 src/main/java/org/apache/commons/math3/fitting/leastsquares/WithStartPoint.java delete mode 100644 src/main/java/org/apache/commons/math3/fitting/leastsquares/WithTarget.java delete mode 100644 src/main/java/org/apache/commons/math3/fitting/leastsquares/WithWeight.java diff --git a/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java index 958414fd0..3079b4867 100644 --- a/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java +++ b/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java @@ -32,8 +32,6 @@ import org.apache.commons.math3.exception.NotStrictlyPositiveException; import org.apache.commons.math3.exception.util.LocalizedFormats; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem; -import org.apache.commons.math3.fitting.leastsquares.WithStartPoint; -import org.apache.commons.math3.fitting.leastsquares.WithMaxIterations; import org.apache.commons.math3.util.FastMath; /** @@ -72,9 +70,7 @@ import org.apache.commons.math3.util.FastMath; * @version $Id$ * @since 3.3 */ -public class GaussianCurveFitter extends AbstractCurveFitter - implements WithStartPoint, - WithMaxIterations { +public class GaussianCurveFitter extends AbstractCurveFitter { /** Parametric function to be fitted. */ private static final Gaussian.Parametric FUNCTION = new Gaussian.Parametric() { @Override diff --git a/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java index 0c5462f3b..6cd377747 100644 --- a/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java +++ b/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java @@ -27,8 +27,6 @@ import org.apache.commons.math3.exception.ZeroException; import org.apache.commons.math3.exception.util.LocalizedFormats; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem; -import org.apache.commons.math3.fitting.leastsquares.WithMaxIterations; -import org.apache.commons.math3.fitting.leastsquares.WithStartPoint; import org.apache.commons.math3.linear.DiagonalMatrix; import org.apache.commons.math3.util.FastMath; @@ -49,9 +47,7 @@ import org.apache.commons.math3.util.FastMath; * @version $Id$ * @since 3.3 */ -public class HarmonicCurveFitter extends AbstractCurveFitter - implements WithStartPoint, - WithMaxIterations { +public class HarmonicCurveFitter extends AbstractCurveFitter { /** Parametric function to be fitted. */ private static final HarmonicOscillator.Parametric FUNCTION = new HarmonicOscillator.Parametric(); /** Initial guess. */ diff --git a/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java index c012e0ef4..11b3a6e4e 100644 --- a/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java +++ b/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java @@ -22,8 +22,6 @@ import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; import org.apache.commons.math3.exception.MathInternalError; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder; import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem; -import org.apache.commons.math3.fitting.leastsquares.WithMaxIterations; -import org.apache.commons.math3.fitting.leastsquares.WithStartPoint; import org.apache.commons.math3.linear.DiagonalMatrix; /** @@ -39,9 +37,7 @@ import org.apache.commons.math3.linear.DiagonalMatrix; * @version $Id$ * @since 3.3 */ -public class PolynomialCurveFitter extends AbstractCurveFitter - implements WithStartPoint, - WithMaxIterations { +public class PolynomialCurveFitter extends AbstractCurveFitter { /** Parametric function to be fitted. */ private static final PolynomialFunction.Parametric FUNCTION = new PolynomialFunction.Parametric(); /** Initial guess. */ diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithConvergenceChecker.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithConvergenceChecker.java deleted file mode 100644 index 598c9cbf5..000000000 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithConvergenceChecker.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math3.fitting.leastsquares; - -import org.apache.commons.math3.optim.ConvergenceChecker; - -/** - * Interface for "fluent-API" that advertizes a capability of the optimizer. - * - * @param Concrete optimizer implementation. - * @param Parametric type for the {@link ConvergenceChecker}. - * - * @version $Id$ - * @since 3.3 - */ -public interface WithConvergenceChecker { - /** - * Creates a new instance with the specified parameter. - * - * @param checker Convergence checker. - * @return a new optimizer instance with all fields identical to this - * instance except for the given argument. - */ - T withConvergenceChecker(ConvergenceChecker checker); -} diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxEvaluations.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxEvaluations.java deleted file mode 100644 index eec962665..000000000 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxEvaluations.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math3.fitting.leastsquares; - -/** - * Interface for "fluent-API" that advertizes a capability of the optimizer. - * - * @param Concrete optimizer implementation. - * - * @version $Id$ - * @since 3.3 - */ -public interface WithMaxEvaluations { - /** - * Creates a new instance with the specified parameter. - * - * @param maxEval Maximum number of evaluations of the model function. - * @return a new optimizer instance with all fields identical to this - * instance except for the given argument. - */ - T withMaxEvaluations(int maxEval); -} diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxIterations.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxIterations.java deleted file mode 100644 index 157819822..000000000 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithMaxIterations.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math3.fitting.leastsquares; - -/** - * Interface for "fluent-API" that advertizes a capability of the optimizer. - * - * @param Concrete optimizer implementation. - * - * @version $Id$ - * @since 3.3 - */ -public interface WithMaxIterations { - /** - * Creates a new instance with the specified parameter. - * - * @param maxIter Maximum number of iterations. - * @return a new optimizer instance with all fields identical to this - * instance except for the given argument. - */ - T withMaxIterations(int maxIter); -} diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithModelAndJacobian.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithModelAndJacobian.java deleted file mode 100644 index 87508f8a0..000000000 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithModelAndJacobian.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math3.fitting.leastsquares; - -import org.apache.commons.math3.analysis.MultivariateVectorFunction; -import org.apache.commons.math3.analysis.MultivariateMatrixFunction; - -/** - * Interface for "fluent-API" that advertizes a capability of the optimizer. - * - * @param Concrete optimizer implementation. - * - * @version $Id$ - * @since 3.3 - */ -public interface WithModelAndJacobian { - /** - * Creates a new instance with the specified parameters. - * - * @param model ModelFunction. - * @param jacobian Jacobian of the model function. - * @return a new optimizer instance with all fields identical to this - * instance except for the given arguments. - */ - T withModelAndJacobian(MultivariateVectorFunction model, - MultivariateMatrixFunction jacobian); -} diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithStartPoint.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithStartPoint.java deleted file mode 100644 index cde5e30c6..000000000 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithStartPoint.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math3.fitting.leastsquares; - -/** - * Interface for "fluent-API" that advertizes a capability of the optimizer. - * - * @param Concrete optimizer implementation. - * - * @version $Id$ - * @since 3.3 - */ -public interface WithStartPoint { - /** - * Creates a new instance with the specified parameter. - * - * @param start Initial guess for the parameters of the model function. - * @return a new optimizer instance with all fields identical to this - * instance except for the given argument. - */ - T withStartPoint(double[] start); -} diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithTarget.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithTarget.java deleted file mode 100644 index cb0b33f28..000000000 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithTarget.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math3.fitting.leastsquares; - -/** - * Interface for "fluent-API" that advertizes a capability of the optimizer. - * - * @param Concrete optimizer implementation. - * - * @version $Id$ - * @since 3.3 - */ -public interface WithTarget { - /** - * Creates a new instance with the specified parameter. - * - * @param target Objective points of the model function. - * @return a new optimizer instance with all fields identical to this - * instance except for the given argument. - */ - T withTarget(double[] target); -} diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithWeight.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithWeight.java deleted file mode 100644 index 7d3cd212d..000000000 --- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/WithWeight.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math3.fitting.leastsquares; - -import org.apache.commons.math3.linear.RealMatrix; - -/** - * Interface for "fluent-API" that advertizes a capability of the optimizer. - * - * @param Concrete optimizer implementation. - * - * @version $Id$ - * @since 3.3 - */ -public interface WithWeight { - /** - * Creates a new instance with the specified parameter. - * - * @param weight Weight matrix of the observations. - * @return a new optimizer instance with all fields identical to this - * instance except for the given argument. - */ - T withWeight(RealMatrix weight); -}