001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/ogcwebservices/wcs/describecoverage/DomainSet.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2008 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/deegree/
008     lat/lon GmbH
009     http://www.lat-lon.de
010    
011     This library is free software; you can redistribute it and/or
012     modify it under the terms of the GNU Lesser General Public
013     License as published by the Free Software Foundation; either
014     version 2.1 of the License, or (at your option) any later version.
015    
016     This library is distributed in the hope that it will be useful,
017     but WITHOUT ANY WARRANTY; without even the implied warranty of
018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019     Lesser General Public License for more details.
020    
021     You should have received a copy of the GNU Lesser General Public
022     License along with this library; if not, write to the Free Software
023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025     Contact:
026    
027     Andreas Poth
028     lat/lon GmbH
029     Aennchenstr. 19
030     53115 Bonn
031     Germany
032     E-Mail: poth@lat-lon.de
033    
034     Prof. Dr. Klaus Greve
035     Department of Geography
036     University of Bonn
037     Meckenheimer Allee 166
038     53115 Bonn
039     Germany
040     E-Mail: greve@giub.uni-bonn.de
041    
042     
043     ---------------------------------------------------------------------------*/
044    package org.deegree.ogcwebservices.wcs.describecoverage;
045    
046    import org.deegree.datatypes.time.TimeSequence;
047    import org.deegree.ogcwebservices.wcs.WCSException;
048    
049    /**
050     * @version $Revision: 9345 $
051     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
052     * @author last edited by: $Author: apoth $
053     * 
054     * @version 1.0. $Revision: 9345 $, $Date: 2007-12-27 17:22:25 +0100 (Do, 27 Dez 2007) $
055     * 
056     * @since 2.0
057     */
058    
059    public class DomainSet implements Cloneable {
060    
061        private SpatialDomain spatialDomain = null;
062    
063        private TimeSequence timeSequence = null;
064    
065        /**
066         * @param spatialDomain
067         */
068        public DomainSet( SpatialDomain spatialDomain ) throws WCSException {
069            setSpatialDomain( spatialDomain );
070        }
071    
072        /**
073         * @param timeSequence
074         */
075        public DomainSet( TimeSequence timeSequence ) throws WCSException {
076            setTimeSequence( timeSequence );
077        }
078    
079        /**
080         * @param spatialDomain
081         * @param timeSequence
082         */
083        public DomainSet( SpatialDomain spatialDomain, TimeSequence timeSequence ) throws WCSException {
084            this.spatialDomain = spatialDomain;
085            this.timeSequence = timeSequence;
086            if ( this.spatialDomain == null && this.timeSequence == null ) {
087                throw new WCSException( "at least spatialDomain or timeSequence must " + "be <> null " );
088            }
089        }
090    
091        /**
092         * @return Returns the spatialDomain.
093         */
094        public SpatialDomain getSpatialDomain() {
095            return spatialDomain;
096        }
097    
098        /**
099         * @param spatialDomain
100         *            The spatialDomain to set.
101         */
102        public void setSpatialDomain( SpatialDomain spatialDomain )
103                                throws WCSException {
104            if ( spatialDomain == null && this.timeSequence == null ) {
105                throw new WCSException( "spatialDomain must be <> null because timeSequence " + "is already null" );
106            }
107            this.spatialDomain = spatialDomain;
108        }
109    
110        /**
111         * @return Returns the timeSequence.
112         */
113        public TimeSequence getTimeSequence() {
114            return timeSequence;
115        }
116    
117        /**
118         * @param timeSequence
119         *            The timeSequence to set.
120         */
121        public void setTimeSequence( TimeSequence timeSequence )
122                                throws WCSException {
123            if ( timeSequence == null && this.spatialDomain == null ) {
124                throw new WCSException( "timeSequence must be <> null because spatialDomain " + "is already null" );
125            }
126            this.timeSequence = timeSequence;
127        }
128    
129        /**
130         * @see java.lang.Object#clone()
131         */
132        public Object clone() {
133            SpatialDomain spatialDomain_ = null;
134            if ( spatialDomain != null ) {
135                spatialDomain_ = (SpatialDomain) spatialDomain.clone();
136            }
137            TimeSequence timeSequence_ = null;
138            if ( timeSequence != null ) {
139                timeSequence_ = (TimeSequence) timeSequence.clone();
140            }
141            try {
142                return new DomainSet( spatialDomain_, timeSequence_ );
143            } catch ( Exception e ) {
144            }
145            return null;
146        }
147    
148    }