1 /* 2 * Copyright (C) 2015 Alberto Irurueta Carro (alberto@irurueta.com) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.irurueta.numerical.fitting; 17 18 import com.irurueta.numerical.NotReadyException; 19 20 /** 21 * Base class for function fitters used to estimate function parameters along 22 * with their covariance matrix and chi square value 23 */ 24 public abstract class Fitter { 25 26 /** 27 * Indicates whether result has been estimated and is available for 28 * retrieval 29 */ 30 protected boolean resultAvailable; 31 32 /** 33 * Returns boolean indicating whether result has been estimated and is 34 * available for retrieval 35 * 36 * @return true if result has been estimated and is available for retrieval 37 */ 38 public boolean isResultAvailable() { 39 return resultAvailable; 40 } 41 42 /** 43 * Indicates whether this instance is ready because enough input data has 44 * been provided to start the fitting process 45 * 46 * @return true if this fitter is ready, false otherwise 47 */ 48 public abstract boolean isReady(); 49 50 /** 51 * Fits a function to provided data so that parameters associated to that 52 * function can be estimated along with their covariance matrix and chi 53 * square value 54 * 55 * @throws FittingException if fitting fails 56 * @throws NotReadyException if enough input data has not yet been provided 57 */ 58 public abstract void fit() throws FittingException, NotReadyException; 59 }