108d3ad6a84706ae92b25ea22dff4c2de8ac669c
[jalview.git] / src / jalview / binding / Annotation.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package jalview.binding;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class Annotation.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class Annotation implements java.io.Serializable {
23
24
25       //--------------------------/
26      //- Class/Member Variables -/
27     //--------------------------/
28
29     /**
30      * Field _graph.
31      */
32     private boolean _graph;
33
34     /**
35      * keeps track of state for field: _graph
36      */
37     private boolean _has_graph;
38
39     /**
40      * Field _graphType.
41      */
42     private int _graphType;
43
44     /**
45      * keeps track of state for field: _graphType
46      */
47     private boolean _has_graphType;
48
49     /**
50      * Field _annotationElementList.
51      */
52     private java.util.Vector _annotationElementList;
53
54     /**
55      * Field _label.
56      */
57     private java.lang.String _label;
58
59     /**
60      * Field _description.
61      */
62     private java.lang.String _description;
63
64
65       //----------------/
66      //- Constructors -/
67     //----------------/
68
69     public Annotation() {
70         super();
71         this._annotationElementList = new java.util.Vector();
72     }
73
74
75       //-----------/
76      //- Methods -/
77     //-----------/
78
79     /**
80      * 
81      * 
82      * @param vAnnotationElement
83      * @throws java.lang.IndexOutOfBoundsException if the index
84      * given is outside the bounds of the collection
85      */
86     public void addAnnotationElement(
87             final jalview.binding.AnnotationElement vAnnotationElement)
88     throws java.lang.IndexOutOfBoundsException {
89         this._annotationElementList.addElement(vAnnotationElement);
90     }
91
92     /**
93      * 
94      * 
95      * @param index
96      * @param vAnnotationElement
97      * @throws java.lang.IndexOutOfBoundsException if the index
98      * given is outside the bounds of the collection
99      */
100     public void addAnnotationElement(
101             final int index,
102             final jalview.binding.AnnotationElement vAnnotationElement)
103     throws java.lang.IndexOutOfBoundsException {
104         this._annotationElementList.add(index, vAnnotationElement);
105     }
106
107     /**
108      */
109     public void deleteGraph(
110     ) {
111         this._has_graph= false;
112     }
113
114     /**
115      */
116     public void deleteGraphType(
117     ) {
118         this._has_graphType= false;
119     }
120
121     /**
122      * Method enumerateAnnotationElement.
123      * 
124      * @return an Enumeration over all
125      * jalview.binding.AnnotationElement elements
126      */
127     public java.util.Enumeration enumerateAnnotationElement(
128     ) {
129         return this._annotationElementList.elements();
130     }
131
132     /**
133      * Method getAnnotationElement.
134      * 
135      * @param index
136      * @throws java.lang.IndexOutOfBoundsException if the index
137      * given is outside the bounds of the collection
138      * @return the value of the jalview.binding.AnnotationElement
139      * at the given index
140      */
141     public jalview.binding.AnnotationElement getAnnotationElement(
142             final int index)
143     throws java.lang.IndexOutOfBoundsException {
144         // check bounds for index
145         if (index < 0 || index >= this._annotationElementList.size()) {
146             throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
147         }
148         
149         return (jalview.binding.AnnotationElement) _annotationElementList.get(index);
150     }
151
152     /**
153      * Method getAnnotationElement.Returns the contents of the
154      * collection in an Array.  <p>Note:  Just in case the
155      * collection contents are changing in another thread, we pass
156      * a 0-length Array of the correct type into the API call. 
157      * This way we <i>know</i> that the Array returned is of
158      * exactly the correct length.
159      * 
160      * @return this collection as an Array
161      */
162     public jalview.binding.AnnotationElement[] getAnnotationElement(
163     ) {
164         jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0];
165         return (jalview.binding.AnnotationElement[]) this._annotationElementList.toArray(array);
166     }
167
168     /**
169      * Method getAnnotationElementCount.
170      * 
171      * @return the size of this collection
172      */
173     public int getAnnotationElementCount(
174     ) {
175         return this._annotationElementList.size();
176     }
177
178     /**
179      * Returns the value of field 'description'.
180      * 
181      * @return the value of field 'Description'.
182      */
183     public java.lang.String getDescription(
184     ) {
185         return this._description;
186     }
187
188     /**
189      * Returns the value of field 'graph'.
190      * 
191      * @return the value of field 'Graph'.
192      */
193     public boolean getGraph(
194     ) {
195         return this._graph;
196     }
197
198     /**
199      * Returns the value of field 'graphType'.
200      * 
201      * @return the value of field 'GraphType'.
202      */
203     public int getGraphType(
204     ) {
205         return this._graphType;
206     }
207
208     /**
209      * Returns the value of field 'label'.
210      * 
211      * @return the value of field 'Label'.
212      */
213     public java.lang.String getLabel(
214     ) {
215         return this._label;
216     }
217
218     /**
219      * Method hasGraph.
220      * 
221      * @return true if at least one Graph has been added
222      */
223     public boolean hasGraph(
224     ) {
225         return this._has_graph;
226     }
227
228     /**
229      * Method hasGraphType.
230      * 
231      * @return true if at least one GraphType has been added
232      */
233     public boolean hasGraphType(
234     ) {
235         return this._has_graphType;
236     }
237
238     /**
239      * Returns the value of field 'graph'.
240      * 
241      * @return the value of field 'Graph'.
242      */
243     public boolean isGraph(
244     ) {
245         return this._graph;
246     }
247
248     /**
249      * Method isValid.
250      * 
251      * @return true if this object is valid according to the schema
252      */
253     public boolean isValid(
254     ) {
255         try {
256             validate();
257         } catch (org.exolab.castor.xml.ValidationException vex) {
258             return false;
259         }
260         return true;
261     }
262
263     /**
264      * 
265      * 
266      * @param out
267      * @throws org.exolab.castor.xml.MarshalException if object is
268      * null or if any SAXException is thrown during marshaling
269      * @throws org.exolab.castor.xml.ValidationException if this
270      * object is an invalid instance according to the schema
271      */
272     public void marshal(
273             final java.io.Writer out)
274     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
275         Marshaller.marshal(this, out);
276     }
277
278     /**
279      * 
280      * 
281      * @param handler
282      * @throws java.io.IOException if an IOException occurs during
283      * marshaling
284      * @throws org.exolab.castor.xml.ValidationException if this
285      * object is an invalid instance according to the schema
286      * @throws org.exolab.castor.xml.MarshalException if object is
287      * null or if any SAXException is thrown during marshaling
288      */
289     public void marshal(
290             final org.xml.sax.ContentHandler handler)
291     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
292         Marshaller.marshal(this, handler);
293     }
294
295     /**
296      */
297     public void removeAllAnnotationElement(
298     ) {
299         this._annotationElementList.clear();
300     }
301
302     /**
303      * Method removeAnnotationElement.
304      * 
305      * @param vAnnotationElement
306      * @return true if the object was removed from the collection.
307      */
308     public boolean removeAnnotationElement(
309             final jalview.binding.AnnotationElement vAnnotationElement) {
310         boolean removed = _annotationElementList.remove(vAnnotationElement);
311         return removed;
312     }
313
314     /**
315      * Method removeAnnotationElementAt.
316      * 
317      * @param index
318      * @return the element removed from the collection
319      */
320     public jalview.binding.AnnotationElement removeAnnotationElementAt(
321             final int index) {
322         java.lang.Object obj = this._annotationElementList.remove(index);
323         return (jalview.binding.AnnotationElement) obj;
324     }
325
326     /**
327      * 
328      * 
329      * @param index
330      * @param vAnnotationElement
331      * @throws java.lang.IndexOutOfBoundsException if the index
332      * given is outside the bounds of the collection
333      */
334     public void setAnnotationElement(
335             final int index,
336             final jalview.binding.AnnotationElement vAnnotationElement)
337     throws java.lang.IndexOutOfBoundsException {
338         // check bounds for index
339         if (index < 0 || index >= this._annotationElementList.size()) {
340             throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
341         }
342         
343         this._annotationElementList.set(index, vAnnotationElement);
344     }
345
346     /**
347      * 
348      * 
349      * @param vAnnotationElementArray
350      */
351     public void setAnnotationElement(
352             final jalview.binding.AnnotationElement[] vAnnotationElementArray) {
353         //-- copy array
354         _annotationElementList.clear();
355         
356         for (int i = 0; i < vAnnotationElementArray.length; i++) {
357                 this._annotationElementList.add(vAnnotationElementArray[i]);
358         }
359     }
360
361     /**
362      * Sets the value of field 'description'.
363      * 
364      * @param description the value of field 'description'.
365      */
366     public void setDescription(
367             final java.lang.String description) {
368         this._description = description;
369     }
370
371     /**
372      * Sets the value of field 'graph'.
373      * 
374      * @param graph the value of field 'graph'.
375      */
376     public void setGraph(
377             final boolean graph) {
378         this._graph = graph;
379         this._has_graph = true;
380     }
381
382     /**
383      * Sets the value of field 'graphType'.
384      * 
385      * @param graphType the value of field 'graphType'.
386      */
387     public void setGraphType(
388             final int graphType) {
389         this._graphType = graphType;
390         this._has_graphType = true;
391     }
392
393     /**
394      * Sets the value of field 'label'.
395      * 
396      * @param label the value of field 'label'.
397      */
398     public void setLabel(
399             final java.lang.String label) {
400         this._label = label;
401     }
402
403     /**
404      * Method unmarshal.
405      * 
406      * @param reader
407      * @throws org.exolab.castor.xml.MarshalException if object is
408      * null or if any SAXException is thrown during marshaling
409      * @throws org.exolab.castor.xml.ValidationException if this
410      * object is an invalid instance according to the schema
411      * @return the unmarshaled jalview.binding.Annotation
412      */
413     public static jalview.binding.Annotation unmarshal(
414             final java.io.Reader reader)
415     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
416         return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);
417     }
418
419     /**
420      * 
421      * 
422      * @throws org.exolab.castor.xml.ValidationException if this
423      * object is an invalid instance according to the schema
424      */
425     public void validate(
426     )
427     throws org.exolab.castor.xml.ValidationException {
428         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
429         validator.validate(this);
430     }
431
432 }