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 * Error thrown when two dimensions differ.
023 *
024 * @since 1.2
025 * @version $Revision: 1061778 $ $Date: 2011-01-21 13:12:39 +0100 (ven. 21 janv. 2011) $
026 * @deprecated in 2.2 (to be removed in 3.0). Please use its equivalent from package
027 * {@link org.apache.commons.math.exception}.
028 */
029 public class DimensionMismatchException extends MathException {
030
031 /** Serializable version identifier */
032 private static final long serialVersionUID = -1316089546353786411L;
033
034 /** First dimension. */
035 private final int dimension1;
036
037 /** Second dimension. */
038 private final int dimension2;
039
040 /**
041 * Construct an exception from the mismatched dimensions
042 * @param dimension1 first dimension
043 * @param dimension2 second dimension
044 */
045 public DimensionMismatchException(final int dimension1, final int dimension2) {
046 super(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, dimension1, dimension2);
047 this.dimension1 = dimension1;
048 this.dimension2 = dimension2;
049 }
050
051 /**
052 * Get the first dimension
053 * @return first dimension
054 */
055 public int getDimension1() {
056 return dimension1;
057 }
058
059 /**
060 * Get the second dimension
061 * @return second dimension
062 */
063 public int getDimension2() {
064 return dimension2;
065 }
066
067 }