001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/datatypes/time/TimePeriod.java $
002    /*----------------------------------------------------------------------------
003     This file is part of deegree, http://deegree.org/
004     Copyright (C) 2001-2009 by:
005       Department of Geography, University of Bonn
006     and
007       lat/lon GmbH
008    
009     This library is free software; you can redistribute it and/or modify it under
010     the terms of the GNU Lesser General Public License as published by the Free
011     Software Foundation; either version 2.1 of the License, or (at your option)
012     any later version.
013     This library is distributed in the hope that it will be useful, but WITHOUT
014     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
015     FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
016     details.
017     You should have received a copy of the GNU Lesser General Public License
018     along with this library; if not, write to the Free Software Foundation, Inc.,
019     59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020    
021     Contact information:
022    
023     lat/lon GmbH
024     Aennchenstr. 19, 53177 Bonn
025     Germany
026     http://lat-lon.de/
027    
028     Department of Geography, University of Bonn
029     Prof. Dr. Klaus Greve
030     Postfach 1147, 53001 Bonn
031     Germany
032     http://www.geographie.uni-bonn.de/deegree/
033    
034     e-mail: info@deegree.org
035    ----------------------------------------------------------------------------*/
036    package org.deegree.datatypes.time;
037    
038    import java.io.Serializable;
039    import java.net.URI;
040    import java.net.URISyntaxException;
041    
042    /**
043     * @version $Revision: 18195 $
044     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
045     * @author last edited by: $Author: mschneider $
046     *
047     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
048     *
049     * @since 2.0
050     */
051    
052    public class TimePeriod implements Cloneable, Serializable {
053    
054        private static final long serialVersionUID = 1L;
055    
056        private TimePosition beginPosition = null;
057    
058        private TimePosition endPosition = null;
059    
060        private TimeDuration timeResolution = null;
061    
062        private URI frame = null;
063    
064        /**
065         * @param beginPosition
066         * @param endPosition
067         * @param timeResolution
068         */
069        public TimePeriod( TimePosition beginPosition, TimePosition endPosition, TimeDuration timeResolution ) {
070            this.beginPosition = beginPosition;
071            this.endPosition = endPosition;
072            this.timeResolution = timeResolution;
073        }
074    
075        /**
076         * @param beginPosition
077         * @param endPosition
078         * @param timeResolution
079         * @param frame
080         */
081        public TimePeriod( TimePosition beginPosition, TimePosition endPosition, TimeDuration timeResolution, URI frame ) {
082            this.beginPosition = beginPosition;
083            this.endPosition = endPosition;
084            this.timeResolution = timeResolution;
085            this.frame = frame;
086        }
087    
088        /**
089         * @return Returns the beginPosition.
090         */
091        public TimePosition getBeginPosition() {
092            return beginPosition;
093        }
094    
095        /**
096         * @param beginPosition
097         *            The beginPosition to set.
098         */
099        public void setBeginPosition( TimePosition beginPosition ) {
100            this.beginPosition = beginPosition;
101        }
102    
103        /**
104         * @return Returns the endPosition.
105         */
106        public TimePosition getEndPosition() {
107            return endPosition;
108        }
109    
110        /**
111         * @param endPosition
112         *            The endPosition to set.
113         */
114        public void setEndPosition( TimePosition endPosition ) {
115            this.endPosition = endPosition;
116        }
117    
118        /**
119         * @return Returns the frame.
120         */
121        public URI getFrame() {
122            return frame;
123        }
124    
125        /**
126         * @param frame
127         *            The frame to set.
128         */
129        public void setFrame( URI frame ) {
130            this.frame = frame;
131        }
132    
133        /**
134         * @return Returns the timeResolution.
135         */
136        public TimeDuration getTimeResolution() {
137            return timeResolution;
138        }
139    
140        /**
141         * @param timeResolution
142         *            The timeResolution to set.
143         */
144        public void setTimeResolution( TimeDuration timeResolution ) {
145            this.timeResolution = timeResolution;
146        }
147    
148        /**
149         * @see java.lang.Object#clone()
150         */
151        @Override
152        public Object clone() {
153            URI fr = null;
154            if ( frame != null ) {
155                try {
156                    fr = new URI( frame.toASCIIString() );
157                } catch ( URISyntaxException e ) {
158                    // will never happen.
159                }
160            }
161            return new TimePeriod( (TimePosition) beginPosition.clone(), (TimePosition) endPosition.clone(),
162                                   (TimeDuration) timeResolution.clone(), fr );
163        }
164    
165    }