WeightedObservedPoint.java

  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.  *      https://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.  * This is not the original file distributed by the Apache Software Foundation
  19.  * It has been modified by the Hipparchus project
  20.  */
  21. package org.hipparchus.fitting;

  22. import java.io.Serializable;

  23. /**
  24.  * This class is a simple container for weighted observed point in
  25.  * {@link AbstractCurveFitter curve fitting}.
  26.  * <p>Instances of this class are guaranteed to be immutable.</p>
  27.  */
  28. public class WeightedObservedPoint implements Serializable {
  29.     /** Serializable version id. */
  30.     private static final long serialVersionUID = 5306874947404636157L;
  31.     /** Weight of the measurement in the fitting process. */
  32.     private final double weight;
  33.     /** Abscissa of the point. */
  34.     private final double x;
  35.     /** Observed value of the function at x. */
  36.     private final double y;

  37.     /**
  38.      * Simple constructor.
  39.      *
  40.      * @param weight Weight of the measurement in the fitting process.
  41.      * @param x Abscissa of the measurement.
  42.      * @param y Ordinate of the measurement.
  43.      */
  44.     public WeightedObservedPoint(final double weight, final double x, final double y) {
  45.         this.weight = weight;
  46.         this.x      = x;
  47.         this.y      = y;
  48.     }

  49.     /**
  50.      * Gets the weight of the measurement in the fitting process.
  51.      *
  52.      * @return the weight of the measurement in the fitting process.
  53.      */
  54.     public double getWeight() {
  55.         return weight;
  56.     }

  57.     /**
  58.      * Gets the abscissa of the point.
  59.      *
  60.      * @return the abscissa of the point.
  61.      */
  62.     public double getX() {
  63.         return x;
  64.     }

  65.     /**
  66.      * Gets the observed value of the function at x.
  67.      *
  68.      * @return the observed value of the function at x.
  69.      */
  70.     public double getY() {
  71.         return y;
  72.     }

  73. }