GPL license added
[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 /*\r
9 * Jalview - A Sequence Alignment Editor and Viewer\r
10 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
11 *\r
12 * This program is free software; you can redistribute it and/or\r
13 * modify it under the terms of the GNU General Public License\r
14 * as published by the Free Software Foundation; either version 2\r
15 * of the License, or (at your option) any later version.\r
16 *\r
17 * This program is distributed in the hope that it will be useful,\r
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
20 * GNU General Public License for more details.\r
21 *\r
22 * You should have received a copy of the GNU General Public License\r
23 * along with this program; if not, write to the Free Software\r
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
25 */\r
26 \r
27 package jalview.binding;\r
28 \r
29   //---------------------------------/\r
30  //- Imported classes and packages -/\r
31 //---------------------------------/\r
32 \r
33 import java.io.IOException;\r
34 import java.io.Reader;\r
35 import java.io.Serializable;\r
36 import java.io.Writer;\r
37 import java.util.Enumeration;\r
38 import java.util.Vector;\r
39 import org.exolab.castor.xml.MarshalException;\r
40 import org.exolab.castor.xml.Marshaller;\r
41 import org.exolab.castor.xml.Unmarshaller;\r
42 import org.exolab.castor.xml.ValidationException;\r
43 import org.xml.sax.ContentHandler;\r
44 \r
45 /**\r
46  * Class Annotation.\r
47  *\r
48  * @version $Revision$ $Date$\r
49  */\r
50 public class Annotation implements java.io.Serializable {\r
51 \r
52 \r
53       //--------------------------/\r
54      //- Class/Member Variables -/\r
55     //--------------------------/\r
56 \r
57     /**\r
58      * Field _graph\r
59      */\r
60     private boolean _graph;\r
61 \r
62     /**\r
63      * keeps track of state for field: _graph\r
64      */\r
65     private boolean _has_graph;\r
66 \r
67     /**\r
68      * Field _annotationElementList\r
69      */\r
70     private java.util.Vector _annotationElementList;\r
71 \r
72     /**\r
73      * Field _label\r
74      */\r
75     private java.lang.String _label;\r
76 \r
77     /**\r
78      * Field _description\r
79      */\r
80     private java.lang.String _description;\r
81 \r
82 \r
83       //----------------/\r
84      //- Constructors -/\r
85     //----------------/\r
86 \r
87     public Annotation() {\r
88         super();\r
89         _annotationElementList = new Vector();\r
90     } //-- jalview.binding.Annotation()\r
91 \r
92 \r
93       //-----------/\r
94      //- Methods -/\r
95     //-----------/\r
96 \r
97     /**\r
98      * Method addAnnotationElement\r
99      *\r
100      *\r
101      *\r
102      * @param vAnnotationElement\r
103      */\r
104     public void addAnnotationElement(jalview.binding.AnnotationElement vAnnotationElement)\r
105         throws java.lang.IndexOutOfBoundsException\r
106     {\r
107         _annotationElementList.addElement(vAnnotationElement);\r
108     } //-- void addAnnotationElement(jalview.binding.AnnotationElement)\r
109 \r
110     /**\r
111      * Method addAnnotationElement\r
112      *\r
113      *\r
114      *\r
115      * @param index\r
116      * @param vAnnotationElement\r
117      */\r
118     public void addAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
119         throws java.lang.IndexOutOfBoundsException\r
120     {\r
121         _annotationElementList.insertElementAt(vAnnotationElement, index);\r
122     } //-- void addAnnotationElement(int, jalview.binding.AnnotationElement)\r
123 \r
124     /**\r
125      * Method deleteGraph\r
126      *\r
127      */\r
128     public void deleteGraph()\r
129     {\r
130         this._has_graph= false;\r
131     } //-- void deleteGraph()\r
132 \r
133     /**\r
134      * Method enumerateAnnotationElement\r
135      *\r
136      *\r
137      *\r
138      * @return Enumeration\r
139      */\r
140     public java.util.Enumeration enumerateAnnotationElement()\r
141     {\r
142         return _annotationElementList.elements();\r
143     } //-- java.util.Enumeration enumerateAnnotationElement()\r
144 \r
145     /**\r
146      * Method getAnnotationElement\r
147      *\r
148      *\r
149      *\r
150      * @param index\r
151      * @return AnnotationElement\r
152      */\r
153     public jalview.binding.AnnotationElement getAnnotationElement(int index)\r
154         throws java.lang.IndexOutOfBoundsException\r
155     {\r
156         //-- check bounds for index\r
157         if ((index < 0) || (index > _annotationElementList.size())) {\r
158             throw new IndexOutOfBoundsException();\r
159         }\r
160 \r
161         return (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
162     } //-- jalview.binding.AnnotationElement getAnnotationElement(int)\r
163 \r
164     /**\r
165      * Method getAnnotationElement\r
166      *\r
167      *\r
168      *\r
169      * @return AnnotationElement\r
170      */\r
171     public jalview.binding.AnnotationElement[] getAnnotationElement()\r
172     {\r
173         int size = _annotationElementList.size();\r
174         jalview.binding.AnnotationElement[] mArray = new jalview.binding.AnnotationElement[size];\r
175         for (int index = 0; index < size; index++) {\r
176             mArray[index] = (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
177         }\r
178         return mArray;\r
179     } //-- jalview.binding.AnnotationElement[] getAnnotationElement()\r
180 \r
181     /**\r
182      * Method getAnnotationElementCount\r
183      *\r
184      *\r
185      *\r
186      * @return int\r
187      */\r
188     public int getAnnotationElementCount()\r
189     {\r
190         return _annotationElementList.size();\r
191     } //-- int getAnnotationElementCount()\r
192 \r
193     /**\r
194      * Returns the value of field 'description'.\r
195      *\r
196      * @return String\r
197      * @return the value of field 'description'.\r
198      */\r
199     public java.lang.String getDescription()\r
200     {\r
201         return this._description;\r
202     } //-- java.lang.String getDescription()\r
203 \r
204     /**\r
205      * Returns the value of field 'graph'.\r
206      *\r
207      * @return boolean\r
208      * @return the value of field 'graph'.\r
209      */\r
210     public boolean getGraph()\r
211     {\r
212         return this._graph;\r
213     } //-- boolean getGraph()\r
214 \r
215     /**\r
216      * Returns the value of field 'label'.\r
217      *\r
218      * @return String\r
219      * @return the value of field 'label'.\r
220      */\r
221     public java.lang.String getLabel()\r
222     {\r
223         return this._label;\r
224     } //-- java.lang.String getLabel()\r
225 \r
226     /**\r
227      * Method hasGraph\r
228      *\r
229      *\r
230      *\r
231      * @return boolean\r
232      */\r
233     public boolean hasGraph()\r
234     {\r
235         return this._has_graph;\r
236     } //-- boolean hasGraph()\r
237 \r
238     /**\r
239      * Method isValid\r
240      *\r
241      *\r
242      *\r
243      * @return boolean\r
244      */\r
245     public boolean isValid()\r
246     {\r
247         try {\r
248             validate();\r
249         }\r
250         catch (org.exolab.castor.xml.ValidationException vex) {\r
251             return false;\r
252         }\r
253         return true;\r
254     } //-- boolean isValid()\r
255 \r
256     /**\r
257      * Method marshal\r
258      *\r
259      *\r
260      *\r
261      * @param out\r
262      */\r
263     public void marshal(java.io.Writer out)\r
264         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
265     {\r
266 \r
267         Marshaller.marshal(this, out);\r
268     } //-- void marshal(java.io.Writer)\r
269 \r
270     /**\r
271      * Method marshal\r
272      *\r
273      *\r
274      *\r
275      * @param handler\r
276      */\r
277     public void marshal(org.xml.sax.ContentHandler handler)\r
278         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
279     {\r
280 \r
281         Marshaller.marshal(this, handler);\r
282     } //-- void marshal(org.xml.sax.ContentHandler)\r
283 \r
284     /**\r
285      * Method removeAllAnnotationElement\r
286      *\r
287      */\r
288     public void removeAllAnnotationElement()\r
289     {\r
290         _annotationElementList.removeAllElements();\r
291     } //-- void removeAllAnnotationElement()\r
292 \r
293     /**\r
294      * Method removeAnnotationElement\r
295      *\r
296      *\r
297      *\r
298      * @param index\r
299      * @return AnnotationElement\r
300      */\r
301     public jalview.binding.AnnotationElement removeAnnotationElement(int index)\r
302     {\r
303         java.lang.Object obj = _annotationElementList.elementAt(index);\r
304         _annotationElementList.removeElementAt(index);\r
305         return (jalview.binding.AnnotationElement) obj;\r
306     } //-- jalview.binding.AnnotationElement removeAnnotationElement(int)\r
307 \r
308     /**\r
309      * Method setAnnotationElement\r
310      *\r
311      *\r
312      *\r
313      * @param index\r
314      * @param vAnnotationElement\r
315      */\r
316     public void setAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
317         throws java.lang.IndexOutOfBoundsException\r
318     {\r
319         //-- check bounds for index\r
320         if ((index < 0) || (index > _annotationElementList.size())) {\r
321             throw new IndexOutOfBoundsException();\r
322         }\r
323         _annotationElementList.setElementAt(vAnnotationElement, index);\r
324     } //-- void setAnnotationElement(int, jalview.binding.AnnotationElement)\r
325 \r
326     /**\r
327      * Method setAnnotationElement\r
328      *\r
329      *\r
330      *\r
331      * @param annotationElementArray\r
332      */\r
333     public void setAnnotationElement(jalview.binding.AnnotationElement[] annotationElementArray)\r
334     {\r
335         //-- copy array\r
336         _annotationElementList.removeAllElements();\r
337         for (int i = 0; i < annotationElementArray.length; i++) {\r
338             _annotationElementList.addElement(annotationElementArray[i]);\r
339         }\r
340     } //-- void setAnnotationElement(jalview.binding.AnnotationElement)\r
341 \r
342     /**\r
343      * Sets the value of field 'description'.\r
344      *\r
345      * @param description the value of field 'description'.\r
346      */\r
347     public void setDescription(java.lang.String description)\r
348     {\r
349         this._description = description;\r
350     } //-- void setDescription(java.lang.String)\r
351 \r
352     /**\r
353      * Sets the value of field 'graph'.\r
354      *\r
355      * @param graph the value of field 'graph'.\r
356      */\r
357     public void setGraph(boolean graph)\r
358     {\r
359         this._graph = graph;\r
360         this._has_graph = true;\r
361     } //-- void setGraph(boolean)\r
362 \r
363     /**\r
364      * Sets the value of field 'label'.\r
365      *\r
366      * @param label the value of field 'label'.\r
367      */\r
368     public void setLabel(java.lang.String label)\r
369     {\r
370         this._label = label;\r
371     } //-- void setLabel(java.lang.String)\r
372 \r
373     /**\r
374      * Method unmarshal\r
375      *\r
376      *\r
377      *\r
378      * @param reader\r
379      * @return Object\r
380      */\r
381     public static java.lang.Object unmarshal(java.io.Reader reader)\r
382         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
383     {\r
384         return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);\r
385     } //-- java.lang.Object unmarshal(java.io.Reader)\r
386 \r
387     /**\r
388      * Method validate\r
389      *\r
390      */\r
391     public void validate()\r
392         throws org.exolab.castor.xml.ValidationException\r
393     {\r
394         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
395         validator.validate(this);\r
396     } //-- void validate()\r
397 \r
398 }\r