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 /** 020 * Exeption thrown when a sample contains several entries at the same abscissa. 021 * 022 * @since 1.2 023 * @version $Revision: 746578 $ $Date: 2009-02-21 15:01:14 -0500 (Sat, 21 Feb 2009) $ 024 */ 025 public class DuplicateSampleAbscissaException extends MathException { 026 027 /** Serializable version identifier */ 028 private static final long serialVersionUID = -2271007547170169872L; 029 030 /** 031 * Construct an exception indicating the duplicate abscissa. 032 * @param abscissa duplicate abscissa 033 * @param i1 index of one entry having the duplicate abscissa 034 * @param i2 index of another entry having the duplicate abscissa 035 */ 036 public DuplicateSampleAbscissaException(double abscissa, int i1, int i2) { 037 super("Abscissa {0} is duplicated at both indices {1} and {2}", 038 abscissa, i1, i2); 039 } 040 041 /** 042 * Get the duplicate abscissa. 043 * @return duplicate abscissa 044 */ 045 public double getDuplicateAbscissa() { 046 return ((Double) getArguments()[0]).doubleValue(); 047 } 048 049 }