001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/model/csct/pt/MismatchedDimensionException.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004    This file is part of deegree.
005    Copyright (C) 2001 by:
006    EXSE, Department of Geography, University of Bonn
007    http://www.giub.uni-bonn.de/exse/
008    lat/lon GmbH
009    http://www.lat-lon.de
010    
011    It has been implemented within SEAGIS - An OpenSource implementation of OpenGIS specification
012    (C) 2001, Institut de Recherche pour le D�veloppement (http://sourceforge.net/projects/seagis/)
013    SEAGIS Contacts:  Surveillance de l'Environnement Assist�e par Satellite
014                      Institut de Recherche pour le D�veloppement / US-Espace
015                      mailto:seasnet@teledetection.fr
016    
017    
018    This library is free software; you can redistribute it and/or
019    modify it under the terms of the GNU Lesser General Public
020    License as published by the Free Software Foundation; either
021    version 2.1 of the License, or (at your option) any later version.
022    
023    This library is distributed in the hope that it will be useful,
024    but WITHOUT ANY WARRANTY; without even the implied warranty of
025    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
026    Lesser General Public License for more details.
027    
028    You should have received a copy of the GNU Lesser General Public
029    License along with this library; if not, write to the Free Software
030    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
031    
032    Contact:
033    
034    Andreas Poth
035    lat/lon GmbH
036    Aennchenstr. 19
037    53115 Bonn
038    Germany
039    E-Mail: poth@lat-lon.de
040    
041    Klaus Greve
042    Department of Geography
043    University of Bonn
044    Meckenheimer Allee 166
045    53115 Bonn
046    Germany
047    E-Mail: klaus.greve@uni-bonn.de
048    
049                     
050     ---------------------------------------------------------------------------*/
051    package org.deegree.model.csct.pt;
052    
053    // Miscellaneous
054    import org.deegree.model.csct.resources.css.ResourceKeys;
055    import org.deegree.model.csct.resources.css.Resources;
056    
057    
058    /**
059     * Indicates that an operation cannot be completed properly because
060     * of a mismatch in the dimensions of object attributes.
061     *
062     * @version 1.0
063     * @author Martin Desruisseaux
064     */
065    public class MismatchedDimensionException extends RuntimeException
066    {
067        /**
068         * Creates new exception without detail message.
069         */
070        public MismatchedDimensionException()
071        {}
072    
073        /**
074         * Constructs an exception with
075         * the specified detail message.
076         *
077         * @param msg the detail message.
078         */
079        public MismatchedDimensionException(final String msg)
080        {super(msg);}
081    
082        /**
083         * Construct an exception with a detail message stating that
084         * two objects don't have the same number of dimensions.
085         *
086         * @param object1 The first dimensioned object.
087         * @param object2 The second dimensioned object. Its dimension
088         *        should be different than <code>object1</code>'s dimension,
089         *        otherwise there is no dimension mismatch!
090         */
091        public MismatchedDimensionException(final Dimensioned object1, final Dimensioned object2)
092        {this(object1.getDimension(), object2.getDimension());}
093    
094        /**
095         * Construct an exception with a detail message stating that
096         * two objects don't have the same number of dimensions.
097         *
098         * @param dim1 Number of dimensions for the first object.
099         * @param dim2 Number of dimensions for the second object.
100         *        It shoud be different than <code>dim1</code>,
101         *        otherwise there is no dimension mismatch!
102         */
103        public MismatchedDimensionException(final int dim1, final int dim2)
104        {this(Resources.format(ResourceKeys.ERROR_MISMATCHED_DIMENSION_$2, new Integer(dim1), new Integer(dim2)));}
105    }