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