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