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