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