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 central position
27 * and angular radius
28 *
29 *
30 * @version $Revision: 1.2 $ $Date: 2007/01/04 16:26:25 $
31 */
32 public class CircleRegion 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 position of the center of the circle/cone.
49 *
50 */
51 private org.astrogrid.registry.beans.v10.resource.dataservice.Position _center;
52
53 /***
54 * the radius of the circle in degrees.
55 *
56 */
57 private float _radius;
58
59 /***
60 * keeps track of state for field: _radius
61 */
62 private boolean _has_radius;
63
64
65
66
67
68
69 public CircleRegion() {
70 super();
71 }
72
73
74
75
76
77
78 /***
79 * Note: hashCode() has not been overriden
80 *
81 * @param obj
82 */
83 public boolean equals(java.lang.Object obj)
84 {
85 if ( this == obj )
86 return true;
87
88 if (super.equals(obj)==false)
89 return false;
90
91 if (obj instanceof CircleRegion) {
92
93 CircleRegion temp = (CircleRegion)obj;
94 if (this._coordFrame != null) {
95 if (temp._coordFrame == null) return false;
96 else if (!(this._coordFrame.equals(temp._coordFrame)))
97 return false;
98 }
99 else if (temp._coordFrame != null)
100 return false;
101 if (this._center != null) {
102 if (temp._center == null) return false;
103 else if (!(this._center.equals(temp._center)))
104 return false;
105 }
106 else if (temp._center != null)
107 return false;
108 if (this._radius != temp._radius)
109 return false;
110 if (this._has_radius != temp._has_radius)
111 return false;
112 return true;
113 }
114 return false;
115 }
116
117 /***
118 * Returns the value of field 'center'. The field 'center' has
119 * the following description: the position of the center of the
120 * circle/cone.
121 *
122 *
123 * @return the value of field 'center'.
124 */
125 public org.astrogrid.registry.beans.v10.resource.dataservice.Position getCenter()
126 {
127 return this._center;
128 }
129
130 /***
131 * Returns the value of field 'coordFrame'. The field
132 * 'coordFrame' has the following description: a coordinate
133 * system frame
134 *
135 *
136 * @return the value of field 'coordFrame'.
137 */
138 public org.astrogrid.registry.beans.v10.resource.dataservice.types.CoordFrame getCoordFrame()
139 {
140 return this._coordFrame;
141 }
142
143 /***
144 * Returns the value of field 'radius'. The field 'radius' has
145 * the following description: the radius of the circle in
146 * degrees.
147 *
148 *
149 * @return the value of field 'radius'.
150 */
151 public float getRadius()
152 {
153 return this._radius;
154 }
155
156 /***
157 * Method hasRadius
158 */
159 public boolean hasRadius()
160 {
161 return this._has_radius;
162 }
163
164 /***
165 * Method isValid
166 */
167 public boolean isValid()
168 {
169 try {
170 validate();
171 }
172 catch (org.exolab.castor.xml.ValidationException vex) {
173 return false;
174 }
175 return true;
176 }
177
178 /***
179 * Method marshal
180 *
181 * @param out
182 */
183 public void marshal(java.io.Writer out)
184 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
185 {
186
187 Marshaller.marshal(this, out);
188 }
189
190 /***
191 * Method marshal
192 *
193 * @param handler
194 */
195 public void marshal(org.xml.sax.ContentHandler handler)
196 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
197 {
198
199 Marshaller.marshal(this, handler);
200 }
201
202 /***
203 * Sets the value of field 'center'. The field 'center' has the
204 * following description: the position of the center of the
205 * circle/cone.
206 *
207 *
208 * @param center the value of field 'center'.
209 */
210 public void setCenter(org.astrogrid.registry.beans.v10.resource.dataservice.Position center)
211 {
212 this._center = center;
213 }
214
215 /***
216 * Sets the value of field 'coordFrame'. The field 'coordFrame'
217 * has the following description: a coordinate system frame
218 *
219 *
220 * @param coordFrame the value of field 'coordFrame'.
221 */
222 public void setCoordFrame(org.astrogrid.registry.beans.v10.resource.dataservice.types.CoordFrame coordFrame)
223 {
224 this._coordFrame = coordFrame;
225 }
226
227 /***
228 * Sets the value of field 'radius'. The field 'radius' has the
229 * following description: the radius of the circle in degrees.
230 *
231 *
232 * @param radius the value of field 'radius'.
233 */
234 public void setRadius(float radius)
235 {
236 this._radius = radius;
237 this._has_radius = true;
238 }
239
240 /***
241 * Method unmarshalCircleRegion
242 *
243 * @param reader
244 */
245 public static org.astrogrid.registry.beans.v10.resource.dataservice.CircleRegion unmarshalCircleRegion(java.io.Reader reader)
246 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
247 {
248 return (org.astrogrid.registry.beans.v10.resource.dataservice.CircleRegion) Unmarshaller.unmarshal(org.astrogrid.registry.beans.v10.resource.dataservice.CircleRegion.class, reader);
249 }
250
251 /***
252 * Method validate
253 */
254 public void validate()
255 throws org.exolab.castor.xml.ValidationException
256 {
257 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
258 validator.validate(this);
259 }
260
261 }