    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    package org.apache.commons.math;
    018
    019    import org.apache.commons.math.exception.util.LocalizedFormats;
    020
    021    /**
    022     * Exception thrown when a sample contains several entries at the same abscissa.
    023     *
    024     * @since 1.2
    025     * @version $Revision: 983921 $ $Date: 2010-08-10 12:46:06 +0200 (mar. 10 ao??t 2010) $
    026     */
    027    public class DuplicateSampleAbscissaException extends MathException  {
    028
    029        /** Serializable version identifier */
    030        private static final long serialVersionUID = -2271007547170169872L;
    031
    032        /**
    033         * Construct an exception indicating the duplicate abscissa.
    034         * @param abscissa duplicate abscissa
    035         * @param i1 index of one entry having the duplicate abscissa
    036         * @param i2 index of another entry having the duplicate abscissa
    037         */
    038        public DuplicateSampleAbscissaException(double abscissa, int i1, int i2) {
    039            super(LocalizedFormats.DUPLICATED_ABSCISSA,
    040                  abscissa, i1, i2);
    041        }
    042
    043        /**
    044         * Get the duplicate abscissa.
    045         * @return duplicate abscissa
    046         */
    047        public double getDuplicateAbscissa() {
    048            return ((Double) getArguments()[0]).doubleValue();
    049        }
    050
    051    }