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