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