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