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.astrogrid.registry.beans.v10.resource.dataservice.types.CoordFrame;
19 import org.exolab.castor.xml.MarshalException;
20 import org.exolab.castor.xml.Marshaller;
21 import org.exolab.castor.xml.Unmarshaller;
22 import org.exolab.castor.xml.ValidationException;
23 import org.xml.sax.ContentHandler;
24
25 /***
26 * a coverage area of the sky characterized by a range of
27 * longitude and latitude.
28 *
29 *
30 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:25 $
31 */
32 public class CoordRange extends org.astrogrid.registry.beans.v10.resource.dataservice.Region
33 implements java.io.Serializable
34 {
35
36
37
38
39
40
41 /***
42 * a coordinate system frame
43 *
44 */
45 private org.astrogrid.registry.beans.v10.resource.dataservice.types.CoordFrame _coordFrame;
46
47 /***
48 * The range in longitude
49 */
50 private org.astrogrid.registry.beans.v10.resource.dataservice.AngleRange _long;
51
52 /***
53 * The range in latitude
54 */
55 private org.astrogrid.registry.beans.v10.resource.dataservice.AngleRange _lat;
56
57
58
59
60
61
62 public CoordRange() {
63 super();
64 }
65
66
67
68
69
70
71 /***
72 * Note: hashCode() has not been overriden
73 *
74 * @param obj
75 */
76 public boolean equals(java.lang.Object obj)
77 {
78 if ( this == obj )
79 return true;
80
81 if (super.equals(obj)==false)
82 return false;
83
84 if (obj instanceof CoordRange) {
85
86 CoordRange temp = (CoordRange)obj;
87 if (this._coordFrame != null) {
88 if (temp._coordFrame == null) return false;
89 else if (!(this._coordFrame.equals(temp._coordFrame)))
90 return false;
91 }
92 else if (temp._coordFrame != null)
93 return false;
94 if (this._long != null) {
95 if (temp._long == null) return false;
96 else if (!(this._long.equals(temp._long)))
97 return false;
98 }
99 else if (temp._long != null)
100 return false;
101 if (this._lat != null) {
102 if (temp._lat == null) return false;
103 else if (!(this._lat.equals(temp._lat)))
104 return false;
105 }
106 else if (temp._lat != null)
107 return false;
108 return true;
109 }
110 return false;
111 }
112
113 /***
114 * Returns the value of field 'coordFrame'. The field
115 * 'coordFrame' has the following description: a coordinate
116 * system frame
117 *
118 *
119 * @return the value of field 'coordFrame'.
120 */
121 public org.astrogrid.registry.beans.v10.resource.dataservice.types.CoordFrame getCoordFrame()
122 {
123 return this._coordFrame;
124 }
125
126 /***
127 * Returns the value of field 'lat'. The field 'lat' has the
128 * following description: The range in latitude
129 *
130 * @return the value of field 'lat'.
131 */
132 public org.astrogrid.registry.beans.v10.resource.dataservice.AngleRange getLat()
133 {
134 return this._lat;
135 }
136
137 /***
138 * Returns the value of field 'long'. The field 'long' has the
139 * following description: The range in longitude
140 *
141 * @return the value of field 'long'.
142 */
143 public org.astrogrid.registry.beans.v10.resource.dataservice.AngleRange getLong()
144 {
145 return this._long;
146 }
147
148 /***
149 * Method isValid
150 */
151 public boolean isValid()
152 {
153 try {
154 validate();
155 }
156 catch (org.exolab.castor.xml.ValidationException vex) {
157 return false;
158 }
159 return true;
160 }
161
162 /***
163 * Method marshal
164 *
165 * @param out
166 */
167 public void marshal(java.io.Writer out)
168 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
169 {
170
171 Marshaller.marshal(this, out);
172 }
173
174 /***
175 * Method marshal
176 *
177 * @param handler
178 */
179 public void marshal(org.xml.sax.ContentHandler handler)
180 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
181 {
182
183 Marshaller.marshal(this, handler);
184 }
185
186 /***
187 * Sets the value of field 'coordFrame'. The field 'coordFrame'
188 * has the following description: a coordinate system frame
189 *
190 *
191 * @param coordFrame the value of field 'coordFrame'.
192 */
193 public void setCoordFrame(org.astrogrid.registry.beans.v10.resource.dataservice.types.CoordFrame coordFrame)
194 {
195 this._coordFrame = coordFrame;
196 }
197
198 /***
199 * Sets the value of field 'lat'. The field 'lat' has the
200 * following description: The range in latitude
201 *
202 * @param lat the value of field 'lat'.
203 */
204 public void setLat(org.astrogrid.registry.beans.v10.resource.dataservice.AngleRange lat)
205 {
206 this._lat = lat;
207 }
208
209 /***
210 * Sets the value of field 'long'. The field 'long' has the
211 * following description: The range in longitude
212 *
213 * @param _long
214 * @param long the value of field 'long'.
215 */
216 public void setLong(org.astrogrid.registry.beans.v10.resource.dataservice.AngleRange _long)
217 {
218 this._long = _long;
219 }
220
221 /***
222 * Method unmarshalCoordRange
223 *
224 * @param reader
225 */
226 public static org.astrogrid.registry.beans.v10.resource.dataservice.CoordRange unmarshalCoordRange(java.io.Reader reader)
227 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
228 {
229 return (org.astrogrid.registry.beans.v10.resource.dataservice.CoordRange) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.dataservice.CoordRange.class, reader);
230 }
231
232 /***
233 * Method validate
234 */
235 public void validate()
236 throws org.exolab.castor.xml.ValidationException
237 {
238 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
239 validator.validate(this);
240 }
241
242 }