1
2
3
4
5
6
7
8 package org.astrogrid.registry.beans.resource.votable;
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 java.util.ArrayList;
19 import java.util.Enumeration;
20 import org.astrogrid.registry.beans.resource.votable.types.VALUESTypeType;
21 import org.astrogrid.registry.beans.resource.votable.types.Yesno;
22 import org.exolab.castor.xml.MarshalException;
23 import org.exolab.castor.xml.Marshaller;
24 import org.exolab.castor.xml.Unmarshaller;
25 import org.exolab.castor.xml.ValidationException;
26 import org.xml.sax.ContentHandler;
27
28 /***
29 * Class VALUES.
30 *
31 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:14 $
32 */
33 public class VALUES extends org.astrogrid.common.bean.BaseBean
34 implements java.io.Serializable
35 {
36
37
38
39
40
41
42 /***
43 * Field _ID
44 */
45 private java.lang.String _ID;
46
47 /***
48 * Field _type
49 */
50 private org.astrogrid.registry.beans.resource.votable.types.VALUESTypeType _type = org.astrogrid.registry.beans.resource.votable.types.VALUESTypeType.valueOf("legal");
51
52 /***
53 * Field _null
54 */
55 private java.lang.String _null;
56
57 /***
58 * Field _invalid
59 */
60 private org.astrogrid.registry.beans.resource.votable.types.Yesno _invalid = org.astrogrid.registry.beans.resource.votable.types.Yesno.valueOf("no");
61
62 /***
63 * Field _MIN
64 */
65 private org.astrogrid.registry.beans.resource.votable.MIN _MIN;
66
67 /***
68 * Field _MAX
69 */
70 private org.astrogrid.registry.beans.resource.votable.MAX _MAX;
71
72 /***
73 * Field _OPTIONList
74 */
75 private java.util.ArrayList _OPTIONList;
76
77
78
79
80
81
82 public VALUES() {
83 super();
84 setType(org.astrogrid.registry.beans.resource.votable.types.VALUESTypeType.valueOf("legal"));
85 setInvalid(org.astrogrid.registry.beans.resource.votable.types.Yesno.valueOf("no"));
86 _OPTIONList = new ArrayList();
87 }
88
89
90
91
92
93
94 /***
95 * Method addOPTION
96 *
97 * @param vOPTION
98 */
99 public void addOPTION(org.astrogrid.registry.beans.resource.votable.OPTION vOPTION)
100 throws java.lang.IndexOutOfBoundsException
101 {
102 _OPTIONList.add(vOPTION);
103 }
104
105 /***
106 * Method addOPTION
107 *
108 * @param index
109 * @param vOPTION
110 */
111 public void addOPTION(int index, org.astrogrid.registry.beans.resource.votable.OPTION vOPTION)
112 throws java.lang.IndexOutOfBoundsException
113 {
114 _OPTIONList.add(index, vOPTION);
115 }
116
117 /***
118 * Method clearOPTION
119 */
120 public void clearOPTION()
121 {
122 _OPTIONList.clear();
123 }
124
125 /***
126 * Method enumerateOPTION
127 */
128 public java.util.Enumeration enumerateOPTION()
129 {
130 return new org.exolab.castor.util.IteratorEnumeration(_OPTIONList.iterator());
131 }
132
133 /***
134 * Note: hashCode() has not been overriden
135 *
136 * @param obj
137 */
138 public boolean equals(java.lang.Object obj)
139 {
140 if ( this == obj )
141 return true;
142
143 if (super.equals(obj)==false)
144 return false;
145
146 if (obj instanceof VALUES) {
147
148 VALUES temp = (VALUES)obj;
149 if (this._ID != null) {
150 if (temp._ID == null) return false;
151 else if (!(this._ID.equals(temp._ID)))
152 return false;
153 }
154 else if (temp._ID != null)
155 return false;
156 if (this._type != null) {
157 if (temp._type == null) return false;
158 else if (!(this._type.equals(temp._type)))
159 return false;
160 }
161 else if (temp._type != null)
162 return false;
163 if (this._null != null) {
164 if (temp._null == null) return false;
165 else if (!(this._null.equals(temp._null)))
166 return false;
167 }
168 else if (temp._null != null)
169 return false;
170 if (this._invalid != null) {
171 if (temp._invalid == null) return false;
172 else if (!(this._invalid.equals(temp._invalid)))
173 return false;
174 }
175 else if (temp._invalid != null)
176 return false;
177 if (this._MIN != null) {
178 if (temp._MIN == null) return false;
179 else if (!(this._MIN.equals(temp._MIN)))
180 return false;
181 }
182 else if (temp._MIN != null)
183 return false;
184 if (this._MAX != null) {
185 if (temp._MAX == null) return false;
186 else if (!(this._MAX.equals(temp._MAX)))
187 return false;
188 }
189 else if (temp._MAX != null)
190 return false;
191 if (this._OPTIONList != null) {
192 if (temp._OPTIONList == null) return false;
193 else if (!(this._OPTIONList.equals(temp._OPTIONList)))
194 return false;
195 }
196 else if (temp._OPTIONList != null)
197 return false;
198 return true;
199 }
200 return false;
201 }
202
203 /***
204 * Returns the value of field 'ID'.
205 *
206 * @return the value of field 'ID'.
207 */
208 public java.lang.String getID()
209 {
210 return this._ID;
211 }
212
213 /***
214 * Returns the value of field 'invalid'.
215 *
216 * @return the value of field 'invalid'.
217 */
218 public org.astrogrid.registry.beans.resource.votable.types.Yesno getInvalid()
219 {
220 return this._invalid;
221 }
222
223 /***
224 * Returns the value of field 'MAX'.
225 *
226 * @return the value of field 'MAX'.
227 */
228 public org.astrogrid.registry.beans.resource.votable.MAX getMAX()
229 {
230 return this._MAX;
231 }
232
233 /***
234 * Returns the value of field 'MIN'.
235 *
236 * @return the value of field 'MIN'.
237 */
238 public org.astrogrid.registry.beans.resource.votable.MIN getMIN()
239 {
240 return this._MIN;
241 }
242
243 /***
244 * Returns the value of field 'null'.
245 *
246 * @return the value of field 'null'.
247 */
248 public java.lang.String getNull()
249 {
250 return this._null;
251 }
252
253 /***
254 * Method getOPTION
255 *
256 * @param index
257 */
258 public org.astrogrid.registry.beans.resource.votable.OPTION getOPTION(int index)
259 throws java.lang.IndexOutOfBoundsException
260 {
261
262 if ((index < 0) || (index > _OPTIONList.size())) {
263 throw new IndexOutOfBoundsException();
264 }
265
266 return (org.astrogrid.registry.beans.resource.votable.OPTION) _OPTIONList.get(index);
267 }
268
269 /***
270 * Method getOPTION
271 */
272 public org.astrogrid.registry.beans.resource.votable.OPTION[] getOPTION()
273 {
274 int size = _OPTIONList.size();
275 org.astrogrid.registry.beans.resource.votable.OPTION[] mArray = new org.astrogrid.registry.beans.resource.votable.OPTION[size];
276 for (int index = 0; index < size; index++) {
277 mArray[index] = (org.astrogrid.registry.beans.resource.votable.OPTION) _OPTIONList.get(index);
278 }
279 return mArray;
280 }
281
282 /***
283 * Method getOPTIONCount
284 */
285 public int getOPTIONCount()
286 {
287 return _OPTIONList.size();
288 }
289
290 /***
291 * Returns the value of field 'type'.
292 *
293 * @return the value of field 'type'.
294 */
295 public org.astrogrid.registry.beans.resource.votable.types.VALUESTypeType getType()
296 {
297 return this._type;
298 }
299
300 /***
301 * Method isValid
302 */
303 public boolean isValid()
304 {
305 try {
306 validate();
307 }
308 catch (org.exolab.castor.xml.ValidationException vex) {
309 return false;
310 }
311 return true;
312 }
313
314 /***
315 * Method marshal
316 *
317 * @param out
318 */
319 public void marshal(java.io.Writer out)
320 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
321 {
322
323 Marshaller.marshal(this, out);
324 }
325
326 /***
327 * Method marshal
328 *
329 * @param handler
330 */
331 public void marshal(org.xml.sax.ContentHandler handler)
332 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
333 {
334
335 Marshaller.marshal(this, handler);
336 }
337
338 /***
339 * Method removeOPTION
340 *
341 * @param vOPTION
342 */
343 public boolean removeOPTION(org.astrogrid.registry.beans.resource.votable.OPTION vOPTION)
344 {
345 boolean removed = _OPTIONList.remove(vOPTION);
346 return removed;
347 }
348
349 /***
350 * Sets the value of field 'ID'.
351 *
352 * @param ID the value of field 'ID'.
353 */
354 public void setID(java.lang.String ID)
355 {
356 this._ID = ID;
357 }
358
359 /***
360 * Sets the value of field 'invalid'.
361 *
362 * @param invalid the value of field 'invalid'.
363 */
364 public void setInvalid(org.astrogrid.registry.beans.resource.votable.types.Yesno invalid)
365 {
366 this._invalid = invalid;
367 }
368
369 /***
370 * Sets the value of field 'MAX'.
371 *
372 * @param MAX the value of field 'MAX'.
373 */
374 public void setMAX(org.astrogrid.registry.beans.resource.votable.MAX MAX)
375 {
376 this._MAX = MAX;
377 }
378
379 /***
380 * Sets the value of field 'MIN'.
381 *
382 * @param MIN the value of field 'MIN'.
383 */
384 public void setMIN(org.astrogrid.registry.beans.resource.votable.MIN MIN)
385 {
386 this._MIN = MIN;
387 }
388
389 /***
390 * Sets the value of field 'null'.
391 *
392 * @param _null
393 * @param null the value of field 'null'.
394 */
395 public void setNull(java.lang.String _null)
396 {
397 this._null = _null;
398 }
399
400 /***
401 * Method setOPTION
402 *
403 * @param index
404 * @param vOPTION
405 */
406 public void setOPTION(int index, org.astrogrid.registry.beans.resource.votable.OPTION vOPTION)
407 throws java.lang.IndexOutOfBoundsException
408 {
409
410 if ((index < 0) || (index > _OPTIONList.size())) {
411 throw new IndexOutOfBoundsException();
412 }
413 _OPTIONList.set(index, vOPTION);
414 }
415
416 /***
417 * Method setOPTION
418 *
419 * @param OPTIONArray
420 */
421 public void setOPTION(org.astrogrid.registry.beans.resource.votable.OPTION[] OPTIONArray)
422 {
423
424 _OPTIONList.clear();
425 for (int i = 0; i < OPTIONArray.length; i++) {
426 _OPTIONList.add(OPTIONArray[i]);
427 }
428 }
429
430 /***
431 * Sets the value of field 'type'.
432 *
433 * @param type the value of field 'type'.
434 */
435 public void setType(org.astrogrid.registry.beans.resource.votable.types.VALUESTypeType type)
436 {
437 this._type = type;
438 }
439
440 /***
441 * Method unmarshalVALUES
442 *
443 * @param reader
444 */
445 public static org.astrogrid.registry.beans.resource.votable.VALUES unmarshalVALUES(java.io.Reader reader)
446 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
447 {
448 return (org.astrogrid.registry.beans.resource.votable.VALUES) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.votable.VALUES.class, reader);
449 }
450
451 /***
452 * Method validate
453 */
454 public void validate()
455 throws org.exolab.castor.xml.ValidationException
456 {
457 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
458 validator.validate(this);
459 }
460
461 }