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