    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
    018    package org.apache.commons.math.optimization.fitting;
    019
    020    import java.io.Serializable;
    021
    022    /** This class is a simple container for weighted observed point in
    023     * {@link CurveFitter curve fitting}.
    024     * <p>Instances of this class are guaranteed to be immutable.</p>
    025     * @version $Revision: 786479 $ $Date: 2009-06-19 14:36:16 +0200 (ven. 19 juin 2009) $
    026     * @since 2.0
    027     */
    028    public class WeightedObservedPoint implements Serializable {
    029
    030        /** Serializable version id. */
    031        private static final long serialVersionUID = 5306874947404636157L;
    032
    033        /** Weight of the measurement in the fitting process. */
    034        private final double weight;
    035
    036        /** Abscissa of the point. */
    037        private final double x;
    038
    039        /** Observed value of the function at x. */
    040        private final double y;
    041
    042        /** Simple constructor.
    043         * @param weight weight of the measurement in the fitting process
    044         * @param x abscissa of the measurement
    045         * @param y ordinate of the measurement
    046         */
    047        public WeightedObservedPoint(final double weight, final double x, final double y) {
    048            this.weight = weight;
    049            this.x      = x;
    050            this.y      = y;
    051        }
    052
    053        /** Get the weight of the measurement in the fitting process.
    054         * @return weight of the measurement in the fitting process
    055         */
    056        public double getWeight() {
    057            return weight;
    058        }
    059
    060        /** Get the abscissa of the point.
    061         * @return abscissa of the point
    062         */
    063        public double getX() {
    064            return x;
    065        }
    066
    067        /** Get the observed value of the function at x.
    068         * @return observed value of the function at x
    069         */
    070        public double getY() {
    071            return y;
    072        }
    073
    074    }
    075