    001    /*
    002     * Licensed to the Apache Software Foundation (ASF) under one or more
    003     * contributor license agreements.  See the NOTICE file distributed with
    004     * this work for additional information regarding copyright ownership.
    005     * The ASF licenses this file to You under the Apache License, Version 2.0
    006     * (the "License"); you may not use this file except in compliance with
    007     * the License.  You may obtain a copy of the License at
    008     *
    009     *      http://www.apache.org/licenses/LICENSE-2.0
    010     *
    011     * Unless required by applicable law or agreed to in writing, software
    012     * distributed under the License is distributed on an "AS IS" BASIS,
    013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014     * See the License for the specific language governing permissions and
    015     * limitations under the License.
    016     */
    017    package org.apache.commons.math.analysis.solvers;
    018
    019    /**
    020     * Abstract factory class used to create {@link UnivariateRealSolver} instances.
    021     * <p>
    022     * Solvers implementing the following algorithms are supported:
    023     * <ul>
    024     * <li>Bisection</li>
    025     * <li>Brent's method</li>
    026     * <li>Secant method</li>
    027     * </ul>
    028     * Concrete factories extending this class also specify a default solver, instances of which
    029     * are returned by <code>newDefaultSolver()</code>.</p>
    030     * <p>
    031     * Common usage:<pre>
    032     * SolverFactory factory = UnivariateRealSolverFactory.newInstance();</p>
    033     *
    034     * // create a Brent solver to use
    035     * BrentSolver solver = factory.newBrentSolver();
    036     * </pre>
    037     *
    038     * @version $Revision: 811685 $ $Date: 2009-09-05 19:36:48 +0200 (sam. 05 sept. 2009) $
    039     */
    040    public abstract class UnivariateRealSolverFactory {
    041        /**
    042         * Default constructor.
    043         */
    044        protected UnivariateRealSolverFactory() {
    045        }
    046
    047        /**
    048         * Create a new factory.
    049         * @return a new factory.
    050         */
    051        public static UnivariateRealSolverFactory newInstance() {
    052            return new UnivariateRealSolverFactoryImpl();
    053        }
    054
    055        /**
    056         * Create a new {@link UnivariateRealSolver}.  The
    057         * actual solver returned is determined by the underlying factory.
    058         * @return the new solver.
    059         */
    060        public abstract UnivariateRealSolver newDefaultSolver();
    061
    062        /**
    063         * Create a new {@link UnivariateRealSolver}.  The
    064         * solver is an implementation of the bisection method.
    065         * @return the new solver.
    066         */
    067        public abstract UnivariateRealSolver newBisectionSolver();
    068
    069        /**
    070         * Create a new {@link UnivariateRealSolver}.  The
    071         * solver is an implementation of the Brent method.
    072         * @return the new solver.
    073         */
    074        public abstract UnivariateRealSolver newBrentSolver();
    075
    076        /**
    077         * Create a new {@link UnivariateRealSolver}.  The
    078         * solver is an implementation of Newton's Method.
    079         * @return the new solver.
    080         */
    081        public abstract UnivariateRealSolver newNewtonSolver();
    082
    083        /**
    084         * Create a new {@link UnivariateRealSolver}.  The
    085         * solver is an implementation of the secant method.
    086         * @return the new solver.
    087         */
    088        public abstract UnivariateRealSolver newSecantSolver();
    089
    090    }