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