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.math4.legacy.fitting;
018
019/**
020 * This class is a simple container for weighted observed point in
021 * {@link AbstractCurveFitter curve fitting}.
022 * <p>Instances of this class are guaranteed to be immutable.</p>
023 * @since 2.0
024 */
025public class WeightedObservedPoint {
026    /** Weight of the measurement in the fitting process. */
027    private final double weight;
028    /** Abscissa of the point. */
029    private final double x;
030    /** Observed value of the function at x. */
031    private final double y;
032
033    /**
034     * Simple constructor.
035     *
036     * @param weight Weight of the measurement in the fitting process.
037     * @param x Abscissa of the measurement.
038     * @param y Ordinate of the measurement.
039     */
040    public WeightedObservedPoint(final double weight, final double x, final double y) {
041        this.weight = weight;
042        this.x      = x;
043        this.y      = y;
044    }
045
046    /**
047     * Gets the weight of the measurement in the fitting process.
048     *
049     * @return the weight of the measurement in the fitting process.
050     */
051    public double getWeight() {
052        return weight;
053    }
054
055    /**
056     * Gets the abscissa of the point.
057     *
058     * @return the abscissa of the point.
059     */
060    public double getX() {
061        return x;
062    }
063
064    /**
065     * Gets the observed value of the function at x.
066     *
067     * @return the observed value of the function at x.
068     */
069    public double getY() {
070        return y;
071    }
072}