View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.math.optimization.fitting;
19  
20  import java.io.Serializable;
21  
22  /** This class is a simple container for weighted observed point in
23   * {@link CurveFitter curve fitting}.
24   * <p>Instances of this class are guaranteed to be immutable.</p>
25   * @version $Revision: 786479 $ $Date: 2009-06-19 08:36:16 -0400 (Fri, 19 Jun 2009) $
26   * @since 2.0
27   */
28  public class WeightedObservedPoint implements Serializable {
29  
30      /** Serializable version id. */
31      private static final long serialVersionUID = 5306874947404636157L;
32  
33      /** Weight of the measurement in the fitting process. */
34      private final double weight;
35  
36      /** Abscissa of the point. */
37      private final double x;
38  
39      /** Observed value of the function at x. */
40      private final double y;
41  
42      /** Simple constructor.
43       * @param weight weight of the measurement in the fitting process
44       * @param x abscissa of the measurement
45       * @param y ordinate of the measurement
46       */
47      public WeightedObservedPoint(final double weight, final double x, final double y) {
48          this.weight = weight;
49          this.x      = x;
50          this.y      = y;
51      }
52  
53      /** Get the weight of the measurement in the fitting process.
54       * @return weight of the measurement in the fitting process
55       */
56      public double getWeight() {
57          return weight;
58      }
59  
60      /** Get the abscissa of the point.
61       * @return abscissa of the point
62       */
63      public double getX() {
64          return x;
65      }
66  
67      /** Get the observed value of the function at x.
68       * @return observed value of the function at x
69       */
70      public double getY() {
71          return y;
72      }
73  
74  }
75