Formatted source
[jalview.git] / src / jalview / binding / JalviewModelSequence.java
1 /*\r
2  * This class was automatically generated with\r
3  * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 /*\r
8 * Jalview - A Sequence Alignment Editor and Viewer\r
9 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
10 *\r
11 * This program is free software; you can redistribute it and/or\r
12 * modify it under the terms of the GNU General Public License\r
13 * as published by the Free Software Foundation; either version 2\r
14 * of the License, or (at your option) any later version.\r
15 *\r
16 * This program is distributed in the hope that it will be useful,\r
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
19 * GNU General Public License for more details.\r
20 *\r
21 * You should have received a copy of the GNU General Public License\r
22 * along with this program; if not, write to the Free Software\r
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
24 */\r
25 package jalview.binding;\r
26 \r
27 import org.exolab.castor.xml.MarshalException;\r
28 import org.exolab.castor.xml.Marshaller;\r
29 import org.exolab.castor.xml.Unmarshaller;\r
30 import org.exolab.castor.xml.ValidationException;\r
31 \r
32 import org.xml.sax.ContentHandler;\r
33 \r
34 //---------------------------------/\r
35 //- Imported classes and packages -/\r
36 //---------------------------------/\r
37 import java.io.IOException;\r
38 import java.io.Reader;\r
39 import java.io.Serializable;\r
40 import java.io.Writer;\r
41 \r
42 import java.util.Enumeration;\r
43 import java.util.Vector;\r
44 \r
45 \r
46 /**\r
47  * Class JalviewModelSequence.\r
48  *\r
49  * @version $Revision$ $Date$\r
50  */\r
51 public class JalviewModelSequence implements java.io.Serializable {\r
52     //--------------------------/\r
53     //- Class/Member Variables -/\r
54     //--------------------------/\r
55 \r
56     /**\r
57      * Field _JSeqList\r
58      */\r
59     private java.util.Vector _JSeqList;\r
60 \r
61     /**\r
62      * Field _JGroupList\r
63      */\r
64     private java.util.Vector _JGroupList;\r
65 \r
66     /**\r
67      * Field _viewportList\r
68      */\r
69     private java.util.Vector _viewportList;\r
70 \r
71     /**\r
72      * Field _userColoursList\r
73      */\r
74     private java.util.Vector _userColoursList;\r
75 \r
76     //----------------/\r
77     //- Constructors -/\r
78     //----------------/\r
79     public JalviewModelSequence() {\r
80         super();\r
81         _JSeqList = new Vector();\r
82         _JGroupList = new Vector();\r
83         _viewportList = new Vector();\r
84         _userColoursList = new Vector();\r
85     }\r
86      //-- jalview.binding.JalviewModelSequence()\r
87  //-----------/\r
88 \r
89     public void addJGroup(jalview.binding.JGroup vJGroup)\r
90         throws java.lang.IndexOutOfBoundsException {\r
91         _JGroupList.addElement(vJGroup);\r
92     }\r
93      //-- void addJGroup(jalview.binding.JGroup)\r
94 \r
95     /**\r
96      * Method addJGroup\r
97      *\r
98      *\r
99      *\r
100      * @param index\r
101      * @param vJGroup\r
102      */\r
103     public void addJGroup(int index, jalview.binding.JGroup vJGroup)\r
104         throws java.lang.IndexOutOfBoundsException {\r
105         _JGroupList.insertElementAt(vJGroup, index);\r
106     }\r
107      //-- void addJGroup(int, jalview.binding.JGroup)\r
108 \r
109     /**\r
110      * Method addJSeq\r
111      *\r
112      *\r
113      *\r
114      * @param vJSeq\r
115      */\r
116     public void addJSeq(jalview.binding.JSeq vJSeq)\r
117         throws java.lang.IndexOutOfBoundsException {\r
118         _JSeqList.addElement(vJSeq);\r
119     }\r
120      //-- void addJSeq(jalview.binding.JSeq)\r
121 \r
122     /**\r
123      * Method addJSeq\r
124      *\r
125      *\r
126      *\r
127      * @param index\r
128      * @param vJSeq\r
129      */\r
130     public void addJSeq(int index, jalview.binding.JSeq vJSeq)\r
131         throws java.lang.IndexOutOfBoundsException {\r
132         _JSeqList.insertElementAt(vJSeq, index);\r
133     }\r
134      //-- void addJSeq(int, jalview.binding.JSeq)\r
135 \r
136     /**\r
137      * Method addUserColours\r
138      *\r
139      *\r
140      *\r
141      * @param vUserColours\r
142      */\r
143     public void addUserColours(jalview.binding.UserColours vUserColours)\r
144         throws java.lang.IndexOutOfBoundsException {\r
145         _userColoursList.addElement(vUserColours);\r
146     }\r
147      //-- void addUserColours(jalview.binding.UserColours)\r
148 \r
149     /**\r
150      * Method addUserColours\r
151      *\r
152      *\r
153      *\r
154      * @param index\r
155      * @param vUserColours\r
156      */\r
157     public void addUserColours(int index,\r
158         jalview.binding.UserColours vUserColours)\r
159         throws java.lang.IndexOutOfBoundsException {\r
160         _userColoursList.insertElementAt(vUserColours, index);\r
161     }\r
162      //-- void addUserColours(int, jalview.binding.UserColours)\r
163 \r
164     /**\r
165      * Method addViewport\r
166      *\r
167      *\r
168      *\r
169      * @param vViewport\r
170      */\r
171     public void addViewport(jalview.binding.Viewport vViewport)\r
172         throws java.lang.IndexOutOfBoundsException {\r
173         _viewportList.addElement(vViewport);\r
174     }\r
175      //-- void addViewport(jalview.binding.Viewport)\r
176 \r
177     /**\r
178      * Method addViewport\r
179      *\r
180      *\r
181      *\r
182      * @param index\r
183      * @param vViewport\r
184      */\r
185     public void addViewport(int index, jalview.binding.Viewport vViewport)\r
186         throws java.lang.IndexOutOfBoundsException {\r
187         _viewportList.insertElementAt(vViewport, index);\r
188     }\r
189      //-- void addViewport(int, jalview.binding.Viewport)\r
190 \r
191     /**\r
192      * Method enumerateJGroup\r
193      *\r
194      *\r
195      *\r
196      * @return Enumeration\r
197      */\r
198     public java.util.Enumeration enumerateJGroup() {\r
199         return _JGroupList.elements();\r
200     }\r
201      //-- java.util.Enumeration enumerateJGroup()\r
202 \r
203     /**\r
204      * Method enumerateJSeq\r
205      *\r
206      *\r
207      *\r
208      * @return Enumeration\r
209      */\r
210     public java.util.Enumeration enumerateJSeq() {\r
211         return _JSeqList.elements();\r
212     }\r
213      //-- java.util.Enumeration enumerateJSeq()\r
214 \r
215     /**\r
216      * Method enumerateUserColours\r
217      *\r
218      *\r
219      *\r
220      * @return Enumeration\r
221      */\r
222     public java.util.Enumeration enumerateUserColours() {\r
223         return _userColoursList.elements();\r
224     }\r
225      //-- java.util.Enumeration enumerateUserColours()\r
226 \r
227     /**\r
228      * Method enumerateViewport\r
229      *\r
230      *\r
231      *\r
232      * @return Enumeration\r
233      */\r
234     public java.util.Enumeration enumerateViewport() {\r
235         return _viewportList.elements();\r
236     }\r
237      //-- java.util.Enumeration enumerateViewport()\r
238 \r
239     /**\r
240      * Method getJGroup\r
241      *\r
242      *\r
243      *\r
244      * @param index\r
245      * @return JGroup\r
246      */\r
247     public jalview.binding.JGroup getJGroup(int index)\r
248         throws java.lang.IndexOutOfBoundsException {\r
249         //-- check bounds for index\r
250         if ((index < 0) || (index > _JGroupList.size())) {\r
251             throw new IndexOutOfBoundsException();\r
252         }\r
253 \r
254         return (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
255     }\r
256      //-- jalview.binding.JGroup getJGroup(int)\r
257 \r
258     /**\r
259      * Method getJGroup\r
260      *\r
261      *\r
262      *\r
263      * @return JGroup\r
264      */\r
265     public jalview.binding.JGroup[] getJGroup() {\r
266         int size = _JGroupList.size();\r
267         jalview.binding.JGroup[] mArray = new jalview.binding.JGroup[size];\r
268 \r
269         for (int index = 0; index < size; index++) {\r
270             mArray[index] = (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
271         }\r
272 \r
273         return mArray;\r
274     }\r
275      //-- jalview.binding.JGroup[] getJGroup()\r
276 \r
277     /**\r
278      * Method getJGroupCount\r
279      *\r
280      *\r
281      *\r
282      * @return int\r
283      */\r
284     public int getJGroupCount() {\r
285         return _JGroupList.size();\r
286     }\r
287      //-- int getJGroupCount()\r
288 \r
289     /**\r
290      * Method getJSeq\r
291      *\r
292      *\r
293      *\r
294      * @param index\r
295      * @return JSeq\r
296      */\r
297     public jalview.binding.JSeq getJSeq(int index)\r
298         throws java.lang.IndexOutOfBoundsException {\r
299         //-- check bounds for index\r
300         if ((index < 0) || (index > _JSeqList.size())) {\r
301             throw new IndexOutOfBoundsException();\r
302         }\r
303 \r
304         return (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
305     }\r
306      //-- jalview.binding.JSeq getJSeq(int)\r
307 \r
308     /**\r
309      * Method getJSeq\r
310      *\r
311      *\r
312      *\r
313      * @return JSeq\r
314      */\r
315     public jalview.binding.JSeq[] getJSeq() {\r
316         int size = _JSeqList.size();\r
317         jalview.binding.JSeq[] mArray = new jalview.binding.JSeq[size];\r
318 \r
319         for (int index = 0; index < size; index++) {\r
320             mArray[index] = (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
321         }\r
322 \r
323         return mArray;\r
324     }\r
325      //-- jalview.binding.JSeq[] getJSeq()\r
326 \r
327     /**\r
328      * Method getJSeqCount\r
329      *\r
330      *\r
331      *\r
332      * @return int\r
333      */\r
334     public int getJSeqCount() {\r
335         return _JSeqList.size();\r
336     }\r
337      //-- int getJSeqCount()\r
338 \r
339     /**\r
340      * Method getUserColours\r
341      *\r
342      *\r
343      *\r
344      * @param index\r
345      * @return UserColours\r
346      */\r
347     public jalview.binding.UserColours getUserColours(int index)\r
348         throws java.lang.IndexOutOfBoundsException {\r
349         //-- check bounds for index\r
350         if ((index < 0) || (index > _userColoursList.size())) {\r
351             throw new IndexOutOfBoundsException();\r
352         }\r
353 \r
354         return (jalview.binding.UserColours) _userColoursList.elementAt(index);\r
355     }\r
356      //-- jalview.binding.UserColours getUserColours(int)\r
357 \r
358     /**\r
359      * Method getUserColours\r
360      *\r
361      *\r
362      *\r
363      * @return UserColours\r
364      */\r
365     public jalview.binding.UserColours[] getUserColours() {\r
366         int size = _userColoursList.size();\r
367         jalview.binding.UserColours[] mArray = new jalview.binding.UserColours[size];\r
368 \r
369         for (int index = 0; index < size; index++) {\r
370             mArray[index] = (jalview.binding.UserColours) _userColoursList.elementAt(index);\r
371         }\r
372 \r
373         return mArray;\r
374     }\r
375      //-- jalview.binding.UserColours[] getUserColours()\r
376 \r
377     /**\r
378      * Method getUserColoursCount\r
379      *\r
380      *\r
381      *\r
382      * @return int\r
383      */\r
384     public int getUserColoursCount() {\r
385         return _userColoursList.size();\r
386     }\r
387      //-- int getUserColoursCount()\r
388 \r
389     /**\r
390      * Method getViewport\r
391      *\r
392      *\r
393      *\r
394      * @param index\r
395      * @return Viewport\r
396      */\r
397     public jalview.binding.Viewport getViewport(int index)\r
398         throws java.lang.IndexOutOfBoundsException {\r
399         //-- check bounds for index\r
400         if ((index < 0) || (index > _viewportList.size())) {\r
401             throw new IndexOutOfBoundsException();\r
402         }\r
403 \r
404         return (jalview.binding.Viewport) _viewportList.elementAt(index);\r
405     }\r
406      //-- jalview.binding.Viewport getViewport(int)\r
407 \r
408     /**\r
409      * Method getViewport\r
410      *\r
411      *\r
412      *\r
413      * @return Viewport\r
414      */\r
415     public jalview.binding.Viewport[] getViewport() {\r
416         int size = _viewportList.size();\r
417         jalview.binding.Viewport[] mArray = new jalview.binding.Viewport[size];\r
418 \r
419         for (int index = 0; index < size; index++) {\r
420             mArray[index] = (jalview.binding.Viewport) _viewportList.elementAt(index);\r
421         }\r
422 \r
423         return mArray;\r
424     }\r
425      //-- jalview.binding.Viewport[] getViewport()\r
426 \r
427     /**\r
428      * Method getViewportCount\r
429      *\r
430      *\r
431      *\r
432      * @return int\r
433      */\r
434     public int getViewportCount() {\r
435         return _viewportList.size();\r
436     }\r
437      //-- int getViewportCount()\r
438 \r
439     /**\r
440      * Method isValid\r
441      *\r
442      *\r
443      *\r
444      * @return boolean\r
445      */\r
446     public boolean isValid() {\r
447         try {\r
448             validate();\r
449         } catch (org.exolab.castor.xml.ValidationException vex) {\r
450             return false;\r
451         }\r
452 \r
453         return true;\r
454     }\r
455      //-- boolean isValid()\r
456 \r
457     /**\r
458      * Method marshal\r
459      *\r
460      *\r
461      *\r
462      * @param out\r
463      */\r
464     public void marshal(java.io.Writer out)\r
465         throws org.exolab.castor.xml.MarshalException, \r
466             org.exolab.castor.xml.ValidationException {\r
467         Marshaller.marshal(this, out);\r
468     }\r
469      //-- void marshal(java.io.Writer)\r
470 \r
471     /**\r
472      * Method marshal\r
473      *\r
474      *\r
475      *\r
476      * @param handler\r
477      */\r
478     public void marshal(org.xml.sax.ContentHandler handler)\r
479         throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
480             org.exolab.castor.xml.ValidationException {\r
481         Marshaller.marshal(this, handler);\r
482     }\r
483      //-- void marshal(org.xml.sax.ContentHandler)\r
484 \r
485     /**\r
486      * Method removeAllJGroup\r
487      *\r
488      */\r
489     public void removeAllJGroup() {\r
490         _JGroupList.removeAllElements();\r
491     }\r
492      //-- void removeAllJGroup()\r
493 \r
494     /**\r
495      * Method removeAllJSeq\r
496      *\r
497      */\r
498     public void removeAllJSeq() {\r
499         _JSeqList.removeAllElements();\r
500     }\r
501      //-- void removeAllJSeq()\r
502 \r
503     /**\r
504      * Method removeAllUserColours\r
505      *\r
506      */\r
507     public void removeAllUserColours() {\r
508         _userColoursList.removeAllElements();\r
509     }\r
510      //-- void removeAllUserColours()\r
511 \r
512     /**\r
513      * Method removeAllViewport\r
514      *\r
515      */\r
516     public void removeAllViewport() {\r
517         _viewportList.removeAllElements();\r
518     }\r
519      //-- void removeAllViewport()\r
520 \r
521     /**\r
522      * Method removeJGroup\r
523      *\r
524      *\r
525      *\r
526      * @param index\r
527      * @return JGroup\r
528      */\r
529     public jalview.binding.JGroup removeJGroup(int index) {\r
530         java.lang.Object obj = _JGroupList.elementAt(index);\r
531         _JGroupList.removeElementAt(index);\r
532 \r
533         return (jalview.binding.JGroup) obj;\r
534     }\r
535      //-- jalview.binding.JGroup removeJGroup(int)\r
536 \r
537     /**\r
538      * Method removeJSeq\r
539      *\r
540      *\r
541      *\r
542      * @param index\r
543      * @return JSeq\r
544      */\r
545     public jalview.binding.JSeq removeJSeq(int index) {\r
546         java.lang.Object obj = _JSeqList.elementAt(index);\r
547         _JSeqList.removeElementAt(index);\r
548 \r
549         return (jalview.binding.JSeq) obj;\r
550     }\r
551      //-- jalview.binding.JSeq removeJSeq(int)\r
552 \r
553     /**\r
554      * Method removeUserColours\r
555      *\r
556      *\r
557      *\r
558      * @param index\r
559      * @return UserColours\r
560      */\r
561     public jalview.binding.UserColours removeUserColours(int index) {\r
562         java.lang.Object obj = _userColoursList.elementAt(index);\r
563         _userColoursList.removeElementAt(index);\r
564 \r
565         return (jalview.binding.UserColours) obj;\r
566     }\r
567      //-- jalview.binding.UserColours removeUserColours(int)\r
568 \r
569     /**\r
570      * Method removeViewport\r
571      *\r
572      *\r
573      *\r
574      * @param index\r
575      * @return Viewport\r
576      */\r
577     public jalview.binding.Viewport removeViewport(int index) {\r
578         java.lang.Object obj = _viewportList.elementAt(index);\r
579         _viewportList.removeElementAt(index);\r
580 \r
581         return (jalview.binding.Viewport) obj;\r
582     }\r
583      //-- jalview.binding.Viewport removeViewport(int)\r
584 \r
585     /**\r
586      * Method setJGroup\r
587      *\r
588      *\r
589      *\r
590      * @param index\r
591      * @param vJGroup\r
592      */\r
593     public void setJGroup(int index, jalview.binding.JGroup vJGroup)\r
594         throws java.lang.IndexOutOfBoundsException {\r
595         //-- check bounds for index\r
596         if ((index < 0) || (index > _JGroupList.size())) {\r
597             throw new IndexOutOfBoundsException();\r
598         }\r
599 \r
600         _JGroupList.setElementAt(vJGroup, index);\r
601     }\r
602      //-- void setJGroup(int, jalview.binding.JGroup)\r
603 \r
604     /**\r
605      * Method setJGroup\r
606      *\r
607      *\r
608      *\r
609      * @param JGroupArray\r
610      */\r
611     public void setJGroup(jalview.binding.JGroup[] JGroupArray) {\r
612         //-- copy array\r
613         _JGroupList.removeAllElements();\r
614 \r
615         for (int i = 0; i < JGroupArray.length; i++) {\r
616             _JGroupList.addElement(JGroupArray[i]);\r
617         }\r
618     }\r
619      //-- void setJGroup(jalview.binding.JGroup)\r
620 \r
621     /**\r
622      * Method setJSeq\r
623      *\r
624      *\r
625      *\r
626      * @param index\r
627      * @param vJSeq\r
628      */\r
629     public void setJSeq(int index, jalview.binding.JSeq vJSeq)\r
630         throws java.lang.IndexOutOfBoundsException {\r
631         //-- check bounds for index\r
632         if ((index < 0) || (index > _JSeqList.size())) {\r
633             throw new IndexOutOfBoundsException();\r
634         }\r
635 \r
636         _JSeqList.setElementAt(vJSeq, index);\r
637     }\r
638      //-- void setJSeq(int, jalview.binding.JSeq)\r
639 \r
640     /**\r
641      * Method setJSeq\r
642      *\r
643      *\r
644      *\r
645      * @param JSeqArray\r
646      */\r
647     public void setJSeq(jalview.binding.JSeq[] JSeqArray) {\r
648         //-- copy array\r
649         _JSeqList.removeAllElements();\r
650 \r
651         for (int i = 0; i < JSeqArray.length; i++) {\r
652             _JSeqList.addElement(JSeqArray[i]);\r
653         }\r
654     }\r
655      //-- void setJSeq(jalview.binding.JSeq)\r
656 \r
657     /**\r
658      * Method setUserColours\r
659      *\r
660      *\r
661      *\r
662      * @param index\r
663      * @param vUserColours\r
664      */\r
665     public void setUserColours(int index,\r
666         jalview.binding.UserColours vUserColours)\r
667         throws java.lang.IndexOutOfBoundsException {\r
668         //-- check bounds for index\r
669         if ((index < 0) || (index > _userColoursList.size())) {\r
670             throw new IndexOutOfBoundsException();\r
671         }\r
672 \r
673         _userColoursList.setElementAt(vUserColours, index);\r
674     }\r
675      //-- void setUserColours(int, jalview.binding.UserColours)\r
676 \r
677     /**\r
678      * Method setUserColours\r
679      *\r
680      *\r
681      *\r
682      * @param userColoursArray\r
683      */\r
684     public void setUserColours(jalview.binding.UserColours[] userColoursArray) {\r
685         //-- copy array\r
686         _userColoursList.removeAllElements();\r
687 \r
688         for (int i = 0; i < userColoursArray.length; i++) {\r
689             _userColoursList.addElement(userColoursArray[i]);\r
690         }\r
691     }\r
692      //-- void setUserColours(jalview.binding.UserColours)\r
693 \r
694     /**\r
695      * Method setViewport\r
696      *\r
697      *\r
698      *\r
699      * @param index\r
700      * @param vViewport\r
701      */\r
702     public void setViewport(int index, jalview.binding.Viewport vViewport)\r
703         throws java.lang.IndexOutOfBoundsException {\r
704         //-- check bounds for index\r
705         if ((index < 0) || (index > _viewportList.size())) {\r
706             throw new IndexOutOfBoundsException();\r
707         }\r
708 \r
709         _viewportList.setElementAt(vViewport, index);\r
710     }\r
711      //-- void setViewport(int, jalview.binding.Viewport)\r
712 \r
713     /**\r
714      * Method setViewport\r
715      *\r
716      *\r
717      *\r
718      * @param viewportArray\r
719      */\r
720     public void setViewport(jalview.binding.Viewport[] viewportArray) {\r
721         //-- copy array\r
722         _viewportList.removeAllElements();\r
723 \r
724         for (int i = 0; i < viewportArray.length; i++) {\r
725             _viewportList.addElement(viewportArray[i]);\r
726         }\r
727     }\r
728      //-- void setViewport(jalview.binding.Viewport)\r
729 \r
730     /**\r
731      * Method unmarshal\r
732      *\r
733      *\r
734      *\r
735      * @param reader\r
736      * @return Object\r
737      */\r
738     public static java.lang.Object unmarshal(java.io.Reader reader)\r
739         throws org.exolab.castor.xml.MarshalException, \r
740             org.exolab.castor.xml.ValidationException {\r
741         return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class,\r
742             reader);\r
743     }\r
744      //-- java.lang.Object unmarshal(java.io.Reader)\r
745 \r
746     /**\r
747      * Method validate\r
748      *\r
749      */\r
750     public void validate() throws org.exolab.castor.xml.ValidationException {\r
751         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
752         validator.validate(this);\r
753     }\r
754      //-- void validate()\r
755 }\r