Created by Castor
[jalview.git] / src / jalview / binding / Annotation.java
1 /*\r
2  * This class was automatically generated with \r
3  * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 \r
8 package jalview.binding;\r
9 \r
10   //---------------------------------/\r
11  //- Imported classes and packages -/\r
12 //---------------------------------/\r
13 \r
14 import java.io.IOException;\r
15 import java.io.Reader;\r
16 import java.io.Serializable;\r
17 import java.io.Writer;\r
18 import java.util.Enumeration;\r
19 import java.util.Vector;\r
20 import org.exolab.castor.xml.MarshalException;\r
21 import org.exolab.castor.xml.Marshaller;\r
22 import org.exolab.castor.xml.Unmarshaller;\r
23 import org.exolab.castor.xml.ValidationException;\r
24 import org.xml.sax.ContentHandler;\r
25 \r
26 /**\r
27  * Class Annotation.\r
28  * \r
29  * @version $Revision$ $Date$\r
30  */\r
31 public class Annotation implements java.io.Serializable {\r
32 \r
33 \r
34       //--------------------------/\r
35      //- Class/Member Variables -/\r
36     //--------------------------/\r
37 \r
38     /**\r
39      * Field _graph\r
40      */\r
41     private boolean _graph;\r
42 \r
43     /**\r
44      * keeps track of state for field: _graph\r
45      */\r
46     private boolean _has_graph;\r
47 \r
48     /**\r
49      * Field _annotationElementList\r
50      */\r
51     private java.util.Vector _annotationElementList;\r
52 \r
53     /**\r
54      * Field _label\r
55      */\r
56     private java.lang.String _label;\r
57 \r
58     /**\r
59      * Field _description\r
60      */\r
61     private java.lang.String _description;\r
62 \r
63 \r
64       //----------------/\r
65      //- Constructors -/\r
66     //----------------/\r
67 \r
68     public Annotation() {\r
69         super();\r
70         _annotationElementList = new Vector();\r
71     } //-- jalview.binding.Annotation()\r
72 \r
73 \r
74       //-----------/\r
75      //- Methods -/\r
76     //-----------/\r
77 \r
78     /**\r
79      * Method addAnnotationElement\r
80      * \r
81      * \r
82      * \r
83      * @param vAnnotationElement\r
84      */\r
85     public void addAnnotationElement(jalview.binding.AnnotationElement vAnnotationElement)\r
86         throws java.lang.IndexOutOfBoundsException\r
87     {\r
88         _annotationElementList.addElement(vAnnotationElement);\r
89     } //-- void addAnnotationElement(jalview.binding.AnnotationElement) \r
90 \r
91     /**\r
92      * Method addAnnotationElement\r
93      * \r
94      * \r
95      * \r
96      * @param index\r
97      * @param vAnnotationElement\r
98      */\r
99     public void addAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
100         throws java.lang.IndexOutOfBoundsException\r
101     {\r
102         _annotationElementList.insertElementAt(vAnnotationElement, index);\r
103     } //-- void addAnnotationElement(int, jalview.binding.AnnotationElement) \r
104 \r
105     /**\r
106      * Method deleteGraph\r
107      * \r
108      */\r
109     public void deleteGraph()\r
110     {\r
111         this._has_graph= false;\r
112     } //-- void deleteGraph() \r
113 \r
114     /**\r
115      * Method enumerateAnnotationElement\r
116      * \r
117      * \r
118      * \r
119      * @return Enumeration\r
120      */\r
121     public java.util.Enumeration enumerateAnnotationElement()\r
122     {\r
123         return _annotationElementList.elements();\r
124     } //-- java.util.Enumeration enumerateAnnotationElement() \r
125 \r
126     /**\r
127      * Method getAnnotationElement\r
128      * \r
129      * \r
130      * \r
131      * @param index\r
132      * @return AnnotationElement\r
133      */\r
134     public jalview.binding.AnnotationElement getAnnotationElement(int index)\r
135         throws java.lang.IndexOutOfBoundsException\r
136     {\r
137         //-- check bounds for index\r
138         if ((index < 0) || (index > _annotationElementList.size())) {\r
139             throw new IndexOutOfBoundsException();\r
140         }\r
141         \r
142         return (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
143     } //-- jalview.binding.AnnotationElement getAnnotationElement(int) \r
144 \r
145     /**\r
146      * Method getAnnotationElement\r
147      * \r
148      * \r
149      * \r
150      * @return AnnotationElement\r
151      */\r
152     public jalview.binding.AnnotationElement[] getAnnotationElement()\r
153     {\r
154         int size = _annotationElementList.size();\r
155         jalview.binding.AnnotationElement[] mArray = new jalview.binding.AnnotationElement[size];\r
156         for (int index = 0; index < size; index++) {\r
157             mArray[index] = (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
158         }\r
159         return mArray;\r
160     } //-- jalview.binding.AnnotationElement[] getAnnotationElement() \r
161 \r
162     /**\r
163      * Method getAnnotationElementCount\r
164      * \r
165      * \r
166      * \r
167      * @return int\r
168      */\r
169     public int getAnnotationElementCount()\r
170     {\r
171         return _annotationElementList.size();\r
172     } //-- int getAnnotationElementCount() \r
173 \r
174     /**\r
175      * Returns the value of field 'description'.\r
176      * \r
177      * @return String\r
178      * @return the value of field 'description'.\r
179      */\r
180     public java.lang.String getDescription()\r
181     {\r
182         return this._description;\r
183     } //-- java.lang.String getDescription() \r
184 \r
185     /**\r
186      * Returns the value of field 'graph'.\r
187      * \r
188      * @return boolean\r
189      * @return the value of field 'graph'.\r
190      */\r
191     public boolean getGraph()\r
192     {\r
193         return this._graph;\r
194     } //-- boolean getGraph() \r
195 \r
196     /**\r
197      * Returns the value of field 'label'.\r
198      * \r
199      * @return String\r
200      * @return the value of field 'label'.\r
201      */\r
202     public java.lang.String getLabel()\r
203     {\r
204         return this._label;\r
205     } //-- java.lang.String getLabel() \r
206 \r
207     /**\r
208      * Method hasGraph\r
209      * \r
210      * \r
211      * \r
212      * @return boolean\r
213      */\r
214     public boolean hasGraph()\r
215     {\r
216         return this._has_graph;\r
217     } //-- boolean hasGraph() \r
218 \r
219     /**\r
220      * Method isValid\r
221      * \r
222      * \r
223      * \r
224      * @return boolean\r
225      */\r
226     public boolean isValid()\r
227     {\r
228         try {\r
229             validate();\r
230         }\r
231         catch (org.exolab.castor.xml.ValidationException vex) {\r
232             return false;\r
233         }\r
234         return true;\r
235     } //-- boolean isValid() \r
236 \r
237     /**\r
238      * Method marshal\r
239      * \r
240      * \r
241      * \r
242      * @param out\r
243      */\r
244     public void marshal(java.io.Writer out)\r
245         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
246     {\r
247         \r
248         Marshaller.marshal(this, out);\r
249     } //-- void marshal(java.io.Writer) \r
250 \r
251     /**\r
252      * Method marshal\r
253      * \r
254      * \r
255      * \r
256      * @param handler\r
257      */\r
258     public void marshal(org.xml.sax.ContentHandler handler)\r
259         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
260     {\r
261         \r
262         Marshaller.marshal(this, handler);\r
263     } //-- void marshal(org.xml.sax.ContentHandler) \r
264 \r
265     /**\r
266      * Method removeAllAnnotationElement\r
267      * \r
268      */\r
269     public void removeAllAnnotationElement()\r
270     {\r
271         _annotationElementList.removeAllElements();\r
272     } //-- void removeAllAnnotationElement() \r
273 \r
274     /**\r
275      * Method removeAnnotationElement\r
276      * \r
277      * \r
278      * \r
279      * @param index\r
280      * @return AnnotationElement\r
281      */\r
282     public jalview.binding.AnnotationElement removeAnnotationElement(int index)\r
283     {\r
284         java.lang.Object obj = _annotationElementList.elementAt(index);\r
285         _annotationElementList.removeElementAt(index);\r
286         return (jalview.binding.AnnotationElement) obj;\r
287     } //-- jalview.binding.AnnotationElement removeAnnotationElement(int) \r
288 \r
289     /**\r
290      * Method setAnnotationElement\r
291      * \r
292      * \r
293      * \r
294      * @param index\r
295      * @param vAnnotationElement\r
296      */\r
297     public void setAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
298         throws java.lang.IndexOutOfBoundsException\r
299     {\r
300         //-- check bounds for index\r
301         if ((index < 0) || (index > _annotationElementList.size())) {\r
302             throw new IndexOutOfBoundsException();\r
303         }\r
304         _annotationElementList.setElementAt(vAnnotationElement, index);\r
305     } //-- void setAnnotationElement(int, jalview.binding.AnnotationElement) \r
306 \r
307     /**\r
308      * Method setAnnotationElement\r
309      * \r
310      * \r
311      * \r
312      * @param annotationElementArray\r
313      */\r
314     public void setAnnotationElement(jalview.binding.AnnotationElement[] annotationElementArray)\r
315     {\r
316         //-- copy array\r
317         _annotationElementList.removeAllElements();\r
318         for (int i = 0; i < annotationElementArray.length; i++) {\r
319             _annotationElementList.addElement(annotationElementArray[i]);\r
320         }\r
321     } //-- void setAnnotationElement(jalview.binding.AnnotationElement) \r
322 \r
323     /**\r
324      * Sets the value of field 'description'.\r
325      * \r
326      * @param description the value of field 'description'.\r
327      */\r
328     public void setDescription(java.lang.String description)\r
329     {\r
330         this._description = description;\r
331     } //-- void setDescription(java.lang.String) \r
332 \r
333     /**\r
334      * Sets the value of field 'graph'.\r
335      * \r
336      * @param graph the value of field 'graph'.\r
337      */\r
338     public void setGraph(boolean graph)\r
339     {\r
340         this._graph = graph;\r
341         this._has_graph = true;\r
342     } //-- void setGraph(boolean) \r
343 \r
344     /**\r
345      * Sets the value of field 'label'.\r
346      * \r
347      * @param label the value of field 'label'.\r
348      */\r
349     public void setLabel(java.lang.String label)\r
350     {\r
351         this._label = label;\r
352     } //-- void setLabel(java.lang.String) \r
353 \r
354     /**\r
355      * Method unmarshal\r
356      * \r
357      * \r
358      * \r
359      * @param reader\r
360      * @return Object\r
361      */\r
362     public static java.lang.Object unmarshal(java.io.Reader reader)\r
363         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
364     {\r
365         return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);\r
366     } //-- java.lang.Object unmarshal(java.io.Reader) \r
367 \r
368     /**\r
369      * Method validate\r
370      * \r
371      */\r
372     public void validate()\r
373         throws org.exolab.castor.xml.ValidationException\r
374     {\r
375         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
376         validator.validate(this);\r
377     } //-- void validate() \r
378 \r
379 }\r