Home | History | Annotate | Download | only in math
      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  *      http://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 package org.apache.commons.math;
     18 
     19 import org.apache.commons.math.exception.util.LocalizedFormats;
     20 
     21 /**
     22  * Error thrown when two dimensions differ.
     23  *
     24  * @since 1.2
     25  * @version $Revision: 1061778 $ $Date: 2011-01-21 13:12:39 +0100 (ven. 21 janv. 2011) $
     26  * @deprecated in 2.2 (to be removed in 3.0). Please use its equivalent from package
     27  * {@link org.apache.commons.math.exception}.
     28  */
     29 public class DimensionMismatchException extends MathException {
     30 
     31     /** Serializable version identifier */
     32     private static final long serialVersionUID = -1316089546353786411L;
     33 
     34     /** First dimension. */
     35     private final int dimension1;
     36 
     37     /** Second dimension. */
     38     private final int dimension2;
     39 
     40     /**
     41      * Construct an exception from the mismatched dimensions
     42      * @param dimension1 first dimension
     43      * @param dimension2 second dimension
     44      */
     45     public DimensionMismatchException(final int dimension1, final int dimension2) {
     46         super(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, dimension1, dimension2);
     47         this.dimension1 = dimension1;
     48         this.dimension2 = dimension2;
     49     }
     50 
     51     /**
     52      * Get the first dimension
     53      * @return first dimension
     54      */
     55     public int getDimension1() {
     56         return dimension1;
     57     }
     58 
     59     /**
     60      * Get the second dimension
     61      * @return second dimension
     62      */
     63     public int getDimension2() {
     64         return dimension2;
     65     }
     66 
     67 }
     68