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.exolab.castor.xml.MarshalException;
21 import org.exolab.castor.xml.Marshaller;
22 import org.exolab.castor.xml.Unmarshaller;
23 import org.exolab.castor.xml.ValidationException;
24 import org.xml.sax.ContentHandler;
25
26 /***
27 * Class TABLE.
28 *
29 * @version $Revision: 1.14 $ $Date: 2007/01/04 16:26:14 $
30 */
31 public class TABLE extends org.astrogrid.common.bean.BaseBean
32 implements java.io.Serializable
33 {
34
35
36
37
38
39
40 /***
41 * Field _ID
42 */
43 private java.lang.String _ID;
44
45 /***
46 * Field _name
47 */
48 private java.lang.String _name;
49
50 /***
51 * Field _ref
52 */
53 private java.lang.Object _ref;
54
55 /***
56 * Field _DESCRIPTION
57 */
58 private org.astrogrid.registry.beans.resource.votable.AnyTEXT _DESCRIPTION;
59
60 /***
61 * Field _FIELDList
62 */
63 private java.util.ArrayList _FIELDList;
64
65 /***
66 * Field _LINKList
67 */
68 private java.util.ArrayList _LINKList;
69
70 /***
71 * Field _DATA
72 */
73 private org.astrogrid.registry.beans.resource.votable.DATA _DATA;
74
75
76
77
78
79
80 public TABLE() {
81 super();
82 _FIELDList = new ArrayList();
83 _LINKList = new ArrayList();
84 }
85
86
87
88
89
90
91 /***
92 * Method addFIELD
93 *
94 * @param vFIELD
95 */
96 public void addFIELD(org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
97 throws java.lang.IndexOutOfBoundsException
98 {
99 _FIELDList.add(vFIELD);
100 }
101
102 /***
103 * Method addFIELD
104 *
105 * @param index
106 * @param vFIELD
107 */
108 public void addFIELD(int index, org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
109 throws java.lang.IndexOutOfBoundsException
110 {
111 _FIELDList.add(index, vFIELD);
112 }
113
114 /***
115 * Method addLINK
116 *
117 * @param vLINK
118 */
119 public void addLINK(org.astrogrid.registry.beans.resource.votable.LINK vLINK)
120 throws java.lang.IndexOutOfBoundsException
121 {
122 _LINKList.add(vLINK);
123 }
124
125 /***
126 * Method addLINK
127 *
128 * @param index
129 * @param vLINK
130 */
131 public void addLINK(int index, org.astrogrid.registry.beans.resource.votable.LINK vLINK)
132 throws java.lang.IndexOutOfBoundsException
133 {
134 _LINKList.add(index, vLINK);
135 }
136
137 /***
138 * Method clearFIELD
139 */
140 public void clearFIELD()
141 {
142 _FIELDList.clear();
143 }
144
145 /***
146 * Method clearLINK
147 */
148 public void clearLINK()
149 {
150 _LINKList.clear();
151 }
152
153 /***
154 * Method enumerateFIELD
155 */
156 public java.util.Enumeration enumerateFIELD()
157 {
158 return new org.exolab.castor.util.IteratorEnumeration(_FIELDList.iterator());
159 }
160
161 /***
162 * Method enumerateLINK
163 */
164 public java.util.Enumeration enumerateLINK()
165 {
166 return new org.exolab.castor.util.IteratorEnumeration(_LINKList.iterator());
167 }
168
169 /***
170 * Note: hashCode() has not been overriden
171 *
172 * @param obj
173 */
174 public boolean equals(java.lang.Object obj)
175 {
176 if ( this == obj )
177 return true;
178
179 if (super.equals(obj)==false)
180 return false;
181
182 if (obj instanceof TABLE) {
183
184 TABLE temp = (TABLE)obj;
185 if (this._ID != null) {
186 if (temp._ID == null) return false;
187 else if (!(this._ID.equals(temp._ID)))
188 return false;
189 }
190 else if (temp._ID != null)
191 return false;
192 if (this._name != null) {
193 if (temp._name == null) return false;
194 else if (!(this._name.equals(temp._name)))
195 return false;
196 }
197 else if (temp._name != null)
198 return false;
199 if (this._ref != null) {
200 if (temp._ref == null) return false;
201 else if (!(this._ref.equals(temp._ref)))
202 return false;
203 }
204 else if (temp._ref != null)
205 return false;
206 if (this._DESCRIPTION != null) {
207 if (temp._DESCRIPTION == null) return false;
208 else if (!(this._DESCRIPTION.equals(temp._DESCRIPTION)))
209 return false;
210 }
211 else if (temp._DESCRIPTION != null)
212 return false;
213 if (this._FIELDList != null) {
214 if (temp._FIELDList == null) return false;
215 else if (!(this._FIELDList.equals(temp._FIELDList)))
216 return false;
217 }
218 else if (temp._FIELDList != null)
219 return false;
220 if (this._LINKList != null) {
221 if (temp._LINKList == null) return false;
222 else if (!(this._LINKList.equals(temp._LINKList)))
223 return false;
224 }
225 else if (temp._LINKList != null)
226 return false;
227 if (this._DATA != null) {
228 if (temp._DATA == null) return false;
229 else if (!(this._DATA.equals(temp._DATA)))
230 return false;
231 }
232 else if (temp._DATA != null)
233 return false;
234 return true;
235 }
236 return false;
237 }
238
239 /***
240 * Returns the value of field 'DATA'.
241 *
242 * @return the value of field 'DATA'.
243 */
244 public org.astrogrid.registry.beans.resource.votable.DATA getDATA()
245 {
246 return this._DATA;
247 }
248
249 /***
250 * Returns the value of field 'DESCRIPTION'.
251 *
252 * @return the value of field 'DESCRIPTION'.
253 */
254 public org.astrogrid.registry.beans.resource.votable.AnyTEXT getDESCRIPTION()
255 {
256 return this._DESCRIPTION;
257 }
258
259 /***
260 * Method getFIELD
261 *
262 * @param index
263 */
264 public org.astrogrid.registry.beans.resource.votable.FIELD getFIELD(int index)
265 throws java.lang.IndexOutOfBoundsException
266 {
267
268 if ((index < 0) || (index > _FIELDList.size())) {
269 throw new IndexOutOfBoundsException();
270 }
271
272 return (org.astrogrid.registry.beans.resource.votable.FIELD) _FIELDList.get(index);
273 }
274
275 /***
276 * Method getFIELD
277 */
278 public org.astrogrid.registry.beans.resource.votable.FIELD[] getFIELD()
279 {
280 int size = _FIELDList.size();
281 org.astrogrid.registry.beans.resource.votable.FIELD[] mArray = new org.astrogrid.registry.beans.resource.votable.FIELD[size];
282 for (int index = 0; index < size; index++) {
283 mArray[index] = (org.astrogrid.registry.beans.resource.votable.FIELD) _FIELDList.get(index);
284 }
285 return mArray;
286 }
287
288 /***
289 * Method getFIELDCount
290 */
291 public int getFIELDCount()
292 {
293 return _FIELDList.size();
294 }
295
296 /***
297 * Returns the value of field 'ID'.
298 *
299 * @return the value of field 'ID'.
300 */
301 public java.lang.String getID()
302 {
303 return this._ID;
304 }
305
306 /***
307 * Method getLINK
308 *
309 * @param index
310 */
311 public org.astrogrid.registry.beans.resource.votable.LINK getLINK(int index)
312 throws java.lang.IndexOutOfBoundsException
313 {
314
315 if ((index < 0) || (index > _LINKList.size())) {
316 throw new IndexOutOfBoundsException();
317 }
318
319 return (org.astrogrid.registry.beans.resource.votable.LINK) _LINKList.get(index);
320 }
321
322 /***
323 * Method getLINK
324 */
325 public org.astrogrid.registry.beans.resource.votable.LINK[] getLINK()
326 {
327 int size = _LINKList.size();
328 org.astrogrid.registry.beans.resource.votable.LINK[] mArray = new org.astrogrid.registry.beans.resource.votable.LINK[size];
329 for (int index = 0; index < size; index++) {
330 mArray[index] = (org.astrogrid.registry.beans.resource.votable.LINK) _LINKList.get(index);
331 }
332 return mArray;
333 }
334
335 /***
336 * Method getLINKCount
337 */
338 public int getLINKCount()
339 {
340 return _LINKList.size();
341 }
342
343 /***
344 * Returns the value of field 'name'.
345 *
346 * @return the value of field 'name'.
347 */
348 public java.lang.String getName()
349 {
350 return this._name;
351 }
352
353 /***
354 * Returns the value of field 'ref'.
355 *
356 * @return the value of field 'ref'.
357 */
358 public java.lang.Object getRef()
359 {
360 return this._ref;
361 }
362
363 /***
364 * Method isValid
365 */
366 public boolean isValid()
367 {
368 try {
369 validate();
370 }
371 catch (org.exolab.castor.xml.ValidationException vex) {
372 return false;
373 }
374 return true;
375 }
376
377 /***
378 * Method marshal
379 *
380 * @param out
381 */
382 public void marshal(java.io.Writer out)
383 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
384 {
385
386 Marshaller.marshal(this, out);
387 }
388
389 /***
390 * Method marshal
391 *
392 * @param handler
393 */
394 public void marshal(org.xml.sax.ContentHandler handler)
395 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
396 {
397
398 Marshaller.marshal(this, handler);
399 }
400
401 /***
402 * Method removeFIELD
403 *
404 * @param vFIELD
405 */
406 public boolean removeFIELD(org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
407 {
408 boolean removed = _FIELDList.remove(vFIELD);
409 return removed;
410 }
411
412 /***
413 * Method removeLINK
414 *
415 * @param vLINK
416 */
417 public boolean removeLINK(org.astrogrid.registry.beans.resource.votable.LINK vLINK)
418 {
419 boolean removed = _LINKList.remove(vLINK);
420 return removed;
421 }
422
423 /***
424 * Sets the value of field 'DATA'.
425 *
426 * @param DATA the value of field 'DATA'.
427 */
428 public void setDATA(org.astrogrid.registry.beans.resource.votable.DATA DATA)
429 {
430 this._DATA = DATA;
431 }
432
433 /***
434 * Sets the value of field 'DESCRIPTION'.
435 *
436 * @param DESCRIPTION the value of field 'DESCRIPTION'.
437 */
438 public void setDESCRIPTION(org.astrogrid.registry.beans.resource.votable.AnyTEXT DESCRIPTION)
439 {
440 this._DESCRIPTION = DESCRIPTION;
441 }
442
443 /***
444 * Method setFIELD
445 *
446 * @param index
447 * @param vFIELD
448 */
449 public void setFIELD(int index, org.astrogrid.registry.beans.resource.votable.FIELD vFIELD)
450 throws java.lang.IndexOutOfBoundsException
451 {
452
453 if ((index < 0) || (index > _FIELDList.size())) {
454 throw new IndexOutOfBoundsException();
455 }
456 _FIELDList.set(index, vFIELD);
457 }
458
459 /***
460 * Method setFIELD
461 *
462 * @param FIELDArray
463 */
464 public void setFIELD(org.astrogrid.registry.beans.resource.votable.FIELD[] FIELDArray)
465 {
466
467 _FIELDList.clear();
468 for (int i = 0; i < FIELDArray.length; i++) {
469 _FIELDList.add(FIELDArray[i]);
470 }
471 }
472
473 /***
474 * Sets the value of field 'ID'.
475 *
476 * @param ID the value of field 'ID'.
477 */
478 public void setID(java.lang.String ID)
479 {
480 this._ID = ID;
481 }
482
483 /***
484 * Method setLINK
485 *
486 * @param index
487 * @param vLINK
488 */
489 public void setLINK(int index, org.astrogrid.registry.beans.resource.votable.LINK vLINK)
490 throws java.lang.IndexOutOfBoundsException
491 {
492
493 if ((index < 0) || (index > _LINKList.size())) {
494 throw new IndexOutOfBoundsException();
495 }
496 _LINKList.set(index, vLINK);
497 }
498
499 /***
500 * Method setLINK
501 *
502 * @param LINKArray
503 */
504 public void setLINK(org.astrogrid.registry.beans.resource.votable.LINK[] LINKArray)
505 {
506
507 _LINKList.clear();
508 for (int i = 0; i < LINKArray.length; i++) {
509 _LINKList.add(LINKArray[i]);
510 }
511 }
512
513 /***
514 * Sets the value of field 'name'.
515 *
516 * @param name the value of field 'name'.
517 */
518 public void setName(java.lang.String name)
519 {
520 this._name = name;
521 }
522
523 /***
524 * Sets the value of field 'ref'.
525 *
526 * @param ref the value of field 'ref'.
527 */
528 public void setRef(java.lang.Object ref)
529 {
530 this._ref = ref;
531 }
532
533 /***
534 * Method unmarshalTABLE
535 *
536 * @param reader
537 */
538 public static org.astrogrid.registry.beans.resource.votable.TABLE unmarshalTABLE(java.io.Reader reader)
539 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
540 {
541 return (org.astrogrid.registry.beans.resource.votable.TABLE) Unmarshaller.unmarshal(org.astrogrid.registry.beans.resource.votable.TABLE.class, reader);
542 }
543
544 /***
545 * Method validate
546 */
547 public void validate()
548 throws org.exolab.castor.xml.ValidationException
549 {
550 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
551 validator.validate(this);
552 }
553
554 }