001    //$HeadURL: https://svn.wald.intevation.org/svn/deegree/base/branches/2.3_testing/src/org/deegree/datatypes/time/TimePosition.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.util.Calendar;
041    import java.util.GregorianCalendar;
042    
043    /**
044     * @version $Revision: 18195 $
045     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth</a>
046     * @author last edited by: $Author: mschneider $
047     *
048     * @version 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18. Jun 2009) $
049     *
050     * @since 2.0
051     */
052    
053    public class TimePosition implements Cloneable, Serializable {
054    
055        private static final long serialVersionUID = 1L;
056    
057        private TimeIndeterminateValue indeterminatePosition = null;
058    
059        private String calendarEraName = null;
060    
061        private URI frame = null;
062    
063        private Calendar time = null;
064    
065        /**
066         * defaults are:
067         * <ul>
068         * <li>indeterminatePosition = now</li>
069         * <li>calendarEraName = AC</li>
070         * <li>frame = #ISO-8601</li>
071         * <li>time = new GregorianCalendar()</li>
072         * </ul>
073         */
074        public TimePosition() {
075            indeterminatePosition = new TimeIndeterminateValue();
076            calendarEraName = "AC";
077            try {
078                frame = new URI( "#ISO-8601" );
079            } catch ( Exception e ) {
080                e.printStackTrace();
081            }
082            time = new GregorianCalendar();
083        }
084    
085        /**
086         * defaults are:
087         * <ul>
088         * <li>indeterminatePosition = now</li>
089         * <li>calendarEraName = AC</li>
090         * <li>frame = #ISO-8601</li>
091         * </ul>
092         *
093         * @param time
094         */
095        public TimePosition( Calendar time ) {
096            this.time = time;
097            indeterminatePosition = new TimeIndeterminateValue();
098            calendarEraName = "AC";
099            try {
100                frame = new URI( "#ISO-8601" );
101            } catch ( Exception e ) {
102                e.printStackTrace();
103            }
104        }
105    
106        /**
107         * @param indeterminatePosition
108         * @param calendarEraName
109         * @param frame
110         * @param time
111         */
112        public TimePosition( TimeIndeterminateValue indeterminatePosition, String calendarEraName, URI frame, Calendar time ) {
113            this.indeterminatePosition = indeterminatePosition;
114            this.calendarEraName = calendarEraName;
115            this.frame = frame;
116            this.time = time;
117        }
118    
119        /**
120         * @return Returns the calendarEraName.
121         *
122         */
123        public String getCalendarEraName() {
124            return calendarEraName;
125        }
126    
127        /**
128         * @param calendarEraName
129         *            The calendarEraName to set.
130         *
131         */
132        public void setCalendarEraName( String calendarEraName ) {
133            this.calendarEraName = calendarEraName;
134        }
135    
136        /**
137         * @return Returns the frame.
138         *
139         */
140        public URI getFrame() {
141            return frame;
142        }
143    
144        /**
145         * @param frame
146         *            The frame to set.
147         *
148         */
149        public void setFrame( URI frame ) {
150            this.frame = frame;
151        }
152    
153        /**
154         * @return Returns the indeterminatePosition.
155         *
156         */
157        public TimeIndeterminateValue getIndeterminatePosition() {
158            return indeterminatePosition;
159        }
160    
161        /**
162         * @param indeterminatePosition
163         *            The indeterminatePosition to set.
164         *
165         */
166        public void setIndeterminatePosition( TimeIndeterminateValue indeterminatePosition ) {
167            this.indeterminatePosition = indeterminatePosition;
168        }
169    
170        /**
171         * @return Returns the time.
172         *
173         */
174        public Calendar getTime() {
175            return time;
176        }
177    
178        /**
179         * @param time
180         *            The time to set.
181         *
182         */
183        public void setTime( Calendar time ) {
184            this.time = time;
185        }
186    
187        /**
188         * @see java.lang.Object#clone()
189         */
190        @Override
191        public Object clone() {
192            return new TimePosition( indeterminatePosition, calendarEraName, frame, time );
193        }
194    
195    }