1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.v10.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 Temporal.
26 *
27 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:25 $
28 */
29 public class Temporal 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 _resolution;
56
57 /***
58 * keeps track of state for field: _resolution
59 */
60 private boolean _has_resolution;
61
62
63
64
65
66
67 public Temporal() {
68 super();
69 }
70
71
72
73
74
75
76 /***
77 * Method deleteResolution
78 */
79 public void deleteResolution()
80 {
81 this._has_resolution= 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 Temporal) {
98
99 Temporal temp = (Temporal)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._resolution != temp._resolution)
115 return false;
116 if (this._has_resolution != temp._has_resolution)
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 'resolution'. The field
138 * 'resolution' has the following description: The temporal
139 * resolution that is typical of the
140 * observations of interest, in seconds.
141 *
142 *
143 * @return the value of field 'resolution'.
144 */
145 public float getResolution()
146 {
147 return this._resolution;
148 }
149
150 /***
151 * Returns the value of field 'startTime'. The field
152 * 'startTime' has the following description: The earliest
153 * temporal coverage of the resource.
154 *
155 *
156 * @return the value of field 'startTime'.
157 */
158 public org.exolab.castor.types.Date getStartTime()
159 {
160 return this._startTime;
161 }
162
163 /***
164 * Method hasResolution
165 */
166 public boolean hasResolution()
167 {
168 return this._has_resolution;
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 'resolution'. The field 'resolution'
224 * has the following description: The temporal resolution that
225 * is typical of the
226 * observations of interest, in seconds.
227 *
228 *
229 * @param resolution the value of field 'resolution'.
230 */
231 public void setResolution(float resolution)
232 {
233 this._resolution = resolution;
234 this._has_resolution = true;
235 }
236
237 /***
238 * Sets the value of field 'startTime'. The field 'startTime'
239 * has the following description: The earliest temporal
240 * coverage of the resource.
241 *
242 *
243 * @param startTime the value of field 'startTime'.
244 */
245 public void setStartTime(org.exolab.castor.types.Date startTime)
246 {
247 this._startTime = startTime;
248 }
249
250 /***
251 * Method unmarshalTemporal
252 *
253 * @param reader
254 */
255 public static org.astrogrid.registry.beans.v10.resource.dataservice.Temporal unmarshalTemporal(java.io.Reader reader)
256 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
257 {
258 return (org.astrogrid.registry.beans.v10.resource.dataservice.Temporal) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.dataservice.Temporal.class, reader);
259 }
260
261 /***
262 * Method validate
263 */
264 public void validate()
265 throws org.exolab.castor.xml.ValidationException
266 {
267 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
268 validator.validate(this);
269 }
270
271 }