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.math3.optim.univariate;
019    
020    import 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     * @version $Id: UnivariatePointValuePair.java 1364392 2012-07-22 18:27:12Z tn $
028     * @since 3.0
029     */
030    public class UnivariatePointValuePair implements Serializable {
031        /** Serializable version identifier. */
032        private static final long serialVersionUID = 1003888396256744753L;
033        /** Point. */
034        private final double point;
035        /** Value of the objective function at the point. */
036        private final double value;
037    
038        /**
039         * Build a point/objective function value pair.
040         *
041         * @param point Point.
042         * @param value Value of an objective function at the point
043         */
044        public UnivariatePointValuePair(final double point,
045                                        final double value) {
046            this.point = point;
047            this.value = value;
048        }
049    
050        /**
051         * Get the point.
052         *
053         * @return the point.
054         */
055        public double getPoint() {
056            return point;
057        }
058    
059        /**
060         * Get the value of the objective function.
061         *
062         * @return the stored value of the objective function.
063         */
064        public double getValue() {
065            return value;
066        }
067    }