apply gpl development license
[jalview.git] / src / jalview / schemabinding / version2 / SequenceSet.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
3  * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4  * \r
5  * This program is free software; you can redistribute it and/or\r
6  * modify it under the terms of the GNU General Public License\r
7  * as published by the Free Software Foundation; either version 2\r
8  * of the License, or (at your option) any later version.\r
9  * \r
10  * This program is distributed in the hope that it will be useful,\r
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
13  * GNU General Public License for more details.\r
14  * \r
15  * You should have received a copy of the GNU General Public License\r
16  * along with this program; if not, write to the Free Software\r
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
18  */\r
19 package jalview.schemabinding.version2;\r
20 \r
21   //---------------------------------/\r
22  //- Imported classes and packages -/\r
23 //---------------------------------/\r
24 \r
25 import org.exolab.castor.xml.Marshaller;\r
26 import org.exolab.castor.xml.Unmarshaller;\r
27 \r
28 /**\r
29  * Class SequenceSet.\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class SequenceSet implements java.io.Serializable {\r
34 \r
35 \r
36       //--------------------------/\r
37      //- Class/Member Variables -/\r
38     //--------------------------/\r
39 \r
40     /**\r
41      * Field _gapChar.\r
42      */\r
43     private java.lang.String _gapChar;\r
44 \r
45     /**\r
46      * reference to set where jalview will gather the dataset\r
47      * sequences for all sequences in the set. \r
48      *  \r
49      */\r
50     private java.lang.String _datasetId;\r
51 \r
52     /**\r
53      * Field _sequenceList.\r
54      */\r
55     private java.util.Vector _sequenceList;\r
56 \r
57     /**\r
58      * Field _annotationList.\r
59      */\r
60     private java.util.Vector _annotationList;\r
61 \r
62     /**\r
63      * Field _sequenceSetPropertiesList.\r
64      */\r
65     private java.util.Vector _sequenceSetPropertiesList;\r
66 \r
67     /**\r
68      * Field _alcodonFrameList.\r
69      */\r
70     private java.util.Vector _alcodonFrameList;\r
71 \r
72 \r
73       //----------------/\r
74      //- Constructors -/\r
75     //----------------/\r
76 \r
77     public SequenceSet() {\r
78         super();\r
79         this._sequenceList = new java.util.Vector();\r
80         this._annotationList = new java.util.Vector();\r
81         this._sequenceSetPropertiesList = new java.util.Vector();\r
82         this._alcodonFrameList = new java.util.Vector();\r
83     }\r
84 \r
85 \r
86       //-----------/\r
87      //- Methods -/\r
88     //-----------/\r
89 \r
90     /**\r
91      * \r
92      * \r
93      * @param vAlcodonFrame\r
94      * @throws java.lang.IndexOutOfBoundsException if the index\r
95      * given is outside the bounds of the collection\r
96      */\r
97     public void addAlcodonFrame(\r
98             final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)\r
99     throws java.lang.IndexOutOfBoundsException {\r
100         this._alcodonFrameList.addElement(vAlcodonFrame);\r
101     }\r
102 \r
103     /**\r
104      * \r
105      * \r
106      * @param index\r
107      * @param vAlcodonFrame\r
108      * @throws java.lang.IndexOutOfBoundsException if the index\r
109      * given is outside the bounds of the collection\r
110      */\r
111     public void addAlcodonFrame(\r
112             final int index,\r
113             final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)\r
114     throws java.lang.IndexOutOfBoundsException {\r
115         this._alcodonFrameList.add(index, vAlcodonFrame);\r
116     }\r
117 \r
118     /**\r
119      * \r
120      * \r
121      * @param vAnnotation\r
122      * @throws java.lang.IndexOutOfBoundsException if the index\r
123      * given is outside the bounds of the collection\r
124      */\r
125     public void addAnnotation(\r
126             final jalview.schemabinding.version2.Annotation vAnnotation)\r
127     throws java.lang.IndexOutOfBoundsException {\r
128         this._annotationList.addElement(vAnnotation);\r
129     }\r
130 \r
131     /**\r
132      * \r
133      * \r
134      * @param index\r
135      * @param vAnnotation\r
136      * @throws java.lang.IndexOutOfBoundsException if the index\r
137      * given is outside the bounds of the collection\r
138      */\r
139     public void addAnnotation(\r
140             final int index,\r
141             final jalview.schemabinding.version2.Annotation vAnnotation)\r
142     throws java.lang.IndexOutOfBoundsException {\r
143         this._annotationList.add(index, vAnnotation);\r
144     }\r
145 \r
146     /**\r
147      * \r
148      * \r
149      * @param vSequence\r
150      * @throws java.lang.IndexOutOfBoundsException if the index\r
151      * given is outside the bounds of the collection\r
152      */\r
153     public void addSequence(\r
154             final jalview.schemabinding.version2.Sequence vSequence)\r
155     throws java.lang.IndexOutOfBoundsException {\r
156         this._sequenceList.addElement(vSequence);\r
157     }\r
158 \r
159     /**\r
160      * \r
161      * \r
162      * @param index\r
163      * @param vSequence\r
164      * @throws java.lang.IndexOutOfBoundsException if the index\r
165      * given is outside the bounds of the collection\r
166      */\r
167     public void addSequence(\r
168             final int index,\r
169             final jalview.schemabinding.version2.Sequence vSequence)\r
170     throws java.lang.IndexOutOfBoundsException {\r
171         this._sequenceList.add(index, vSequence);\r
172     }\r
173 \r
174     /**\r
175      * \r
176      * \r
177      * @param vSequenceSetProperties\r
178      * @throws java.lang.IndexOutOfBoundsException if the index\r
179      * given is outside the bounds of the collection\r
180      */\r
181     public void addSequenceSetProperties(\r
182             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)\r
183     throws java.lang.IndexOutOfBoundsException {\r
184         this._sequenceSetPropertiesList.addElement(vSequenceSetProperties);\r
185     }\r
186 \r
187     /**\r
188      * \r
189      * \r
190      * @param index\r
191      * @param vSequenceSetProperties\r
192      * @throws java.lang.IndexOutOfBoundsException if the index\r
193      * given is outside the bounds of the collection\r
194      */\r
195     public void addSequenceSetProperties(\r
196             final int index,\r
197             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)\r
198     throws java.lang.IndexOutOfBoundsException {\r
199         this._sequenceSetPropertiesList.add(index, vSequenceSetProperties);\r
200     }\r
201 \r
202     /**\r
203      * Method enumerateAlcodonFrame.\r
204      * \r
205      * @return an Enumeration over all\r
206      * jalview.schemabinding.version2.AlcodonFrame elements\r
207      */\r
208     public java.util.Enumeration enumerateAlcodonFrame(\r
209     ) {\r
210         return this._alcodonFrameList.elements();\r
211     }\r
212 \r
213     /**\r
214      * Method enumerateAnnotation.\r
215      * \r
216      * @return an Enumeration over all\r
217      * jalview.schemabinding.version2.Annotation elements\r
218      */\r
219     public java.util.Enumeration enumerateAnnotation(\r
220     ) {\r
221         return this._annotationList.elements();\r
222     }\r
223 \r
224     /**\r
225      * Method enumerateSequence.\r
226      * \r
227      * @return an Enumeration over all\r
228      * jalview.schemabinding.version2.Sequence elements\r
229      */\r
230     public java.util.Enumeration enumerateSequence(\r
231     ) {\r
232         return this._sequenceList.elements();\r
233     }\r
234 \r
235     /**\r
236      * Method enumerateSequenceSetProperties.\r
237      * \r
238      * @return an Enumeration over all\r
239      * jalview.schemabinding.version2.SequenceSetProperties elements\r
240      */\r
241     public java.util.Enumeration enumerateSequenceSetProperties(\r
242     ) {\r
243         return this._sequenceSetPropertiesList.elements();\r
244     }\r
245 \r
246     /**\r
247      * Method getAlcodonFrame.\r
248      * \r
249      * @param index\r
250      * @throws java.lang.IndexOutOfBoundsException if the index\r
251      * given is outside the bounds of the collection\r
252      * @return the value of the\r
253      * jalview.schemabinding.version2.AlcodonFrame at the given inde\r
254      */\r
255     public jalview.schemabinding.version2.AlcodonFrame getAlcodonFrame(\r
256             final int index)\r
257     throws java.lang.IndexOutOfBoundsException {\r
258         // check bounds for index\r
259         if (index < 0 || index >= this._alcodonFrameList.size()) {\r
260             throw new IndexOutOfBoundsException("getAlcodonFrame: Index value '" + index + "' not in range [0.." + (this._alcodonFrameList.size() - 1) + "]");\r
261         }\r
262         \r
263         return (jalview.schemabinding.version2.AlcodonFrame) _alcodonFrameList.get(index);\r
264     }\r
265 \r
266     /**\r
267      * Method getAlcodonFrame.Returns the contents of the\r
268      * collection in an Array.  <p>Note:  Just in case the\r
269      * collection contents are changing in another thread, we pass\r
270      * a 0-length Array of the correct type into the API call. \r
271      * This way we <i>know</i> that the Array returned is of\r
272      * exactly the correct length.\r
273      * \r
274      * @return this collection as an Array\r
275      */\r
276     public jalview.schemabinding.version2.AlcodonFrame[] getAlcodonFrame(\r
277     ) {\r
278         jalview.schemabinding.version2.AlcodonFrame[] array = new jalview.schemabinding.version2.AlcodonFrame[0];\r
279         return (jalview.schemabinding.version2.AlcodonFrame[]) this._alcodonFrameList.toArray(array);\r
280     }\r
281 \r
282     /**\r
283      * Method getAlcodonFrameCount.\r
284      * \r
285      * @return the size of this collection\r
286      */\r
287     public int getAlcodonFrameCount(\r
288     ) {\r
289         return this._alcodonFrameList.size();\r
290     }\r
291 \r
292     /**\r
293      * Method getAnnotation.\r
294      * \r
295      * @param index\r
296      * @throws java.lang.IndexOutOfBoundsException if the index\r
297      * given is outside the bounds of the collection\r
298      * @return the value of the\r
299      * jalview.schemabinding.version2.Annotation at the given index\r
300      */\r
301     public jalview.schemabinding.version2.Annotation getAnnotation(\r
302             final int index)\r
303     throws java.lang.IndexOutOfBoundsException {\r
304         // check bounds for index\r
305         if (index < 0 || index >= this._annotationList.size()) {\r
306             throw new IndexOutOfBoundsException("getAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");\r
307         }\r
308         \r
309         return (jalview.schemabinding.version2.Annotation) _annotationList.get(index);\r
310     }\r
311 \r
312     /**\r
313      * Method getAnnotation.Returns the contents of the collection\r
314      * in an Array.  <p>Note:  Just in case the collection contents\r
315      * are changing in another thread, we pass a 0-length Array of\r
316      * the correct type into the API call.  This way we <i>know</i>\r
317      * that the Array returned is of exactly the correct length.\r
318      * \r
319      * @return this collection as an Array\r
320      */\r
321     public jalview.schemabinding.version2.Annotation[] getAnnotation(\r
322     ) {\r
323         jalview.schemabinding.version2.Annotation[] array = new jalview.schemabinding.version2.Annotation[0];\r
324         return (jalview.schemabinding.version2.Annotation[]) this._annotationList.toArray(array);\r
325     }\r
326 \r
327     /**\r
328      * Method getAnnotationCount.\r
329      * \r
330      * @return the size of this collection\r
331      */\r
332     public int getAnnotationCount(\r
333     ) {\r
334         return this._annotationList.size();\r
335     }\r
336 \r
337     /**\r
338      * Returns the value of field 'datasetId'. The field\r
339      * 'datasetId' has the following description: reference to set\r
340      * where jalview will gather the dataset sequences for all\r
341      * sequences in the set. \r
342      *  \r
343      * \r
344      * @return the value of field 'DatasetId'.\r
345      */\r
346     public java.lang.String getDatasetId(\r
347     ) {\r
348         return this._datasetId;\r
349     }\r
350 \r
351     /**\r
352      * Returns the value of field 'gapChar'.\r
353      * \r
354      * @return the value of field 'GapChar'.\r
355      */\r
356     public java.lang.String getGapChar(\r
357     ) {\r
358         return this._gapChar;\r
359     }\r
360 \r
361     /**\r
362      * Method getSequence.\r
363      * \r
364      * @param index\r
365      * @throws java.lang.IndexOutOfBoundsException if the index\r
366      * given is outside the bounds of the collection\r
367      * @return the value of the\r
368      * jalview.schemabinding.version2.Sequence at the given index\r
369      */\r
370     public jalview.schemabinding.version2.Sequence getSequence(\r
371             final int index)\r
372     throws java.lang.IndexOutOfBoundsException {\r
373         // check bounds for index\r
374         if (index < 0 || index >= this._sequenceList.size()) {\r
375             throw new IndexOutOfBoundsException("getSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");\r
376         }\r
377         \r
378         return (jalview.schemabinding.version2.Sequence) _sequenceList.get(index);\r
379     }\r
380 \r
381     /**\r
382      * Method getSequence.Returns the contents of the collection in\r
383      * an Array.  <p>Note:  Just in case the collection contents\r
384      * are changing in another thread, we pass a 0-length Array of\r
385      * the correct type into the API call.  This way we <i>know</i>\r
386      * that the Array returned is of exactly the correct length.\r
387      * \r
388      * @return this collection as an Array\r
389      */\r
390     public jalview.schemabinding.version2.Sequence[] getSequence(\r
391     ) {\r
392         jalview.schemabinding.version2.Sequence[] array = new jalview.schemabinding.version2.Sequence[0];\r
393         return (jalview.schemabinding.version2.Sequence[]) this._sequenceList.toArray(array);\r
394     }\r
395 \r
396     /**\r
397      * Method getSequenceCount.\r
398      * \r
399      * @return the size of this collection\r
400      */\r
401     public int getSequenceCount(\r
402     ) {\r
403         return this._sequenceList.size();\r
404     }\r
405 \r
406     /**\r
407      * Method getSequenceSetProperties.\r
408      * \r
409      * @param index\r
410      * @throws java.lang.IndexOutOfBoundsException if the index\r
411      * given is outside the bounds of the collection\r
412      * @return the value of the\r
413      * jalview.schemabinding.version2.SequenceSetProperties at the\r
414      * given index\r
415      */\r
416     public jalview.schemabinding.version2.SequenceSetProperties getSequenceSetProperties(\r
417             final int index)\r
418     throws java.lang.IndexOutOfBoundsException {\r
419         // check bounds for index\r
420         if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {\r
421             throw new IndexOutOfBoundsException("getSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");\r
422         }\r
423         \r
424         return (jalview.schemabinding.version2.SequenceSetProperties) _sequenceSetPropertiesList.get(index);\r
425     }\r
426 \r
427     /**\r
428      * Method getSequenceSetProperties.Returns the contents of the\r
429      * collection in an Array.  <p>Note:  Just in case the\r
430      * collection contents are changing in another thread, we pass\r
431      * a 0-length Array of the correct type into the API call. \r
432      * This way we <i>know</i> that the Array returned is of\r
433      * exactly the correct length.\r
434      * \r
435      * @return this collection as an Array\r
436      */\r
437     public jalview.schemabinding.version2.SequenceSetProperties[] getSequenceSetProperties(\r
438     ) {\r
439         jalview.schemabinding.version2.SequenceSetProperties[] array = new jalview.schemabinding.version2.SequenceSetProperties[0];\r
440         return (jalview.schemabinding.version2.SequenceSetProperties[]) this._sequenceSetPropertiesList.toArray(array);\r
441     }\r
442 \r
443     /**\r
444      * Method getSequenceSetPropertiesCount.\r
445      * \r
446      * @return the size of this collection\r
447      */\r
448     public int getSequenceSetPropertiesCount(\r
449     ) {\r
450         return this._sequenceSetPropertiesList.size();\r
451     }\r
452 \r
453     /**\r
454      * Method isValid.\r
455      * \r
456      * @return true if this object is valid according to the schema\r
457      */\r
458     public boolean isValid(\r
459     ) {\r
460         try {\r
461             validate();\r
462         } catch (org.exolab.castor.xml.ValidationException vex) {\r
463             return false;\r
464         }\r
465         return true;\r
466     }\r
467 \r
468     /**\r
469      * \r
470      * \r
471      * @param out\r
472      * @throws org.exolab.castor.xml.MarshalException if object is\r
473      * null or if any SAXException is thrown during marshaling\r
474      * @throws org.exolab.castor.xml.ValidationException if this\r
475      * object is an invalid instance according to the schema\r
476      */\r
477     public void marshal(\r
478             final java.io.Writer out)\r
479     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
480         Marshaller.marshal(this, out);\r
481     }\r
482 \r
483     /**\r
484      * \r
485      * \r
486      * @param handler\r
487      * @throws java.io.IOException if an IOException occurs during\r
488      * marshaling\r
489      * @throws org.exolab.castor.xml.ValidationException if this\r
490      * object is an invalid instance according to the schema\r
491      * @throws org.exolab.castor.xml.MarshalException if object is\r
492      * null or if any SAXException is thrown during marshaling\r
493      */\r
494     public void marshal(\r
495             final org.xml.sax.ContentHandler handler)\r
496     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
497         Marshaller.marshal(this, handler);\r
498     }\r
499 \r
500     /**\r
501      * Method removeAlcodonFrame.\r
502      * \r
503      * @param vAlcodonFrame\r
504      * @return true if the object was removed from the collection.\r
505      */\r
506     public boolean removeAlcodonFrame(\r
507             final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame) {\r
508         boolean removed = _alcodonFrameList.remove(vAlcodonFrame);\r
509         return removed;\r
510     }\r
511 \r
512     /**\r
513      * Method removeAlcodonFrameAt.\r
514      * \r
515      * @param index\r
516      * @return the element removed from the collection\r
517      */\r
518     public jalview.schemabinding.version2.AlcodonFrame removeAlcodonFrameAt(\r
519             final int index) {\r
520         java.lang.Object obj = this._alcodonFrameList.remove(index);\r
521         return (jalview.schemabinding.version2.AlcodonFrame) obj;\r
522     }\r
523 \r
524     /**\r
525      */\r
526     public void removeAllAlcodonFrame(\r
527     ) {\r
528         this._alcodonFrameList.clear();\r
529     }\r
530 \r
531     /**\r
532      */\r
533     public void removeAllAnnotation(\r
534     ) {\r
535         this._annotationList.clear();\r
536     }\r
537 \r
538     /**\r
539      */\r
540     public void removeAllSequence(\r
541     ) {\r
542         this._sequenceList.clear();\r
543     }\r
544 \r
545     /**\r
546      */\r
547     public void removeAllSequenceSetProperties(\r
548     ) {\r
549         this._sequenceSetPropertiesList.clear();\r
550     }\r
551 \r
552     /**\r
553      * Method removeAnnotation.\r
554      * \r
555      * @param vAnnotation\r
556      * @return true if the object was removed from the collection.\r
557      */\r
558     public boolean removeAnnotation(\r
559             final jalview.schemabinding.version2.Annotation vAnnotation) {\r
560         boolean removed = _annotationList.remove(vAnnotation);\r
561         return removed;\r
562     }\r
563 \r
564     /**\r
565      * Method removeAnnotationAt.\r
566      * \r
567      * @param index\r
568      * @return the element removed from the collection\r
569      */\r
570     public jalview.schemabinding.version2.Annotation removeAnnotationAt(\r
571             final int index) {\r
572         java.lang.Object obj = this._annotationList.remove(index);\r
573         return (jalview.schemabinding.version2.Annotation) obj;\r
574     }\r
575 \r
576     /**\r
577      * Method removeSequence.\r
578      * \r
579      * @param vSequence\r
580      * @return true if the object was removed from the collection.\r
581      */\r
582     public boolean removeSequence(\r
583             final jalview.schemabinding.version2.Sequence vSequence) {\r
584         boolean removed = _sequenceList.remove(vSequence);\r
585         return removed;\r
586     }\r
587 \r
588     /**\r
589      * Method removeSequenceAt.\r
590      * \r
591      * @param index\r
592      * @return the element removed from the collection\r
593      */\r
594     public jalview.schemabinding.version2.Sequence removeSequenceAt(\r
595             final int index) {\r
596         java.lang.Object obj = this._sequenceList.remove(index);\r
597         return (jalview.schemabinding.version2.Sequence) obj;\r
598     }\r
599 \r
600     /**\r
601      * Method removeSequenceSetProperties.\r
602      * \r
603      * @param vSequenceSetProperties\r
604      * @return true if the object was removed from the collection.\r
605      */\r
606     public boolean removeSequenceSetProperties(\r
607             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties) {\r
608         boolean removed = _sequenceSetPropertiesList.remove(vSequenceSetProperties);\r
609         return removed;\r
610     }\r
611 \r
612     /**\r
613      * Method removeSequenceSetPropertiesAt.\r
614      * \r
615      * @param index\r
616      * @return the element removed from the collection\r
617      */\r
618     public jalview.schemabinding.version2.SequenceSetProperties removeSequenceSetPropertiesAt(\r
619             final int index) {\r
620         java.lang.Object obj = this._sequenceSetPropertiesList.remove(index);\r
621         return (jalview.schemabinding.version2.SequenceSetProperties) obj;\r
622     }\r
623 \r
624     /**\r
625      * \r
626      * \r
627      * @param index\r
628      * @param vAlcodonFrame\r
629      * @throws java.lang.IndexOutOfBoundsException if the index\r
630      * given is outside the bounds of the collection\r
631      */\r
632     public void setAlcodonFrame(\r
633             final int index,\r
634             final jalview.schemabinding.version2.AlcodonFrame vAlcodonFrame)\r
635     throws java.lang.IndexOutOfBoundsException {\r
636         // check bounds for index\r
637         if (index < 0 || index >= this._alcodonFrameList.size()) {\r
638             throw new IndexOutOfBoundsException("setAlcodonFrame: Index value '" + index + "' not in range [0.." + (this._alcodonFrameList.size() - 1) + "]");\r
639         }\r
640         \r
641         this._alcodonFrameList.set(index, vAlcodonFrame);\r
642     }\r
643 \r
644     /**\r
645      * \r
646      * \r
647      * @param vAlcodonFrameArray\r
648      */\r
649     public void setAlcodonFrame(\r
650             final jalview.schemabinding.version2.AlcodonFrame[] vAlcodonFrameArray) {\r
651         //-- copy array\r
652         _alcodonFrameList.clear();\r
653         \r
654         for (int i = 0; i < vAlcodonFrameArray.length; i++) {\r
655                 this._alcodonFrameList.add(vAlcodonFrameArray[i]);\r
656         }\r
657     }\r
658 \r
659     /**\r
660      * \r
661      * \r
662      * @param index\r
663      * @param vAnnotation\r
664      * @throws java.lang.IndexOutOfBoundsException if the index\r
665      * given is outside the bounds of the collection\r
666      */\r
667     public void setAnnotation(\r
668             final int index,\r
669             final jalview.schemabinding.version2.Annotation vAnnotation)\r
670     throws java.lang.IndexOutOfBoundsException {\r
671         // check bounds for index\r
672         if (index < 0 || index >= this._annotationList.size()) {\r
673             throw new IndexOutOfBoundsException("setAnnotation: Index value '" + index + "' not in range [0.." + (this._annotationList.size() - 1) + "]");\r
674         }\r
675         \r
676         this._annotationList.set(index, vAnnotation);\r
677     }\r
678 \r
679     /**\r
680      * \r
681      * \r
682      * @param vAnnotationArray\r
683      */\r
684     public void setAnnotation(\r
685             final jalview.schemabinding.version2.Annotation[] vAnnotationArray) {\r
686         //-- copy array\r
687         _annotationList.clear();\r
688         \r
689         for (int i = 0; i < vAnnotationArray.length; i++) {\r
690                 this._annotationList.add(vAnnotationArray[i]);\r
691         }\r
692     }\r
693 \r
694     /**\r
695      * Sets the value of field 'datasetId'. The field 'datasetId'\r
696      * has the following description: reference to set where\r
697      * jalview will gather the dataset sequences for all sequences\r
698      * in the set. \r
699      *  \r
700      * \r
701      * @param datasetId the value of field 'datasetId'.\r
702      */\r
703     public void setDatasetId(\r
704             final java.lang.String datasetId) {\r
705         this._datasetId = datasetId;\r
706     }\r
707 \r
708     /**\r
709      * Sets the value of field 'gapChar'.\r
710      * \r
711      * @param gapChar the value of field 'gapChar'.\r
712      */\r
713     public void setGapChar(\r
714             final java.lang.String gapChar) {\r
715         this._gapChar = gapChar;\r
716     }\r
717 \r
718     /**\r
719      * \r
720      * \r
721      * @param index\r
722      * @param vSequence\r
723      * @throws java.lang.IndexOutOfBoundsException if the index\r
724      * given is outside the bounds of the collection\r
725      */\r
726     public void setSequence(\r
727             final int index,\r
728             final jalview.schemabinding.version2.Sequence vSequence)\r
729     throws java.lang.IndexOutOfBoundsException {\r
730         // check bounds for index\r
731         if (index < 0 || index >= this._sequenceList.size()) {\r
732             throw new IndexOutOfBoundsException("setSequence: Index value '" + index + "' not in range [0.." + (this._sequenceList.size() - 1) + "]");\r
733         }\r
734         \r
735         this._sequenceList.set(index, vSequence);\r
736     }\r
737 \r
738     /**\r
739      * \r
740      * \r
741      * @param vSequenceArray\r
742      */\r
743     public void setSequence(\r
744             final jalview.schemabinding.version2.Sequence[] vSequenceArray) {\r
745         //-- copy array\r
746         _sequenceList.clear();\r
747         \r
748         for (int i = 0; i < vSequenceArray.length; i++) {\r
749                 this._sequenceList.add(vSequenceArray[i]);\r
750         }\r
751     }\r
752 \r
753     /**\r
754      * \r
755      * \r
756      * @param index\r
757      * @param vSequenceSetProperties\r
758      * @throws java.lang.IndexOutOfBoundsException if the index\r
759      * given is outside the bounds of the collection\r
760      */\r
761     public void setSequenceSetProperties(\r
762             final int index,\r
763             final jalview.schemabinding.version2.SequenceSetProperties vSequenceSetProperties)\r
764     throws java.lang.IndexOutOfBoundsException {\r
765         // check bounds for index\r
766         if (index < 0 || index >= this._sequenceSetPropertiesList.size()) {\r
767             throw new IndexOutOfBoundsException("setSequenceSetProperties: Index value '" + index + "' not in range [0.." + (this._sequenceSetPropertiesList.size() - 1) + "]");\r
768         }\r
769         \r
770         this._sequenceSetPropertiesList.set(index, vSequenceSetProperties);\r
771     }\r
772 \r
773     /**\r
774      * \r
775      * \r
776      * @param vSequenceSetPropertiesArray\r
777      */\r
778     public void setSequenceSetProperties(\r
779             final jalview.schemabinding.version2.SequenceSetProperties[] vSequenceSetPropertiesArray) {\r
780         //-- copy array\r
781         _sequenceSetPropertiesList.clear();\r
782         \r
783         for (int i = 0; i < vSequenceSetPropertiesArray.length; i++) {\r
784                 this._sequenceSetPropertiesList.add(vSequenceSetPropertiesArray[i]);\r
785         }\r
786     }\r
787 \r
788     /**\r
789      * Method unmarshal.\r
790      * \r
791      * @param reader\r
792      * @throws org.exolab.castor.xml.MarshalException if object is\r
793      * null or if any SAXException is thrown during marshaling\r
794      * @throws org.exolab.castor.xml.ValidationException if this\r
795      * object is an invalid instance according to the schema\r
796      * @return the unmarshaled\r
797      * jalview.schemabinding.version2.SequenceSet\r
798      */\r
799     public static jalview.schemabinding.version2.SequenceSet unmarshal(\r
800             final java.io.Reader reader)\r
801     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
802         return (jalview.schemabinding.version2.SequenceSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceSet.class, reader);\r
803     }\r
804 \r
805     /**\r
806      * \r
807      * \r
808      * @throws org.exolab.castor.xml.ValidationException if this\r
809      * object is an invalid instance according to the schema\r
810      */\r
811     public void validate(\r
812     )\r
813     throws org.exolab.castor.xml.ValidationException {\r
814         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
815         validator.validate(this);\r
816     }\r
817 \r
818 }\r