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