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