1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource.dataservice;
9
10
11
12
13
14 import java.io.IOException;
15 import java.io.Reader;
16 import java.io.Serializable;
17 import java.io.Writer;
18 import org.exolab.castor.xml.MarshalException;
19 import org.exolab.castor.xml.Marshaller;
20 import org.exolab.castor.xml.Unmarshaller;
21 import org.exolab.castor.xml.ValidationException;
22 import org.xml.sax.ContentHandler;
23
24 /***
25 * Class TemporalType.
26 *
27 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:08 $
28 */
29 public class TemporalType extends org.astrogrid.common.bean.BaseBean
30 implements java.io.Serializable
31 {
32
33
34
35
36
37
38 /***
39 * The earliest temporal coverage of the resource.
40 *
41 */
42 private org.exolab.castor.types.Date _startTime;
43
44 /***
45 * The latest temporal coverage of the resource.
46 *
47 */
48 private org.exolab.castor.types.Date _endTime;
49
50 /***
51 * The temporal resolution that is typical of the
52 * observations of interest, in seconds.
53 *
54 */
55 private float _temporalResolution;
56
57 /***
58 * keeps track of state for field: _temporalResolution
59 */
60 private boolean _has_temporalResolution;
61
62
63
64
65
66
67 public TemporalType() {
68 super();
69 }
70
71
72
73
74
75
76 /***
77 * Method deleteTemporalResolution
78 */
79 public void deleteTemporalResolution()
80 {
81 this._has_temporalResolution= false;
82 }
83
84 /***
85 * Note: hashCode() has not been overriden
86 *
87 * @param obj
88 */
89 public boolean equals(java.lang.Object obj)
90 {
91 if ( this == obj )
92 return true;
93
94 if (super.equals(obj)==false)
95 return false;
96
97 if (obj instanceof TemporalType) {
98
99 TemporalType temp = (TemporalType)obj;
100 if (this._startTime != null) {
101 if (temp._startTime == null) return false;
102 else if (!(this._startTime.equals(temp._startTime)))
103 return false;
104 }
105 else if (temp._startTime != null)
106 return false;
107 if (this._endTime != null) {
108 if (temp._endTime == null) return false;
109 else if (!(this._endTime.equals(temp._endTime)))
110 return false;
111 }
112 else if (temp._endTime != null)
113 return false;
114 if (this._temporalResolution != temp._temporalResolution)
115 return false;
116 if (this._has_temporalResolution != temp._has_temporalResolution)
117 return false;
118 return true;
119 }
120 return false;
121 }
122
123 /***
124 * Returns the value of field 'endTime'. The field 'endTime'
125 * has the following description: The latest temporal coverage
126 * of the resource.
127 *
128 *
129 * @return the value of field 'endTime'.
130 */
131 public org.exolab.castor.types.Date getEndTime()
132 {
133 return this._endTime;
134 }
135
136 /***
137 * Returns the value of field 'startTime'. The field
138 * 'startTime' has the following description: The earliest
139 * temporal coverage of the resource.
140 *
141 *
142 * @return the value of field 'startTime'.
143 */
144 public org.exolab.castor.types.Date getStartTime()
145 {
146 return this._startTime;
147 }
148
149 /***
150 * Returns the value of field 'temporalResolution'. The field
151 * 'temporalResolution' has the following description: The
152 * temporal resolution that is typical of the
153 * observations of interest, in seconds.
154 *
155 *
156 * @return the value of field 'temporalResolution'.
157 */
158 public float getTemporalResolution()
159 {
160 return this._temporalResolution;
161 }
162
163 /***
164 * Method hasTemporalResolution
165 */
166 public boolean hasTemporalResolution()
167 {
168 return this._has_temporalResolution;
169 }
170
171 /***
172 * Method isValid
173 */
174 public boolean isValid()
175 {
176 try {
177 validate();
178 }
179 catch (org.exolab.castor.xml.ValidationException vex) {
180 return false;
181 }
182 return true;
183 }
184
185 /***
186 * Method marshal
187 *
188 * @param out
189 */
190 public void marshal(java.io.Writer out)
191 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
192 {
193
194 Marshaller.marshal(this, out);
195 }
196
197 /***
198 * Method marshal
199 *
200 * @param handler
201 */
202 public void marshal(org.xml.sax.ContentHandler handler)
203 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
204 {
205
206 Marshaller.marshal(this, handler);
207 }
208
209 /***
210 * Sets the value of field 'endTime'. The field 'endTime' has
211 * the following description: The latest temporal coverage of
212 * the resource.
213 *
214 *
215 * @param endTime the value of field 'endTime'.
216 */
217 public void setEndTime(org.exolab.castor.types.Date endTime)
218 {
219 this._endTime = endTime;
220 }
221
222 /***
223 * Sets the value of field 'startTime'. The field 'startTime'
224 * has the following description: The earliest temporal
225 * coverage of the resource.
226 *
227 *
228 * @param startTime the value of field 'startTime'.
229 */
230 public void setStartTime(org.exolab.castor.types.Date startTime)
231 {
232 this._startTime = startTime;
233 }
234
235 /***
236 * Sets the value of field 'temporalResolution'. The field
237 * 'temporalResolution' has the following description: The
238 * temporal resolution that is typical of the
239 * observations of interest, in seconds.
240 *
241 *
242 * @param temporalResolution the value of field
243 * 'temporalResolution'.
244 */
245 public void setTemporalResolution(float temporalResolution)
246 {
247 this._temporalResolution = temporalResolution;
248 this._has_temporalResolution = true;
249 }
250
251 /***
252 * Method unmarshalTemporalType
253 *
254 * @param reader
255 */
256 public static org.astrogrid.registry.beans.resource.dataservice.TemporalType unmarshalTemporalType(java.io.Reader reader)
257 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
258 {
259 return (org.astrogrid.registry.beans.resource.dataservice.TemporalType) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.dataservice.TemporalType.class, reader);
260 }
261
262 /***
263 * Method validate
264 */
265 public void validate()
266 throws org.exolab.castor.xml.ValidationException
267 {
268 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
269 validator.validate(this);
270 }
271
272 }