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