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
018package org.apache.commons.math4.optim.univariate;
019
020import java.io.Serializable;
021
022/**
023 * This class holds a point and the value of an objective function at this
024 * point.
025 * This is a simple immutable container.
026 *
027 * @since 3.0
028 */
029public class UnivariatePointValuePair implements Serializable {
030    /** Serializable version identifier. */
031    private static final long serialVersionUID = 1003888396256744753L;
032    /** Point. */
033    private final double point;
034    /** Value of the objective function at the point. */
035    private final double value;
036
037    /**
038     * Build a point/objective function value pair.
039     *
040     * @param point Point.
041     * @param value Value of an objective function at the point
042     */
043    public UnivariatePointValuePair(final double point,
044                                    final double value) {
045        this.point = point;
046        this.value = value;
047    }
048
049    /**
050     * Get the point.
051     *
052     * @return the point.
053     */
054    public double getPoint() {
055        return point;
056    }
057
058    /**
059     * Get the value of the objective function.
060     *
061     * @return the stored value of the objective function.
062     */
063    public double getValue() {
064        return value;
065    }
066}