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
This commit is contained in:
Luc Maisonobe 2014-02-18 14:33:57 +00:00
parent 613a83c56a
commit b0521ef7e0
10 changed files with 3 additions and 277 deletions

View File

@ -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<GaussianCurveFitter>,
WithMaxIterations<GaussianCurveFitter> {
public class GaussianCurveFitter extends AbstractCurveFitter {
/** Parametric function to be fitted. */
private static final Gaussian.Parametric FUNCTION = new Gaussian.Parametric() {
@Override

View File

@ -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<HarmonicCurveFitter>,
WithMaxIterations<HarmonicCurveFitter> {
public class HarmonicCurveFitter extends AbstractCurveFitter {
/** Parametric function to be fitted. */
private static final HarmonicOscillator.Parametric FUNCTION = new HarmonicOscillator.Parametric();
/** Initial guess. */

View File

@ -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<PolynomialCurveFitter>,
WithMaxIterations<PolynomialCurveFitter> {
public class PolynomialCurveFitter extends AbstractCurveFitter {
/** Parametric function to be fitted. */
private static final PolynomialFunction.Parametric FUNCTION = new PolynomialFunction.Parametric();
/** Initial guess. */

View File

@ -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 <T> Concrete optimizer implementation.
* @param <PAIR> Parametric type for the {@link ConvergenceChecker}.
*
* @version $Id$
* @since 3.3
*/
public interface WithConvergenceChecker<PAIR, T> {
/**
* 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<PAIR> checker);
}

View File

@ -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 <T> Concrete optimizer implementation.
*
* @version $Id$
* @since 3.3
*/
public interface WithMaxEvaluations<T> {
/**
* 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);
}

View File

@ -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 <T> Concrete optimizer implementation.
*
* @version $Id$
* @since 3.3
*/
public interface WithMaxIterations<T> {
/**
* 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);
}

View File

@ -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 <T> Concrete optimizer implementation.
*
* @version $Id$
* @since 3.3
*/
public interface WithModelAndJacobian<T> {
/**
* 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);
}

View File

@ -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 <T> Concrete optimizer implementation.
*
* @version $Id$
* @since 3.3
*/
public interface WithStartPoint<T> {
/**
* 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);
}

View File

@ -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 <T> Concrete optimizer implementation.
*
* @version $Id$
* @since 3.3
*/
public interface WithTarget<T> {
/**
* 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);
}

View File

@ -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 <T> Concrete optimizer implementation.
*
* @version $Id$
* @since 3.3
*/
public interface WithWeight<T> {
/**
* 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);
}