a2c285a41307fbae88ef52b58bbe0b924d4bc6d4
[jalview.git] / src / jalview / schemabinding / version2 / JalviewModelSequence.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.schemabinding.version2;
19
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
23
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
26
27 /**
28  * Class JalviewModelSequence.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class JalviewModelSequence implements java.io.Serializable
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * Field _JSeqList.
41    */
42   private java.util.Vector _JSeqList;
43
44   /**
45    * Field _JGroupList.
46    */
47   private java.util.Vector _JGroupList;
48
49   /**
50    * Field _viewportList.
51    */
52   private java.util.Vector _viewportList;
53
54   /**
55    * Field _userColoursList.
56    */
57   private java.util.Vector _userColoursList;
58
59   /**
60    * Field _treeList.
61    */
62   private java.util.Vector _treeList;
63
64   /**
65    * Field _featureSettings.
66    */
67   private jalview.schemabinding.version2.FeatureSettings _featureSettings;
68
69   // ----------------/
70   // - Constructors -/
71   // ----------------/
72
73   public JalviewModelSequence()
74   {
75     super();
76     this._JSeqList = new java.util.Vector();
77     this._JGroupList = new java.util.Vector();
78     this._viewportList = new java.util.Vector();
79     this._userColoursList = new java.util.Vector();
80     this._treeList = new java.util.Vector();
81   }
82
83   // -----------/
84   // - Methods -/
85   // -----------/
86
87   /**
88    * 
89    * 
90    * @param vJGroup
91    * @throws java.lang.IndexOutOfBoundsException
92    *           if the index given is outside the bounds of the collection
93    */
94   public void addJGroup(final jalview.schemabinding.version2.JGroup vJGroup)
95           throws java.lang.IndexOutOfBoundsException
96   {
97     this._JGroupList.addElement(vJGroup);
98   }
99
100   /**
101    * 
102    * 
103    * @param index
104    * @param vJGroup
105    * @throws java.lang.IndexOutOfBoundsException
106    *           if the index given is outside the bounds of the collection
107    */
108   public void addJGroup(final int index,
109           final jalview.schemabinding.version2.JGroup vJGroup)
110           throws java.lang.IndexOutOfBoundsException
111   {
112     this._JGroupList.add(index, vJGroup);
113   }
114
115   /**
116    * 
117    * 
118    * @param vJSeq
119    * @throws java.lang.IndexOutOfBoundsException
120    *           if the index given is outside the bounds of the collection
121    */
122   public void addJSeq(final jalview.schemabinding.version2.JSeq vJSeq)
123           throws java.lang.IndexOutOfBoundsException
124   {
125     this._JSeqList.addElement(vJSeq);
126   }
127
128   /**
129    * 
130    * 
131    * @param index
132    * @param vJSeq
133    * @throws java.lang.IndexOutOfBoundsException
134    *           if the index given is outside the bounds of the collection
135    */
136   public void addJSeq(final int index,
137           final jalview.schemabinding.version2.JSeq vJSeq)
138           throws java.lang.IndexOutOfBoundsException
139   {
140     this._JSeqList.add(index, vJSeq);
141   }
142
143   /**
144    * 
145    * 
146    * @param vTree
147    * @throws java.lang.IndexOutOfBoundsException
148    *           if the index given is outside the bounds of the collection
149    */
150   public void addTree(final jalview.schemabinding.version2.Tree vTree)
151           throws java.lang.IndexOutOfBoundsException
152   {
153     this._treeList.addElement(vTree);
154   }
155
156   /**
157    * 
158    * 
159    * @param index
160    * @param vTree
161    * @throws java.lang.IndexOutOfBoundsException
162    *           if the index given is outside the bounds of the collection
163    */
164   public void addTree(final int index,
165           final jalview.schemabinding.version2.Tree vTree)
166           throws java.lang.IndexOutOfBoundsException
167   {
168     this._treeList.add(index, vTree);
169   }
170
171   /**
172    * 
173    * 
174    * @param vUserColours
175    * @throws java.lang.IndexOutOfBoundsException
176    *           if the index given is outside the bounds of the collection
177    */
178   public void addUserColours(
179           final jalview.schemabinding.version2.UserColours vUserColours)
180           throws java.lang.IndexOutOfBoundsException
181   {
182     this._userColoursList.addElement(vUserColours);
183   }
184
185   /**
186    * 
187    * 
188    * @param index
189    * @param vUserColours
190    * @throws java.lang.IndexOutOfBoundsException
191    *           if the index given is outside the bounds of the collection
192    */
193   public void addUserColours(final int index,
194           final jalview.schemabinding.version2.UserColours vUserColours)
195           throws java.lang.IndexOutOfBoundsException
196   {
197     this._userColoursList.add(index, vUserColours);
198   }
199
200   /**
201    * 
202    * 
203    * @param vViewport
204    * @throws java.lang.IndexOutOfBoundsException
205    *           if the index given is outside the bounds of the collection
206    */
207   public void addViewport(
208           final jalview.schemabinding.version2.Viewport vViewport)
209           throws java.lang.IndexOutOfBoundsException
210   {
211     this._viewportList.addElement(vViewport);
212   }
213
214   /**
215    * 
216    * 
217    * @param index
218    * @param vViewport
219    * @throws java.lang.IndexOutOfBoundsException
220    *           if the index given is outside the bounds of the collection
221    */
222   public void addViewport(final int index,
223           final jalview.schemabinding.version2.Viewport vViewport)
224           throws java.lang.IndexOutOfBoundsException
225   {
226     this._viewportList.add(index, vViewport);
227   }
228
229   /**
230    * Method enumerateJGroup.
231    * 
232    * @return an Enumeration over all jalview.schemabinding.version2.JGroup
233    *         elements
234    */
235   public java.util.Enumeration enumerateJGroup()
236   {
237     return this._JGroupList.elements();
238   }
239
240   /**
241    * Method enumerateJSeq.
242    * 
243    * @return an Enumeration over all jalview.schemabinding.version2.JSeq
244    *         elements
245    */
246   public java.util.Enumeration enumerateJSeq()
247   {
248     return this._JSeqList.elements();
249   }
250
251   /**
252    * Method enumerateTree.
253    * 
254    * @return an Enumeration over all jalview.schemabinding.version2.Tree
255    *         elements
256    */
257   public java.util.Enumeration enumerateTree()
258   {
259     return this._treeList.elements();
260   }
261
262   /**
263    * Method enumerateUserColours.
264    * 
265    * @return an Enumeration over all jalview.schemabinding.version2.UserColours
266    *         elements
267    */
268   public java.util.Enumeration enumerateUserColours()
269   {
270     return this._userColoursList.elements();
271   }
272
273   /**
274    * Method enumerateViewport.
275    * 
276    * @return an Enumeration over all jalview.schemabinding.version2.Viewport
277    *         elements
278    */
279   public java.util.Enumeration enumerateViewport()
280   {
281     return this._viewportList.elements();
282   }
283
284   /**
285    * Returns the value of field 'featureSettings'.
286    * 
287    * @return the value of field 'FeatureSettings'.
288    */
289   public jalview.schemabinding.version2.FeatureSettings getFeatureSettings()
290   {
291     return this._featureSettings;
292   }
293
294   /**
295    * Method getJGroup.
296    * 
297    * @param index
298    * @throws java.lang.IndexOutOfBoundsException
299    *           if the index given is outside the bounds of the collection
300    * @return the value of the jalview.schemabinding.version2.JGroup at the given
301    *         index
302    */
303   public jalview.schemabinding.version2.JGroup getJGroup(final int index)
304           throws java.lang.IndexOutOfBoundsException
305   {
306     // check bounds for index
307     if (index < 0 || index >= this._JGroupList.size())
308     {
309       throw new IndexOutOfBoundsException("getJGroup: Index value '"
310               + index + "' not in range [0.."
311               + (this._JGroupList.size() - 1) + "]");
312     }
313
314     return (jalview.schemabinding.version2.JGroup) _JGroupList.get(index);
315   }
316
317   /**
318    * Method getJGroup.Returns the contents of the collection in an Array.
319    * <p>
320    * Note: Just in case the collection contents are changing in another thread,
321    * we pass a 0-length Array of the correct type into the API call. This way we
322    * <i>know</i> that the Array returned is of exactly the correct length.
323    * 
324    * @return this collection as an Array
325    */
326   public jalview.schemabinding.version2.JGroup[] getJGroup()
327   {
328     jalview.schemabinding.version2.JGroup[] array = new jalview.schemabinding.version2.JGroup[0];
329     return (jalview.schemabinding.version2.JGroup[]) this._JGroupList
330             .toArray(array);
331   }
332
333   /**
334    * Method getJGroupCount.
335    * 
336    * @return the size of this collection
337    */
338   public int getJGroupCount()
339   {
340     return this._JGroupList.size();
341   }
342
343   /**
344    * Method getJSeq.
345    * 
346    * @param index
347    * @throws java.lang.IndexOutOfBoundsException
348    *           if the index given is outside the bounds of the collection
349    * @return the value of the jalview.schemabinding.version2.JSeq at the given
350    *         index
351    */
352   public jalview.schemabinding.version2.JSeq getJSeq(final int index)
353           throws java.lang.IndexOutOfBoundsException
354   {
355     // check bounds for index
356     if (index < 0 || index >= this._JSeqList.size())
357     {
358       throw new IndexOutOfBoundsException("getJSeq: Index value '" + index
359               + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
360     }
361
362     return (jalview.schemabinding.version2.JSeq) _JSeqList.get(index);
363   }
364
365   /**
366    * Method getJSeq.Returns the contents of the collection in an Array.
367    * <p>
368    * Note: Just in case the collection contents are changing in another thread,
369    * we pass a 0-length Array of the correct type into the API call. This way we
370    * <i>know</i> that the Array returned is of exactly the correct length.
371    * 
372    * @return this collection as an Array
373    */
374   public jalview.schemabinding.version2.JSeq[] getJSeq()
375   {
376     jalview.schemabinding.version2.JSeq[] array = new jalview.schemabinding.version2.JSeq[0];
377     return (jalview.schemabinding.version2.JSeq[]) this._JSeqList
378             .toArray(array);
379   }
380
381   /**
382    * Method getJSeqCount.
383    * 
384    * @return the size of this collection
385    */
386   public int getJSeqCount()
387   {
388     return this._JSeqList.size();
389   }
390
391   /**
392    * Method getTree.
393    * 
394    * @param index
395    * @throws java.lang.IndexOutOfBoundsException
396    *           if the index given is outside the bounds of the collection
397    * @return the value of the jalview.schemabinding.version2.Tree at the given
398    *         index
399    */
400   public jalview.schemabinding.version2.Tree getTree(final int index)
401           throws java.lang.IndexOutOfBoundsException
402   {
403     // check bounds for index
404     if (index < 0 || index >= this._treeList.size())
405     {
406       throw new IndexOutOfBoundsException("getTree: Index value '" + index
407               + "' not in range [0.." + (this._treeList.size() - 1) + "]");
408     }
409
410     return (jalview.schemabinding.version2.Tree) _treeList.get(index);
411   }
412
413   /**
414    * Method getTree.Returns the contents of the collection in an Array.
415    * <p>
416    * Note: Just in case the collection contents are changing in another thread,
417    * we pass a 0-length Array of the correct type into the API call. This way we
418    * <i>know</i> that the Array returned is of exactly the correct length.
419    * 
420    * @return this collection as an Array
421    */
422   public jalview.schemabinding.version2.Tree[] getTree()
423   {
424     jalview.schemabinding.version2.Tree[] array = new jalview.schemabinding.version2.Tree[0];
425     return (jalview.schemabinding.version2.Tree[]) this._treeList
426             .toArray(array);
427   }
428
429   /**
430    * Method getTreeCount.
431    * 
432    * @return the size of this collection
433    */
434   public int getTreeCount()
435   {
436     return this._treeList.size();
437   }
438
439   /**
440    * Method getUserColours.
441    * 
442    * @param index
443    * @throws java.lang.IndexOutOfBoundsException
444    *           if the index given is outside the bounds of the collection
445    * @return the value of the jalview.schemabinding.version2.UserColours at the
446    *         given index
447    */
448   public jalview.schemabinding.version2.UserColours getUserColours(
449           final int index) throws java.lang.IndexOutOfBoundsException
450   {
451     // check bounds for index
452     if (index < 0 || index >= this._userColoursList.size())
453     {
454       throw new IndexOutOfBoundsException("getUserColours: Index value '"
455               + index + "' not in range [0.."
456               + (this._userColoursList.size() - 1) + "]");
457     }
458
459     return (jalview.schemabinding.version2.UserColours) _userColoursList
460             .get(index);
461   }
462
463   /**
464    * Method getUserColours.Returns the contents of the collection in an Array.
465    * <p>
466    * Note: Just in case the collection contents are changing in another thread,
467    * we pass a 0-length Array of the correct type into the API call. This way we
468    * <i>know</i> that the Array returned is of exactly the correct length.
469    * 
470    * @return this collection as an Array
471    */
472   public jalview.schemabinding.version2.UserColours[] getUserColours()
473   {
474     jalview.schemabinding.version2.UserColours[] array = new jalview.schemabinding.version2.UserColours[0];
475     return (jalview.schemabinding.version2.UserColours[]) this._userColoursList
476             .toArray(array);
477   }
478
479   /**
480    * Method getUserColoursCount.
481    * 
482    * @return the size of this collection
483    */
484   public int getUserColoursCount()
485   {
486     return this._userColoursList.size();
487   }
488
489   /**
490    * Method getViewport.
491    * 
492    * @param index
493    * @throws java.lang.IndexOutOfBoundsException
494    *           if the index given is outside the bounds of the collection
495    * @return the value of the jalview.schemabinding.version2.Viewport at the
496    *         given index
497    */
498   public jalview.schemabinding.version2.Viewport getViewport(final int index)
499           throws java.lang.IndexOutOfBoundsException
500   {
501     // check bounds for index
502     if (index < 0 || index >= this._viewportList.size())
503     {
504       throw new IndexOutOfBoundsException("getViewport: Index value '"
505               + index + "' not in range [0.."
506               + (this._viewportList.size() - 1) + "]");
507     }
508
509     return (jalview.schemabinding.version2.Viewport) _viewportList
510             .get(index);
511   }
512
513   /**
514    * Method getViewport.Returns the contents of the collection in an Array.
515    * <p>
516    * Note: Just in case the collection contents are changing in another thread,
517    * we pass a 0-length Array of the correct type into the API call. This way we
518    * <i>know</i> that the Array returned is of exactly the correct length.
519    * 
520    * @return this collection as an Array
521    */
522   public jalview.schemabinding.version2.Viewport[] getViewport()
523   {
524     jalview.schemabinding.version2.Viewport[] array = new jalview.schemabinding.version2.Viewport[0];
525     return (jalview.schemabinding.version2.Viewport[]) this._viewportList
526             .toArray(array);
527   }
528
529   /**
530    * Method getViewportCount.
531    * 
532    * @return the size of this collection
533    */
534   public int getViewportCount()
535   {
536     return this._viewportList.size();
537   }
538
539   /**
540    * Method isValid.
541    * 
542    * @return true if this object is valid according to the schema
543    */
544   public boolean isValid()
545   {
546     try
547     {
548       validate();
549     } catch (org.exolab.castor.xml.ValidationException vex)
550     {
551       return false;
552     }
553     return true;
554   }
555
556   /**
557    * 
558    * 
559    * @param out
560    * @throws org.exolab.castor.xml.MarshalException
561    *           if object is null or if any SAXException is thrown during
562    *           marshaling
563    * @throws org.exolab.castor.xml.ValidationException
564    *           if this object is an invalid instance according to the schema
565    */
566   public void marshal(final java.io.Writer out)
567           throws org.exolab.castor.xml.MarshalException,
568           org.exolab.castor.xml.ValidationException
569   {
570     Marshaller.marshal(this, out);
571   }
572
573   /**
574    * 
575    * 
576    * @param handler
577    * @throws java.io.IOException
578    *           if an IOException occurs during marshaling
579    * @throws org.exolab.castor.xml.ValidationException
580    *           if this object is an invalid instance according to the schema
581    * @throws org.exolab.castor.xml.MarshalException
582    *           if object is null or if any SAXException is thrown during
583    *           marshaling
584    */
585   public void marshal(final org.xml.sax.ContentHandler handler)
586           throws java.io.IOException,
587           org.exolab.castor.xml.MarshalException,
588           org.exolab.castor.xml.ValidationException
589   {
590     Marshaller.marshal(this, handler);
591   }
592
593   /**
594      */
595   public void removeAllJGroup()
596   {
597     this._JGroupList.clear();
598   }
599
600   /**
601      */
602   public void removeAllJSeq()
603   {
604     this._JSeqList.clear();
605   }
606
607   /**
608      */
609   public void removeAllTree()
610   {
611     this._treeList.clear();
612   }
613
614   /**
615      */
616   public void removeAllUserColours()
617   {
618     this._userColoursList.clear();
619   }
620
621   /**
622      */
623   public void removeAllViewport()
624   {
625     this._viewportList.clear();
626   }
627
628   /**
629    * Method removeJGroup.
630    * 
631    * @param vJGroup
632    * @return true if the object was removed from the collection.
633    */
634   public boolean removeJGroup(
635           final jalview.schemabinding.version2.JGroup vJGroup)
636   {
637     boolean removed = _JGroupList.remove(vJGroup);
638     return removed;
639   }
640
641   /**
642    * Method removeJGroupAt.
643    * 
644    * @param index
645    * @return the element removed from the collection
646    */
647   public jalview.schemabinding.version2.JGroup removeJGroupAt(
648           final int index)
649   {
650     java.lang.Object obj = this._JGroupList.remove(index);
651     return (jalview.schemabinding.version2.JGroup) obj;
652   }
653
654   /**
655    * Method removeJSeq.
656    * 
657    * @param vJSeq
658    * @return true if the object was removed from the collection.
659    */
660   public boolean removeJSeq(final jalview.schemabinding.version2.JSeq vJSeq)
661   {
662     boolean removed = _JSeqList.remove(vJSeq);
663     return removed;
664   }
665
666   /**
667    * Method removeJSeqAt.
668    * 
669    * @param index
670    * @return the element removed from the collection
671    */
672   public jalview.schemabinding.version2.JSeq removeJSeqAt(final int index)
673   {
674     java.lang.Object obj = this._JSeqList.remove(index);
675     return (jalview.schemabinding.version2.JSeq) obj;
676   }
677
678   /**
679    * Method removeTree.
680    * 
681    * @param vTree
682    * @return true if the object was removed from the collection.
683    */
684   public boolean removeTree(final jalview.schemabinding.version2.Tree vTree)
685   {
686     boolean removed = _treeList.remove(vTree);
687     return removed;
688   }
689
690   /**
691    * Method removeTreeAt.
692    * 
693    * @param index
694    * @return the element removed from the collection
695    */
696   public jalview.schemabinding.version2.Tree removeTreeAt(final int index)
697   {
698     java.lang.Object obj = this._treeList.remove(index);
699     return (jalview.schemabinding.version2.Tree) obj;
700   }
701
702   /**
703    * Method removeUserColours.
704    * 
705    * @param vUserColours
706    * @return true if the object was removed from the collection.
707    */
708   public boolean removeUserColours(
709           final jalview.schemabinding.version2.UserColours vUserColours)
710   {
711     boolean removed = _userColoursList.remove(vUserColours);
712     return removed;
713   }
714
715   /**
716    * Method removeUserColoursAt.
717    * 
718    * @param index
719    * @return the element removed from the collection
720    */
721   public jalview.schemabinding.version2.UserColours removeUserColoursAt(
722           final int index)
723   {
724     java.lang.Object obj = this._userColoursList.remove(index);
725     return (jalview.schemabinding.version2.UserColours) obj;
726   }
727
728   /**
729    * Method removeViewport.
730    * 
731    * @param vViewport
732    * @return true if the object was removed from the collection.
733    */
734   public boolean removeViewport(
735           final jalview.schemabinding.version2.Viewport vViewport)
736   {
737     boolean removed = _viewportList.remove(vViewport);
738     return removed;
739   }
740
741   /**
742    * Method removeViewportAt.
743    * 
744    * @param index
745    * @return the element removed from the collection
746    */
747   public jalview.schemabinding.version2.Viewport removeViewportAt(
748           final int index)
749   {
750     java.lang.Object obj = this._viewportList.remove(index);
751     return (jalview.schemabinding.version2.Viewport) obj;
752   }
753
754   /**
755    * Sets the value of field 'featureSettings'.
756    * 
757    * @param featureSettings
758    *          the value of field 'featureSettings'.
759    */
760   public void setFeatureSettings(
761           final jalview.schemabinding.version2.FeatureSettings featureSettings)
762   {
763     this._featureSettings = featureSettings;
764   }
765
766   /**
767    * 
768    * 
769    * @param index
770    * @param vJGroup
771    * @throws java.lang.IndexOutOfBoundsException
772    *           if the index given is outside the bounds of the collection
773    */
774   public void setJGroup(final int index,
775           final jalview.schemabinding.version2.JGroup vJGroup)
776           throws java.lang.IndexOutOfBoundsException
777   {
778     // check bounds for index
779     if (index < 0 || index >= this._JGroupList.size())
780     {
781       throw new IndexOutOfBoundsException("setJGroup: Index value '"
782               + index + "' not in range [0.."
783               + (this._JGroupList.size() - 1) + "]");
784     }
785
786     this._JGroupList.set(index, vJGroup);
787   }
788
789   /**
790    * 
791    * 
792    * @param vJGroupArray
793    */
794   public void setJGroup(
795           final jalview.schemabinding.version2.JGroup[] vJGroupArray)
796   {
797     // -- copy array
798     _JGroupList.clear();
799
800     for (int i = 0; i < vJGroupArray.length; i++)
801     {
802       this._JGroupList.add(vJGroupArray[i]);
803     }
804   }
805
806   /**
807    * 
808    * 
809    * @param index
810    * @param vJSeq
811    * @throws java.lang.IndexOutOfBoundsException
812    *           if the index given is outside the bounds of the collection
813    */
814   public void setJSeq(final int index,
815           final jalview.schemabinding.version2.JSeq vJSeq)
816           throws java.lang.IndexOutOfBoundsException
817   {
818     // check bounds for index
819     if (index < 0 || index >= this._JSeqList.size())
820     {
821       throw new IndexOutOfBoundsException("setJSeq: Index value '" + index
822               + "' not in range [0.." + (this._JSeqList.size() - 1) + "]");
823     }
824
825     this._JSeqList.set(index, vJSeq);
826   }
827
828   /**
829    * 
830    * 
831    * @param vJSeqArray
832    */
833   public void setJSeq(final jalview.schemabinding.version2.JSeq[] vJSeqArray)
834   {
835     // -- copy array
836     _JSeqList.clear();
837
838     for (int i = 0; i < vJSeqArray.length; i++)
839     {
840       this._JSeqList.add(vJSeqArray[i]);
841     }
842   }
843
844   /**
845    * 
846    * 
847    * @param index
848    * @param vTree
849    * @throws java.lang.IndexOutOfBoundsException
850    *           if the index given is outside the bounds of the collection
851    */
852   public void setTree(final int index,
853           final jalview.schemabinding.version2.Tree vTree)
854           throws java.lang.IndexOutOfBoundsException
855   {
856     // check bounds for index
857     if (index < 0 || index >= this._treeList.size())
858     {
859       throw new IndexOutOfBoundsException("setTree: Index value '" + index
860               + "' not in range [0.." + (this._treeList.size() - 1) + "]");
861     }
862
863     this._treeList.set(index, vTree);
864   }
865
866   /**
867    * 
868    * 
869    * @param vTreeArray
870    */
871   public void setTree(final jalview.schemabinding.version2.Tree[] vTreeArray)
872   {
873     // -- copy array
874     _treeList.clear();
875
876     for (int i = 0; i < vTreeArray.length; i++)
877     {
878       this._treeList.add(vTreeArray[i]);
879     }
880   }
881
882   /**
883    * 
884    * 
885    * @param index
886    * @param vUserColours
887    * @throws java.lang.IndexOutOfBoundsException
888    *           if the index given is outside the bounds of the collection
889    */
890   public void setUserColours(final int index,
891           final jalview.schemabinding.version2.UserColours vUserColours)
892           throws java.lang.IndexOutOfBoundsException
893   {
894     // check bounds for index
895     if (index < 0 || index >= this._userColoursList.size())
896     {
897       throw new IndexOutOfBoundsException("setUserColours: Index value '"
898               + index + "' not in range [0.."
899               + (this._userColoursList.size() - 1) + "]");
900     }
901
902     this._userColoursList.set(index, vUserColours);
903   }
904
905   /**
906    * 
907    * 
908    * @param vUserColoursArray
909    */
910   public void setUserColours(
911           final jalview.schemabinding.version2.UserColours[] vUserColoursArray)
912   {
913     // -- copy array
914     _userColoursList.clear();
915
916     for (int i = 0; i < vUserColoursArray.length; i++)
917     {
918       this._userColoursList.add(vUserColoursArray[i]);
919     }
920   }
921
922   /**
923    * 
924    * 
925    * @param index
926    * @param vViewport
927    * @throws java.lang.IndexOutOfBoundsException
928    *           if the index given is outside the bounds of the collection
929    */
930   public void setViewport(final int index,
931           final jalview.schemabinding.version2.Viewport vViewport)
932           throws java.lang.IndexOutOfBoundsException
933   {
934     // check bounds for index
935     if (index < 0 || index >= this._viewportList.size())
936     {
937       throw new IndexOutOfBoundsException("setViewport: Index value '"
938               + index + "' not in range [0.."
939               + (this._viewportList.size() - 1) + "]");
940     }
941
942     this._viewportList.set(index, vViewport);
943   }
944
945   /**
946    * 
947    * 
948    * @param vViewportArray
949    */
950   public void setViewport(
951           final jalview.schemabinding.version2.Viewport[] vViewportArray)
952   {
953     // -- copy array
954     _viewportList.clear();
955
956     for (int i = 0; i < vViewportArray.length; i++)
957     {
958       this._viewportList.add(vViewportArray[i]);
959     }
960   }
961
962   /**
963    * Method unmarshal.
964    * 
965    * @param reader
966    * @throws org.exolab.castor.xml.MarshalException
967    *           if object is null or if any SAXException is thrown during
968    *           marshaling
969    * @throws org.exolab.castor.xml.ValidationException
970    *           if this object is an invalid instance according to the schema
971    * @return the unmarshaled jalview.schemabinding.version2.JalviewModelSequence
972    */
973   public static jalview.schemabinding.version2.JalviewModelSequence unmarshal(
974           final java.io.Reader reader)
975           throws org.exolab.castor.xml.MarshalException,
976           org.exolab.castor.xml.ValidationException
977   {
978     return (jalview.schemabinding.version2.JalviewModelSequence) Unmarshaller
979             .unmarshal(
980                     jalview.schemabinding.version2.JalviewModelSequence.class,
981                     reader);
982   }
983
984   /**
985    * 
986    * 
987    * @throws org.exolab.castor.xml.ValidationException
988    *           if this object is an invalid instance according to the schema
989    */
990   public void validate() throws org.exolab.castor.xml.ValidationException
991   {
992     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
993     validator.validate(this);
994   }
995
996 }