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