modified castor-1.1 library and refactored uk.ac.vamsas
[jalview.git] / src / jalview / schemabinding / version2 / SequenceSet.java
1 /*\r
2  * This class was automatically generated with \r
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 \r
8 package jalview.schemabinding.version2;\r
9 \r
10   //---------------------------------/\r
11  //- Imported classes and packages -/\r
12 //---------------------------------/\r
13 \r
14 import org.exolab.castor.xml.Marshaller;\r
15 import org.exolab.castor.xml.Unmarshaller;\r
16 \r
17 /**\r
18  * Class SequenceSet.\r
19  * \r
20  * @version $Revision$ $Date$\r
21  */\r
22 public class SequenceSet implements java.io.Serializable {\r
23 \r
24 \r
25       //--------------------------/\r
26      //- Class/Member Variables -/\r
27     //--------------------------/\r
28 \r
29     /**\r
30      * Field _gapChar.\r
31      */\r
32     private java.lang.String _gapChar;\r
33 \r
34     /**\r
35      * Field _sequenceList.\r
36      */\r
37     private java.util.Vector _sequenceList;\r
38 \r
39     /**\r
40      * Field _annotationList.\r
41      */\r
42     private java.util.Vector _annotationList;\r
43 \r
44     /**\r
45      * Field _sequenceSetPropertiesList.\r
46      */\r
47     private java.util.Vector _sequenceSetPropertiesList;\r
48 \r
49 \r
50       //----------------/\r
51      //- Constructors -/\r
52     //----------------/\r
53 \r
54     public SequenceSet() {\r
55         super();\r
56         this._sequenceList = new java.util.Vector();\r
57         this._annotationList = new java.util.Vector();\r
58         this._sequenceSetPropertiesList = new java.util.Vector();\r
59     }\r
60 \r
61 \r
62       //-----------/\r
63      //- Methods -/\r
64     //-----------/\r
65 \r
66     /**\r
67      * \r
68      * \r
69      * @param vAnnotation\r
70      * @throws java.lang.IndexOutOfBoundsException if the index\r
71      * given is outside the bounds of the collection\r
72      */\r
73     public void addAnnotation(\r
74             final jalview.schemabinding.version2.Annotation vAnnotation)\r
75     throws java.lang.IndexOutOfBoundsException {\r
76         this._annotationList.addElement(vAnnotation);\r
77     }\r
78 \r
79     /**\r
80      * \r
81      * \r
82      * @param index\r
83      * @param vAnnotation\r
84      * @throws java.lang.IndexOutOfBoundsException if the index\r
85      * given is outside the bounds of the collection\r
86      */\r
87     public void addAnnotation(\r
88             final int index,\r
89             final jalview.schemabinding.version2.Annotation vAnnotation)\r
90     throws java.lang.IndexOutOfBoundsException {\r
91         this._annotationList.add(index, vAnnotation);\r
92     }\r
93 \r
94     /**\r
95      * \r
96      * \r
97      * @param vSequence\r
98      * @throws java.lang.IndexOutOfBoundsException if the index\r
99      * given is outside the bounds of the collection\r
100      */\r
101     public void addSequence(\r
102             final jalview.schemabinding.version2.Sequence vSequence)\r
103     throws java.lang.IndexOutOfBoundsException {\r
104         this._sequenceList.addElement(vSequence);\r
105     }\r
106 \r
107     /**\r
108      * \r
109      * \r
110      * @param index\r
111      * @param vSequence\r
112      * @throws java.lang.IndexOutOfBoundsException if the index\r
113      * given is outside the bounds of the collection\r
114      */\r
115     public void addSequence(\r
116             final int index,\r
117             final jalview.schemabinding.version2.Sequence vSequence)\r
118     throws java.lang.IndexOutOfBoundsException {\r
119         this._sequenceList.add(index, vSequence);\r
120     }\r
121 \r
122     /**\r
123      * \r
124      * \r
125      * @param vSequenceSetProperties\r
126      * @throws java.lang.IndexOutOfBoundsException if the index\r
127      * given is outside the bounds of the collection\r
128      */\r
129     public void addSequenceSetProperties(\r
130             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)\r
131     throws java.lang.IndexOutOfBoundsException {\r
132         this._sequenceSetPropertiesList.addElement(vSequenceSetProperties);\r
133     }\r
134 \r
135     /**\r
136      * \r
137      * \r
138      * @param index\r
139      * @param vSequenceSetProperties\r
140      * @throws java.lang.IndexOutOfBoundsException if the index\r
141      * given is outside the bounds of the collection\r
142      */\r
143     public void addSequenceSetProperties(\r
144             final int index,\r
145             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)\r
146     throws java.lang.IndexOutOfBoundsException {\r
147         this._sequenceSetPropertiesList.add(index, vSequenceSetProperties);\r
148     }\r
149 \r
150     /**\r
151      * Method enumerateAnnotation.\r
152      * \r
153      * @return an Enumeration over all\r
154      * jalview.schemabinding.version2.Annotation elements\r
155      */\r
156     public java.util.Enumeration enumerateAnnotation(\r
157     ) {\r
158         return this._annotationList.elements();\r
159     }\r
160 \r
161     /**\r
162      * Method enumerateSequence.\r
163      * \r
164      * @return an Enumeration over all\r
165      * jalview.schemabinding.version2.Sequence elements\r
166      */\r
167     public java.util.Enumeration enumerateSequence(\r
168     ) {\r
169         return this._sequenceList.elements();\r
170     }\r
171 \r
172     /**\r
173      * Method enumerateSequenceSetProperties.\r
174      * \r
175      * @return an Enumeration over all\r
176      * jalview.schemabinding.version2.SequenceSetProperties elements\r
177      */\r
178     public java.util.Enumeration enumerateSequenceSetProperties(\r
179     ) {\r
180         return this._sequenceSetPropertiesList.elements();\r
181     }\r
182 \r
183     /**\r
184      * Method getAnnotation.\r
185      * \r
186      * @param index\r
187      * @throws java.lang.IndexOutOfBoundsException if the index\r
188      * given is outside the bounds of the collection\r
189      * @return the value of the\r
190      * jalview.schemabinding.version2.Annotation at the given index\r
191      */\r
192     public jalview.schemabinding.version2.Annotation getAnnotation(\r
193             final int index)\r
194     throws java.lang.IndexOutOfBoundsException {\r
195         // check bounds for index\r
196         if (index < 0 || index >= this._annotationList.size()) {\r
197             throw new IndexOutOfBoundsException("getAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");\r
198         }\r
199         \r
200         return (jalview.schemabinding.version2.Annotation) _annotationList.get(index);\r
201     }\r
202 \r
203     /**\r
204      * Method getAnnotation.Returns the contents of the collection\r
205      * in an Array.  <p>Note:  Just in case the collection contents\r
206      * are changing in another thread, we pass a 0-length Array of\r
207      * the correct type into the API call.  This way we <i>know</i>\r
208      * that the Array returned is of exactly the correct length.\r
209      * \r
210      * @return this collection as an Array\r
211      */\r
212     public jalview.schemabinding.version2.Annotation[] getAnnotation(\r
213     ) {\r
214         jalview.schemabinding.version2.Annotation[] array = new jalview.schemabinding.version2.Annotation[0];\r
215         return (jalview.schemabinding.version2.Annotation[]) this._annotationList.toArray(array);\r
216     }\r
217 \r
218     /**\r
219      * Method getAnnotationCount.\r
220      * \r
221      * @return the size of this collection\r
222      */\r
223     public int getAnnotationCount(\r
224     ) {\r
225         return this._annotationList.size();\r
226     }\r
227 \r
228     /**\r
229      * Returns the value of field 'gapChar'.\r
230      * \r
231      * @return the value of field 'GapChar'.\r
232      */\r
233     public java.lang.String getGapChar(\r
234     ) {\r
235         return this._gapChar;\r
236     }\r
237 \r
238     /**\r
239      * Method getSequence.\r
240      * \r
241      * @param index\r
242      * @throws java.lang.IndexOutOfBoundsException if the index\r
243      * given is outside the bounds of the collection\r
244      * @return the value of the\r
245      * jalview.schemabinding.version2.Sequence at the given index\r
246      */\r
247     public jalview.schemabinding.version2.Sequence getSequence(\r
248             final int index)\r
249     throws java.lang.IndexOutOfBoundsException {\r
250         // check bounds for index\r
251         if (index < 0 || index >= this._sequenceList.size()) {\r
252             throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");\r
253         }\r
254         \r
255         return (jalview.schemabinding.version2.Sequence) _sequenceList.get(index);\r
256     }\r
257 \r
258     /**\r
259      * Method getSequence.Returns the contents of the collection in\r
260      * an Array.  <p>Note:  Just in case the collection contents\r
261      * are changing in another thread, we pass a 0-length Array of\r
262      * the correct type into the API call.  This way we <i>know</i>\r
263      * that the Array returned is of exactly the correct length.\r
264      * \r
265      * @return this collection as an Array\r
266      */\r
267     public jalview.schemabinding.version2.Sequence[] getSequence(\r
268     ) {\r
269         jalview.schemabinding.version2.Sequence[] array = new jalview.schemabinding.version2.Sequence[0];\r
270         return (jalview.schemabinding.version2.Sequence[]) this._sequenceList.toArray(array);\r
271     }\r
272 \r
273     /**\r
274      * Method getSequenceCount.\r
275      * \r
276      * @return the size of this collection\r
277      */\r
278     public int getSequenceCount(\r
279     ) {\r
280         return this._sequenceList.size();\r
281     }\r
282 \r
283     /**\r
284      * Method getSequenceSetProperties.\r
285      * \r
286      * @param index\r
287      * @throws java.lang.IndexOutOfBoundsException if the index\r
288      * given is outside the bounds of the collection\r
289      * @return the value of the\r
290      * jalview.schemabinding.version2.SequenceSetProperties at the\r
291      * given index\r
292      */\r
293     public jalview.schemabinding.version2.SequenceSetProperties getSequenceSetProperties(\r
294             final int index)\r
295     throws java.lang.IndexOutOfBoundsException {\r
296         // check bounds for index\r
297         if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {\r
298             throw new IndexOutOfBoundsException("getSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");\r
299         }\r
300         \r
301         return (jalview.schemabinding.version2.SequenceSetProperties) _sequenceSetPropertiesList.get(index);\r
302     }\r
303 \r
304     /**\r
305      * Method getSequenceSetProperties.Returns the contents of the\r
306      * collection in an Array.  <p>Note:  Just in case the\r
307      * collection contents are changing in another thread, we pass\r
308      * a 0-length Array of the correct type into the API call. \r
309      * This way we <i>know</i> that the Array returned is of\r
310      * exactly the correct length.\r
311      * \r
312      * @return this collection as an Array\r
313      */\r
314     public jalview.schemabinding.version2.SequenceSetProperties[] getSequenceSetProperties(\r
315     ) {\r
316         jalview.schemabinding.version2.SequenceSetProperties[] array = new jalview.schemabinding.version2.SequenceSetProperties[0];\r
317         return (jalview.schemabinding.version2.SequenceSetProperties[]) this._sequenceSetPropertiesList.toArray(array);\r
318     }\r
319 \r
320     /**\r
321      * Method getSequenceSetPropertiesCount.\r
322      * \r
323      * @return the size of this collection\r
324      */\r
325     public int getSequenceSetPropertiesCount(\r
326     ) {\r
327         return this._sequenceSetPropertiesList.size();\r
328     }\r
329 \r
330     /**\r
331      * Method isValid.\r
332      * \r
333      * @return true if this object is valid according to the schema\r
334      */\r
335     public boolean isValid(\r
336     ) {\r
337         try {\r
338             validate();\r
339         } catch (org.exolab.castor.xml.ValidationException vex) {\r
340             return false;\r
341         }\r
342         return true;\r
343     }\r
344 \r
345     /**\r
346      * \r
347      * \r
348      * @param out\r
349      * @throws org.exolab.castor.xml.MarshalException if object is\r
350      * null or if any SAXException is thrown during marshaling\r
351      * @throws org.exolab.castor.xml.ValidationException if this\r
352      * object is an invalid instance according to the schema\r
353      */\r
354     public void marshal(\r
355             final java.io.Writer out)\r
356     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
357         Marshaller.marshal(this, out);\r
358     }\r
359 \r
360     /**\r
361      * \r
362      * \r
363      * @param handler\r
364      * @throws java.io.IOException if an IOException occurs during\r
365      * marshaling\r
366      * @throws org.exolab.castor.xml.ValidationException if this\r
367      * object is an invalid instance according to the schema\r
368      * @throws org.exolab.castor.xml.MarshalException if object is\r
369      * null or if any SAXException is thrown during marshaling\r
370      */\r
371     public void marshal(\r
372             final org.xml.sax.ContentHandler handler)\r
373     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
374         Marshaller.marshal(this, handler);\r
375     }\r
376 \r
377     /**\r
378      */\r
379     public void removeAllAnnotation(\r
380     ) {\r
381         this._annotationList.clear();\r
382     }\r
383 \r
384     /**\r
385      */\r
386     public void removeAllSequence(\r
387     ) {\r
388         this._sequenceList.clear();\r
389     }\r
390 \r
391     /**\r
392      */\r
393     public void removeAllSequenceSetProperties(\r
394     ) {\r
395         this._sequenceSetPropertiesList.clear();\r
396     }\r
397 \r
398     /**\r
399      * Method removeAnnotation.\r
400      * \r
401      * @param vAnnotation\r
402      * @return true if the object was removed from the collection.\r
403      */\r
404     public boolean removeAnnotation(\r
405             final jalview.schemabinding.version2.Annotation vAnnotation) {\r
406         boolean removed = _annotationList.remove(vAnnotation);\r
407         return removed;\r
408     }\r
409 \r
410     /**\r
411      * Method removeAnnotationAt.\r
412      * \r
413      * @param index\r
414      * @return the element removed from the collection\r
415      */\r
416     public jalview.schemabinding.version2.Annotation removeAnnotationAt(\r
417             final int index) {\r
418         java.lang.Object obj = this._annotationList.remove(index);\r
419         return (jalview.schemabinding.version2.Annotation) obj;\r
420     }\r
421 \r
422     /**\r
423      * Method removeSequence.\r
424      * \r
425      * @param vSequence\r
426      * @return true if the object was removed from the collection.\r
427      */\r
428     public boolean removeSequence(\r
429             final jalview.schemabinding.version2.Sequence vSequence) {\r
430         boolean removed = _sequenceList.remove(vSequence);\r
431         return removed;\r
432     }\r
433 \r
434     /**\r
435      * Method removeSequenceAt.\r
436      * \r
437      * @param index\r
438      * @return the element removed from the collection\r
439      */\r
440     public jalview.schemabinding.version2.Sequence removeSequenceAt(\r
441             final int index) {\r
442         java.lang.Object obj = this._sequenceList.remove(index);\r
443         return (jalview.schemabinding.version2.Sequence) obj;\r
444     }\r
445 \r
446     /**\r
447      * Method removeSequenceSetProperties.\r
448      * \r
449      * @param vSequenceSetProperties\r
450      * @return true if the object was removed from the collection.\r
451      */\r
452     public boolean removeSequenceSetProperties(\r
453             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties) {\r
454         boolean removed = _sequenceSetPropertiesList.remove(vSequenceSetProperties);\r
455         return removed;\r
456     }\r
457 \r
458     /**\r
459      * Method removeSequenceSetPropertiesAt.\r
460      * \r
461      * @param index\r
462      * @return the element removed from the collection\r
463      */\r
464     public jalview.schemabinding.version2.SequenceSetProperties removeSequenceSetPropertiesAt(\r
465             final int index) {\r
466         java.lang.Object obj = this._sequenceSetPropertiesList.remove(index);\r
467         return (jalview.schemabinding.version2.SequenceSetProperties) obj;\r
468     }\r
469 \r
470     /**\r
471      * \r
472      * \r
473      * @param index\r
474      * @param vAnnotation\r
475      * @throws java.lang.IndexOutOfBoundsException if the index\r
476      * given is outside the bounds of the collection\r
477      */\r
478     public void setAnnotation(\r
479             final int index,\r
480             final jalview.schemabinding.version2.Annotation vAnnotation)\r
481     throws java.lang.IndexOutOfBoundsException {\r
482         // check bounds for index\r
483         if (index < 0 || index >= this._annotationList.size()) {\r
484             throw new IndexOutOfBoundsException("setAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");\r
485         }\r
486         \r
487         this._annotationList.set(index, vAnnotation);\r
488     }\r
489 \r
490     /**\r
491      * \r
492      * \r
493      * @param vAnnotationArray\r
494      */\r
495     public void setAnnotation(\r
496             final jalview.schemabinding.version2.Annotation[] vAnnotationArray) {\r
497         //-- copy array\r
498         _annotationList.clear();\r
499         \r
500         for (int i = 0; i < vAnnotationArray.length; i++) {\r
501                 this._annotationList.add(vAnnotationArray[i]);\r
502         }\r
503     }\r
504 \r
505     /**\r
506      * Sets the value of field 'gapChar'.\r
507      * \r
508      * @param gapChar the value of field 'gapChar'.\r
509      */\r
510     public void setGapChar(\r
511             final java.lang.String gapChar) {\r
512         this._gapChar = gapChar;\r
513     }\r
514 \r
515     /**\r
516      * \r
517      * \r
518      * @param index\r
519      * @param vSequence\r
520      * @throws java.lang.IndexOutOfBoundsException if the index\r
521      * given is outside the bounds of the collection\r
522      */\r
523     public void setSequence(\r
524             final int index,\r
525             final jalview.schemabinding.version2.Sequence vSequence)\r
526     throws java.lang.IndexOutOfBoundsException {\r
527         // check bounds for index\r
528         if (index < 0 || index >= this._sequenceList.size()) {\r
529             throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");\r
530         }\r
531         \r
532         this._sequenceList.set(index, vSequence);\r
533     }\r
534 \r
535     /**\r
536      * \r
537      * \r
538      * @param vSequenceArray\r
539      */\r
540     public void setSequence(\r
541             final jalview.schemabinding.version2.Sequence[] vSequenceArray) {\r
542         //-- copy array\r
543         _sequenceList.clear();\r
544         \r
545         for (int i = 0; i < vSequenceArray.length; i++) {\r
546                 this._sequenceList.add(vSequenceArray[i]);\r
547         }\r
548     }\r
549 \r
550     /**\r
551      * \r
552      * \r
553      * @param index\r
554      * @param vSequenceSetProperties\r
555      * @throws java.lang.IndexOutOfBoundsException if the index\r
556      * given is outside the bounds of the collection\r
557      */\r
558     public void setSequenceSetProperties(\r
559             final int index,\r
560             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)\r
561     throws java.lang.IndexOutOfBoundsException {\r
562         // check bounds for index\r
563         if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {\r
564             throw new IndexOutOfBoundsException("setSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");\r
565         }\r
566         \r
567         this._sequenceSetPropertiesList.set(index, vSequenceSetProperties);\r
568     }\r
569 \r
570     /**\r
571      * \r
572      * \r
573      * @param vSequenceSetPropertiesArray\r
574      */\r
575     public void setSequenceSetProperties(\r
576             final jalview.schemabinding.version2.SequenceSetProperties[] vSequenceSetPropertiesArray) {\r
577         //-- copy array\r
578         _sequenceSetPropertiesList.clear();\r
579         \r
580         for (int i = 0; i < vSequenceSetPropertiesArray.length; i++) {\r
581                 this._sequenceSetPropertiesList.add(vSequenceSetPropertiesArray[i]);\r
582         }\r
583     }\r
584 \r
585     /**\r
586      * Method unmarshal.\r
587      * \r
588      * @param reader\r
589      * @throws org.exolab.castor.xml.MarshalException if object is\r
590      * null or if any SAXException is thrown during marshaling\r
591      * @throws org.exolab.castor.xml.ValidationException if this\r
592      * object is an invalid instance according to the schema\r
593      * @return the unmarshaled\r
594      * jalview.schemabinding.version2.SequenceSet\r
595      */\r
596     public static jalview.schemabinding.version2.SequenceSet unmarshal(\r
597             final java.io.Reader reader)\r
598     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
599         return (jalview.schemabinding.version2.SequenceSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceSet.class, reader);\r
600     }\r
601 \r
602     /**\r
603      * \r
604      * \r
605      * @throws org.exolab.castor.xml.ValidationException if this\r
606      * object is an invalid instance according to the schema\r
607      */\r
608     public void validate(\r
609     )\r
610     throws org.exolab.castor.xml.ValidationException {\r
611         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
612         validator.validate(this);\r
613     }\r
614 \r
615 }\r