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 */
017package org.apache.commons.math3.fitting;
018
019import java.io.Serializable;
020
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 * @since 2.0
026 */
027public class WeightedObservedPoint implements Serializable {
028    /** Serializable version id. */
029    private static final long serialVersionUID = 5306874947404636157L;
030    /** Weight of the measurement in the fitting process. */
031    private final double weight;
032    /** Abscissa of the point. */
033    private final double x;
034    /** Observed value of the function at x. */
035    private final double y;
036
037    /**
038     * Simple constructor.
039     *
040     * @param weight Weight of the measurement in the fitting process.
041     * @param x Abscissa of the measurement.
042     * @param y Ordinate of the measurement.
043     */
044    public WeightedObservedPoint(final double weight, final double x, final double y) {
045        this.weight = weight;
046        this.x      = x;
047        this.y      = y;
048    }
049
050    /**
051     * Gets the weight of the measurement in the fitting process.
052     *
053     * @return the weight of the measurement in the fitting process.
054     */
055    public double getWeight() {
056        return weight;
057    }
058
059    /**
060     * Gets the abscissa of the point.
061     *
062     * @return the abscissa of the point.
063     */
064    public double getX() {
065        return x;
066    }
067
068    /**
069     * Gets the observed value of the function at x.
070     *
071     * @return the observed value of the function at x.
072     */
073    public double getY() {
074        return y;
075    }
076
077}
078