autogenerated java classes for current schema
[vamsas.git] / src / org / vamsas / objects / core / AnnotationElement.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 0.9.9M2</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package org.vamsas.objects.core;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
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.Enumeration;
19 import java.util.Vector;
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 AnnotationElement.
28  * 
29  * @version $Revision$ $Date$
30  */
31 public class AnnotationElement extends org.vamsas.client.Vobject 
32 implements java.io.Serializable
33 {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * position with respect to the coordinate frame
42      *  defined by a rangeType specification
43      *  
44      */
45     private int _position;
46
47     /**
48      * keeps track of state for field: _position
49      */
50     private boolean _has_position;
51
52     /**
53      * true means the annotation element appears
54      *  between the specified position and the next
55      *  
56      */
57     private boolean _after = false;
58
59     /**
60      * keeps track of state for field: _after
61      */
62     private boolean _has_after;
63
64     /**
65      * Primary Key for vamsas object referencing
66      *  
67      */
68     private java.lang.String _id;
69
70     /**
71      * Free text at this position
72      *  
73      */
74     private java.lang.String _description;
75
76     /**
77      * Discrete symbol - possibly graphically
78      *  represented
79      *  
80      */
81     private java.util.Vector _glyphList;
82
83     /**
84      * Ordered set of float values - an application
85      *  may treat the values together as a vector
86      *  with common support for a set of annotation
87      *  elements - but this is, again, not validated
88      *  so applications should deal gracefully with
89      *  varying numbers of dimensions
90      *  
91      */
92     private java.util.Vector _valueList;
93
94
95       //----------------/
96      //- Constructors -/
97     //----------------/
98
99     public AnnotationElement() 
100      {
101         super();
102         _glyphList = new Vector();
103         _valueList = new Vector();
104     } //-- org.vamsas.objects.core.AnnotationElement()
105
106
107       //-----------/
108      //- Methods -/
109     //-----------/
110
111     /**
112      * Method addGlyph
113      * 
114      * 
115      * 
116      * @param vGlyph
117      */
118     public void addGlyph(org.vamsas.objects.core.Glyph vGlyph)
119         throws java.lang.IndexOutOfBoundsException
120     {
121         _glyphList.addElement(vGlyph);
122     } //-- void addGlyph(org.vamsas.objects.core.Glyph) 
123
124     /**
125      * Method addGlyph
126      * 
127      * 
128      * 
129      * @param index
130      * @param vGlyph
131      */
132     public void addGlyph(int index, org.vamsas.objects.core.Glyph vGlyph)
133         throws java.lang.IndexOutOfBoundsException
134     {
135         _glyphList.insertElementAt(vGlyph, index);
136     } //-- void addGlyph(int, org.vamsas.objects.core.Glyph) 
137
138     /**
139      * Method addValue
140      * 
141      * 
142      * 
143      * @param vValue
144      */
145     public void addValue(float vValue)
146         throws java.lang.IndexOutOfBoundsException
147     {
148         _valueList.addElement(new java.lang.Float(vValue));
149     } //-- void addValue(float) 
150
151     /**
152      * Method addValue
153      * 
154      * 
155      * 
156      * @param index
157      * @param vValue
158      */
159     public void addValue(int index, float vValue)
160         throws java.lang.IndexOutOfBoundsException
161     {
162         _valueList.insertElementAt(new java.lang.Float(vValue), index);
163     } //-- void addValue(int, float) 
164
165     /**
166      * Method deleteAfter
167      * 
168      */
169     public void deleteAfter()
170     {
171         this._has_after= false;
172     } //-- void deleteAfter() 
173
174     /**
175      * Method deletePosition
176      * 
177      */
178     public void deletePosition()
179     {
180         this._has_position= false;
181     } //-- void deletePosition() 
182
183     /**
184      * Method enumerateGlyph
185      * 
186      * 
187      * 
188      * @return Enumeration
189      */
190     public java.util.Enumeration enumerateGlyph()
191     {
192         return _glyphList.elements();
193     } //-- java.util.Enumeration enumerateGlyph() 
194
195     /**
196      * Method enumerateValue
197      * 
198      * 
199      * 
200      * @return Enumeration
201      */
202     public java.util.Enumeration enumerateValue()
203     {
204         return _valueList.elements();
205     } //-- java.util.Enumeration enumerateValue() 
206
207     /**
208      * Note: hashCode() has not been overriden
209      * 
210      * @param obj
211      * @return boolean
212      */
213     public boolean equals(java.lang.Object obj)
214     {
215         if ( this == obj )
216             return true;
217         
218         if (super.equals(obj)==false)
219             return false;
220         
221         if (obj instanceof AnnotationElement) {
222         
223             AnnotationElement temp = (AnnotationElement)obj;
224             if (this._position != temp._position)
225                 return false;
226             if (this._has_position != temp._has_position)
227                 return false;
228             if (this._after != temp._after)
229                 return false;
230             if (this._has_after != temp._has_after)
231                 return false;
232             if (this._id != null) {
233                 if (temp._id == null) return false;
234                 else if (!(this._id.equals(temp._id))) 
235                     return false;
236             }
237             else if (temp._id != null)
238                 return false;
239             if (this._description != null) {
240                 if (temp._description == null) return false;
241                 else if (!(this._description.equals(temp._description))) 
242                     return false;
243             }
244             else if (temp._description != null)
245                 return false;
246             if (this._glyphList != null) {
247                 if (temp._glyphList == null) return false;
248                 else if (!(this._glyphList.equals(temp._glyphList))) 
249                     return false;
250             }
251             else if (temp._glyphList != null)
252                 return false;
253             if (this._valueList != null) {
254                 if (temp._valueList == null) return false;
255                 else if (!(this._valueList.equals(temp._valueList))) 
256                     return false;
257             }
258             else if (temp._valueList != null)
259                 return false;
260             return true;
261         }
262         return false;
263     } //-- boolean equals(java.lang.Object) 
264
265     /**
266      * Returns the value of field 'after'. The field 'after' has
267      * the following description: true means the annotation element
268      * appears
269      *  between the specified position and the next
270      *  
271      * 
272      * @return boolean
273      * @return the value of field 'after'.
274      */
275     public boolean getAfter()
276     {
277         return this._after;
278     } //-- boolean getAfter() 
279
280     /**
281      * Returns the value of field 'description'. The field
282      * 'description' has the following description: Free text at
283      * this position
284      *  
285      * 
286      * @return String
287      * @return the value of field 'description'.
288      */
289     public java.lang.String getDescription()
290     {
291         return this._description;
292     } //-- java.lang.String getDescription() 
293
294     /**
295      * Method getGlyph
296      * 
297      * 
298      * 
299      * @param index
300      * @return Glyph
301      */
302     public org.vamsas.objects.core.Glyph getGlyph(int index)
303         throws java.lang.IndexOutOfBoundsException
304     {
305         //-- check bounds for index
306         if ((index < 0) || (index > _glyphList.size())) {
307             throw new IndexOutOfBoundsException("getGlyph: Index value '"+index+"' not in range [0.."+_glyphList.size()+ "]");
308         }
309         
310         return (org.vamsas.objects.core.Glyph) _glyphList.elementAt(index);
311     } //-- org.vamsas.objects.core.Glyph getGlyph(int) 
312
313     /**
314      * Method getGlyph
315      * 
316      * 
317      * 
318      * @return Glyph
319      */
320     public org.vamsas.objects.core.Glyph[] getGlyph()
321     {
322         int size = _glyphList.size();
323         org.vamsas.objects.core.Glyph[] mArray = new org.vamsas.objects.core.Glyph[size];
324         for (int index = 0; index < size; index++) {
325             mArray[index] = (org.vamsas.objects.core.Glyph) _glyphList.elementAt(index);
326         }
327         return mArray;
328     } //-- org.vamsas.objects.core.Glyph[] getGlyph() 
329
330     /**
331      * Method getGlyphCount
332      * 
333      * 
334      * 
335      * @return int
336      */
337     public int getGlyphCount()
338     {
339         return _glyphList.size();
340     } //-- int getGlyphCount() 
341
342     /**
343      * Returns the value of field 'id'. The field 'id' has the
344      * following description: Primary Key for vamsas object
345      * referencing
346      *  
347      * 
348      * @return String
349      * @return the value of field 'id'.
350      */
351     public java.lang.String getId()
352     {
353         return this._id;
354     } //-- java.lang.String getId() 
355
356     /**
357      * Returns the value of field 'position'. The field 'position'
358      * has the following description: position with respect to the
359      * coordinate frame
360      *  defined by a rangeType specification
361      *  
362      * 
363      * @return int
364      * @return the value of field 'position'.
365      */
366     public int getPosition()
367     {
368         return this._position;
369     } //-- int getPosition() 
370
371     /**
372      * Method getValue
373      * 
374      * 
375      * 
376      * @param index
377      * @return float
378      */
379     public float getValue(int index)
380         throws java.lang.IndexOutOfBoundsException
381     {
382         //-- check bounds for index
383         if ((index < 0) || (index > _valueList.size())) {
384             throw new IndexOutOfBoundsException("getValue: Index value '"+index+"' not in range [0.."+_valueList.size()+ "]");
385         }
386         
387         return ((java.lang.Float)_valueList.elementAt(index)).floatValue();
388     } //-- float getValue(int) 
389
390     /**
391      * Method getValue
392      * 
393      * 
394      * 
395      * @return float
396      */
397     public float[] getValue()
398     {
399         int size = _valueList.size();
400         float[] mArray = new float[size];
401         for (int index = 0; index < size; index++) {
402             mArray[index] = ((java.lang.Float)_valueList.elementAt(index)).floatValue();
403         }
404         return mArray;
405     } //-- float[] getValue() 
406
407     /**
408      * Method getValueCount
409      * 
410      * 
411      * 
412      * @return int
413      */
414     public int getValueCount()
415     {
416         return _valueList.size();
417     } //-- int getValueCount() 
418
419     /**
420      * Method hasAfter
421      * 
422      * 
423      * 
424      * @return boolean
425      */
426     public boolean hasAfter()
427     {
428         return this._has_after;
429     } //-- boolean hasAfter() 
430
431     /**
432      * Method hasPosition
433      * 
434      * 
435      * 
436      * @return boolean
437      */
438     public boolean hasPosition()
439     {
440         return this._has_position;
441     } //-- boolean hasPosition() 
442
443     /**
444      * Method isValid
445      * 
446      * 
447      * 
448      * @return boolean
449      */
450     public boolean isValid()
451     {
452         try {
453             validate();
454         }
455         catch (org.exolab.castor.xml.ValidationException vex) {
456             return false;
457         }
458         return true;
459     } //-- boolean isValid() 
460
461     /**
462      * Method marshal
463      * 
464      * 
465      * 
466      * @param out
467      */
468     public void marshal(java.io.Writer out)
469         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
470     {
471         
472         Marshaller.marshal(this, out);
473     } //-- void marshal(java.io.Writer) 
474
475     /**
476      * Method marshal
477      * 
478      * 
479      * 
480      * @param handler
481      */
482     public void marshal(org.xml.sax.ContentHandler handler)
483         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
484     {
485         
486         Marshaller.marshal(this, handler);
487     } //-- void marshal(org.xml.sax.ContentHandler) 
488
489     /**
490      * Method removeAllGlyph
491      * 
492      */
493     public void removeAllGlyph()
494     {
495         _glyphList.removeAllElements();
496     } //-- void removeAllGlyph() 
497
498     /**
499      * Method removeAllValue
500      * 
501      */
502     public void removeAllValue()
503     {
504         _valueList.removeAllElements();
505     } //-- void removeAllValue() 
506
507     /**
508      * Method removeGlyph
509      * 
510      * 
511      * 
512      * @param index
513      * @return Glyph
514      */
515     public org.vamsas.objects.core.Glyph removeGlyph(int index)
516     {
517         java.lang.Object obj = _glyphList.elementAt(index);
518         _glyphList.removeElementAt(index);
519         return (org.vamsas.objects.core.Glyph) obj;
520     } //-- org.vamsas.objects.core.Glyph removeGlyph(int) 
521
522     /**
523      * Method removeValue
524      * 
525      * 
526      * 
527      * @param index
528      * @return float
529      */
530     public float removeValue(int index)
531     {
532         java.lang.Object obj = _valueList.elementAt(index);
533         _valueList.removeElementAt(index);
534         return ((java.lang.Float)obj).floatValue();
535     } //-- float removeValue(int) 
536
537     /**
538      * Sets the value of field 'after'. The field 'after' has the
539      * following description: true means the annotation element
540      * appears
541      *  between the specified position and the next
542      *  
543      * 
544      * @param after the value of field 'after'.
545      */
546     public void setAfter(boolean after)
547     {
548         this._after = after;
549         this._has_after = true;
550     } //-- void setAfter(boolean) 
551
552     /**
553      * Sets the value of field 'description'. The field
554      * 'description' has the following description: Free text at
555      * this position
556      *  
557      * 
558      * @param description the value of field 'description'.
559      */
560     public void setDescription(java.lang.String description)
561     {
562         this._description = description;
563     } //-- void setDescription(java.lang.String) 
564
565     /**
566      * Method setGlyph
567      * 
568      * 
569      * 
570      * @param index
571      * @param vGlyph
572      */
573     public void setGlyph(int index, org.vamsas.objects.core.Glyph vGlyph)
574         throws java.lang.IndexOutOfBoundsException
575     {
576         //-- check bounds for index
577         if ((index < 0) || (index > _glyphList.size())) {
578             throw new IndexOutOfBoundsException("setGlyph: Index value '"+index+"' not in range [0.."+_glyphList.size()+ "]");
579         }
580         _glyphList.setElementAt(vGlyph, index);
581     } //-- void setGlyph(int, org.vamsas.objects.core.Glyph) 
582
583     /**
584      * Method setGlyph
585      * 
586      * 
587      * 
588      * @param glyphArray
589      */
590     public void setGlyph(org.vamsas.objects.core.Glyph[] glyphArray)
591     {
592         //-- copy array
593         _glyphList.removeAllElements();
594         for (int i = 0; i < glyphArray.length; i++) {
595             _glyphList.addElement(glyphArray[i]);
596         }
597     } //-- void setGlyph(org.vamsas.objects.core.Glyph) 
598
599     /**
600      * Sets the value of field 'id'. The field 'id' has the
601      * following description: Primary Key for vamsas object
602      * referencing
603      *  
604      * 
605      * @param id the value of field 'id'.
606      */
607     public void setId(java.lang.String id)
608     {
609         this._id = id;
610     } //-- void setId(java.lang.String) 
611
612     /**
613      * Sets the value of field 'position'. The field 'position' has
614      * the following description: position with respect to the
615      * coordinate frame
616      *  defined by a rangeType specification
617      *  
618      * 
619      * @param position the value of field 'position'.
620      */
621     public void setPosition(int position)
622     {
623         this._position = position;
624         this._has_position = true;
625     } //-- void setPosition(int) 
626
627     /**
628      * Method setValue
629      * 
630      * 
631      * 
632      * @param index
633      * @param vValue
634      */
635     public void setValue(int index, float vValue)
636         throws java.lang.IndexOutOfBoundsException
637     {
638         //-- check bounds for index
639         if ((index < 0) || (index > _valueList.size())) {
640             throw new IndexOutOfBoundsException("setValue: Index value '"+index+"' not in range [0.."+_valueList.size()+ "]");
641         }
642         _valueList.setElementAt(new java.lang.Float(vValue), index);
643     } //-- void setValue(int, float) 
644
645     /**
646      * Method setValue
647      * 
648      * 
649      * 
650      * @param valueArray
651      */
652     public void setValue(float[] valueArray)
653     {
654         //-- copy array
655         _valueList.removeAllElements();
656         for (int i = 0; i < valueArray.length; i++) {
657             _valueList.addElement(new java.lang.Float(valueArray[i]));
658         }
659     } //-- void setValue(float) 
660
661     /**
662      * Method unmarshal
663      * 
664      * 
665      * 
666      * @param reader
667      * @return AnnotationElement
668      */
669     public static org.vamsas.objects.core.AnnotationElement unmarshal(java.io.Reader reader)
670         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
671     {
672         return (org.vamsas.objects.core.AnnotationElement) Unmarshaller.unmarshal(org.vamsas.objects.core.AnnotationElement.class, reader);
673     } //-- org.vamsas.objects.core.AnnotationElement unmarshal(java.io.Reader) 
674
675     /**
676      * Method validate
677      * 
678      */
679     public void validate()
680         throws org.exolab.castor.xml.ValidationException
681     {
682         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
683         validator.validate(this);
684     } //-- void validate() 
685
686 }