Formatted source
[jalview.git] / src / jalview / binding / VAMSAS.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 VAMSAS.\r
48  *\r
49  * @version $Revision$ $Date$\r
50  */\r
51 public class VAMSAS implements java.io.Serializable {\r
52     //--------------------------/\r
53     //- Class/Member Variables -/\r
54     //--------------------------/\r
55 \r
56     /**\r
57      * Field _alignmentList\r
58      */\r
59     private java.util.Vector _alignmentList;\r
60 \r
61     /**\r
62      * Field _treeList\r
63      */\r
64     private java.util.Vector _treeList;\r
65 \r
66     /**\r
67      * Field _sequenceSetList\r
68      */\r
69     private java.util.Vector _sequenceSetList;\r
70 \r
71     //----------------/\r
72     //- Constructors -/\r
73     //----------------/\r
74     public VAMSAS() {\r
75         super();\r
76         _alignmentList = new Vector();\r
77         _treeList = new Vector();\r
78         _sequenceSetList = new Vector();\r
79     }\r
80      //-- jalview.binding.VAMSAS()\r
81  //-----------/\r
82 \r
83     public void addAlignment(jalview.binding.Alignment vAlignment)\r
84         throws java.lang.IndexOutOfBoundsException {\r
85         _alignmentList.addElement(vAlignment);\r
86     }\r
87      //-- void addAlignment(jalview.binding.Alignment)\r
88 \r
89     /**\r
90      * Method addAlignment\r
91      *\r
92      *\r
93      *\r
94      * @param index\r
95      * @param vAlignment\r
96      */\r
97     public void addAlignment(int index, jalview.binding.Alignment vAlignment)\r
98         throws java.lang.IndexOutOfBoundsException {\r
99         _alignmentList.insertElementAt(vAlignment, index);\r
100     }\r
101      //-- void addAlignment(int, jalview.binding.Alignment)\r
102 \r
103     /**\r
104      * Method addSequenceSet\r
105      *\r
106      *\r
107      *\r
108      * @param vSequenceSet\r
109      */\r
110     public void addSequenceSet(jalview.binding.SequenceSet vSequenceSet)\r
111         throws java.lang.IndexOutOfBoundsException {\r
112         _sequenceSetList.addElement(vSequenceSet);\r
113     }\r
114      //-- void addSequenceSet(jalview.binding.SequenceSet)\r
115 \r
116     /**\r
117      * Method addSequenceSet\r
118      *\r
119      *\r
120      *\r
121      * @param index\r
122      * @param vSequenceSet\r
123      */\r
124     public void addSequenceSet(int index,\r
125         jalview.binding.SequenceSet vSequenceSet)\r
126         throws java.lang.IndexOutOfBoundsException {\r
127         _sequenceSetList.insertElementAt(vSequenceSet, index);\r
128     }\r
129      //-- void addSequenceSet(int, jalview.binding.SequenceSet)\r
130 \r
131     /**\r
132      * Method addTree\r
133      *\r
134      *\r
135      *\r
136      * @param vTree\r
137      */\r
138     public void addTree(java.lang.String vTree)\r
139         throws java.lang.IndexOutOfBoundsException {\r
140         _treeList.addElement(vTree);\r
141     }\r
142      //-- void addTree(java.lang.String)\r
143 \r
144     /**\r
145      * Method addTree\r
146      *\r
147      *\r
148      *\r
149      * @param index\r
150      * @param vTree\r
151      */\r
152     public void addTree(int index, java.lang.String vTree)\r
153         throws java.lang.IndexOutOfBoundsException {\r
154         _treeList.insertElementAt(vTree, index);\r
155     }\r
156      //-- void addTree(int, java.lang.String)\r
157 \r
158     /**\r
159      * Method enumerateAlignment\r
160      *\r
161      *\r
162      *\r
163      * @return Enumeration\r
164      */\r
165     public java.util.Enumeration enumerateAlignment() {\r
166         return _alignmentList.elements();\r
167     }\r
168      //-- java.util.Enumeration enumerateAlignment()\r
169 \r
170     /**\r
171      * Method enumerateSequenceSet\r
172      *\r
173      *\r
174      *\r
175      * @return Enumeration\r
176      */\r
177     public java.util.Enumeration enumerateSequenceSet() {\r
178         return _sequenceSetList.elements();\r
179     }\r
180      //-- java.util.Enumeration enumerateSequenceSet()\r
181 \r
182     /**\r
183      * Method enumerateTree\r
184      *\r
185      *\r
186      *\r
187      * @return Enumeration\r
188      */\r
189     public java.util.Enumeration enumerateTree() {\r
190         return _treeList.elements();\r
191     }\r
192      //-- java.util.Enumeration enumerateTree()\r
193 \r
194     /**\r
195      * Method getAlignment\r
196      *\r
197      *\r
198      *\r
199      * @param index\r
200      * @return Alignment\r
201      */\r
202     public jalview.binding.Alignment getAlignment(int index)\r
203         throws java.lang.IndexOutOfBoundsException {\r
204         //-- check bounds for index\r
205         if ((index < 0) || (index > _alignmentList.size())) {\r
206             throw new IndexOutOfBoundsException();\r
207         }\r
208 \r
209         return (jalview.binding.Alignment) _alignmentList.elementAt(index);\r
210     }\r
211      //-- jalview.binding.Alignment getAlignment(int)\r
212 \r
213     /**\r
214      * Method getAlignment\r
215      *\r
216      *\r
217      *\r
218      * @return Alignment\r
219      */\r
220     public jalview.binding.Alignment[] getAlignment() {\r
221         int size = _alignmentList.size();\r
222         jalview.binding.Alignment[] mArray = new jalview.binding.Alignment[size];\r
223 \r
224         for (int index = 0; index < size; index++) {\r
225             mArray[index] = (jalview.binding.Alignment) _alignmentList.elementAt(index);\r
226         }\r
227 \r
228         return mArray;\r
229     }\r
230      //-- jalview.binding.Alignment[] getAlignment()\r
231 \r
232     /**\r
233      * Method getAlignmentCount\r
234      *\r
235      *\r
236      *\r
237      * @return int\r
238      */\r
239     public int getAlignmentCount() {\r
240         return _alignmentList.size();\r
241     }\r
242      //-- int getAlignmentCount()\r
243 \r
244     /**\r
245      * Method getSequenceSet\r
246      *\r
247      *\r
248      *\r
249      * @param index\r
250      * @return SequenceSet\r
251      */\r
252     public jalview.binding.SequenceSet getSequenceSet(int index)\r
253         throws java.lang.IndexOutOfBoundsException {\r
254         //-- check bounds for index\r
255         if ((index < 0) || (index > _sequenceSetList.size())) {\r
256             throw new IndexOutOfBoundsException();\r
257         }\r
258 \r
259         return (jalview.binding.SequenceSet) _sequenceSetList.elementAt(index);\r
260     }\r
261      //-- jalview.binding.SequenceSet getSequenceSet(int)\r
262 \r
263     /**\r
264      * Method getSequenceSet\r
265      *\r
266      *\r
267      *\r
268      * @return SequenceSet\r
269      */\r
270     public jalview.binding.SequenceSet[] getSequenceSet() {\r
271         int size = _sequenceSetList.size();\r
272         jalview.binding.SequenceSet[] mArray = new jalview.binding.SequenceSet[size];\r
273 \r
274         for (int index = 0; index < size; index++) {\r
275             mArray[index] = (jalview.binding.SequenceSet) _sequenceSetList.elementAt(index);\r
276         }\r
277 \r
278         return mArray;\r
279     }\r
280      //-- jalview.binding.SequenceSet[] getSequenceSet()\r
281 \r
282     /**\r
283      * Method getSequenceSetCount\r
284      *\r
285      *\r
286      *\r
287      * @return int\r
288      */\r
289     public int getSequenceSetCount() {\r
290         return _sequenceSetList.size();\r
291     }\r
292      //-- int getSequenceSetCount()\r
293 \r
294     /**\r
295      * Method getTree\r
296      *\r
297      *\r
298      *\r
299      * @param index\r
300      * @return String\r
301      */\r
302     public java.lang.String getTree(int index)\r
303         throws java.lang.IndexOutOfBoundsException {\r
304         //-- check bounds for index\r
305         if ((index < 0) || (index > _treeList.size())) {\r
306             throw new IndexOutOfBoundsException();\r
307         }\r
308 \r
309         return (String) _treeList.elementAt(index);\r
310     }\r
311      //-- java.lang.String getTree(int)\r
312 \r
313     /**\r
314      * Method getTree\r
315      *\r
316      *\r
317      *\r
318      * @return String\r
319      */\r
320     public java.lang.String[] getTree() {\r
321         int size = _treeList.size();\r
322         java.lang.String[] mArray = new java.lang.String[size];\r
323 \r
324         for (int index = 0; index < size; index++) {\r
325             mArray[index] = (String) _treeList.elementAt(index);\r
326         }\r
327 \r
328         return mArray;\r
329     }\r
330      //-- java.lang.String[] getTree()\r
331 \r
332     /**\r
333      * Method getTreeCount\r
334      *\r
335      *\r
336      *\r
337      * @return int\r
338      */\r
339     public int getTreeCount() {\r
340         return _treeList.size();\r
341     }\r
342      //-- int getTreeCount()\r
343 \r
344     /**\r
345      * Method isValid\r
346      *\r
347      *\r
348      *\r
349      * @return boolean\r
350      */\r
351     public boolean isValid() {\r
352         try {\r
353             validate();\r
354         } catch (org.exolab.castor.xml.ValidationException vex) {\r
355             return false;\r
356         }\r
357 \r
358         return true;\r
359     }\r
360      //-- boolean isValid()\r
361 \r
362     /**\r
363      * Method marshal\r
364      *\r
365      *\r
366      *\r
367      * @param out\r
368      */\r
369     public void marshal(java.io.Writer out)\r
370         throws org.exolab.castor.xml.MarshalException, \r
371             org.exolab.castor.xml.ValidationException {\r
372         Marshaller.marshal(this, out);\r
373     }\r
374      //-- void marshal(java.io.Writer)\r
375 \r
376     /**\r
377      * Method marshal\r
378      *\r
379      *\r
380      *\r
381      * @param handler\r
382      */\r
383     public void marshal(org.xml.sax.ContentHandler handler)\r
384         throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
385             org.exolab.castor.xml.ValidationException {\r
386         Marshaller.marshal(this, handler);\r
387     }\r
388      //-- void marshal(org.xml.sax.ContentHandler)\r
389 \r
390     /**\r
391      * Method removeAlignment\r
392      *\r
393      *\r
394      *\r
395      * @param index\r
396      * @return Alignment\r
397      */\r
398     public jalview.binding.Alignment removeAlignment(int index) {\r
399         java.lang.Object obj = _alignmentList.elementAt(index);\r
400         _alignmentList.removeElementAt(index);\r
401 \r
402         return (jalview.binding.Alignment) obj;\r
403     }\r
404      //-- jalview.binding.Alignment removeAlignment(int)\r
405 \r
406     /**\r
407      * Method removeAllAlignment\r
408      *\r
409      */\r
410     public void removeAllAlignment() {\r
411         _alignmentList.removeAllElements();\r
412     }\r
413      //-- void removeAllAlignment()\r
414 \r
415     /**\r
416      * Method removeAllSequenceSet\r
417      *\r
418      */\r
419     public void removeAllSequenceSet() {\r
420         _sequenceSetList.removeAllElements();\r
421     }\r
422      //-- void removeAllSequenceSet()\r
423 \r
424     /**\r
425      * Method removeAllTree\r
426      *\r
427      */\r
428     public void removeAllTree() {\r
429         _treeList.removeAllElements();\r
430     }\r
431      //-- void removeAllTree()\r
432 \r
433     /**\r
434      * Method removeSequenceSet\r
435      *\r
436      *\r
437      *\r
438      * @param index\r
439      * @return SequenceSet\r
440      */\r
441     public jalview.binding.SequenceSet removeSequenceSet(int index) {\r
442         java.lang.Object obj = _sequenceSetList.elementAt(index);\r
443         _sequenceSetList.removeElementAt(index);\r
444 \r
445         return (jalview.binding.SequenceSet) obj;\r
446     }\r
447      //-- jalview.binding.SequenceSet removeSequenceSet(int)\r
448 \r
449     /**\r
450      * Method removeTree\r
451      *\r
452      *\r
453      *\r
454      * @param index\r
455      * @return String\r
456      */\r
457     public java.lang.String removeTree(int index) {\r
458         java.lang.Object obj = _treeList.elementAt(index);\r
459         _treeList.removeElementAt(index);\r
460 \r
461         return (String) obj;\r
462     }\r
463      //-- java.lang.String removeTree(int)\r
464 \r
465     /**\r
466      * Method setAlignment\r
467      *\r
468      *\r
469      *\r
470      * @param index\r
471      * @param vAlignment\r
472      */\r
473     public void setAlignment(int index, jalview.binding.Alignment vAlignment)\r
474         throws java.lang.IndexOutOfBoundsException {\r
475         //-- check bounds for index\r
476         if ((index < 0) || (index > _alignmentList.size())) {\r
477             throw new IndexOutOfBoundsException();\r
478         }\r
479 \r
480         _alignmentList.setElementAt(vAlignment, index);\r
481     }\r
482      //-- void setAlignment(int, jalview.binding.Alignment)\r
483 \r
484     /**\r
485      * Method setAlignment\r
486      *\r
487      *\r
488      *\r
489      * @param alignmentArray\r
490      */\r
491     public void setAlignment(jalview.binding.Alignment[] alignmentArray) {\r
492         //-- copy array\r
493         _alignmentList.removeAllElements();\r
494 \r
495         for (int i = 0; i < alignmentArray.length; i++) {\r
496             _alignmentList.addElement(alignmentArray[i]);\r
497         }\r
498     }\r
499      //-- void setAlignment(jalview.binding.Alignment)\r
500 \r
501     /**\r
502      * Method setSequenceSet\r
503      *\r
504      *\r
505      *\r
506      * @param index\r
507      * @param vSequenceSet\r
508      */\r
509     public void setSequenceSet(int index,\r
510         jalview.binding.SequenceSet vSequenceSet)\r
511         throws java.lang.IndexOutOfBoundsException {\r
512         //-- check bounds for index\r
513         if ((index < 0) || (index > _sequenceSetList.size())) {\r
514             throw new IndexOutOfBoundsException();\r
515         }\r
516 \r
517         _sequenceSetList.setElementAt(vSequenceSet, index);\r
518     }\r
519      //-- void setSequenceSet(int, jalview.binding.SequenceSet)\r
520 \r
521     /**\r
522      * Method setSequenceSet\r
523      *\r
524      *\r
525      *\r
526      * @param sequenceSetArray\r
527      */\r
528     public void setSequenceSet(jalview.binding.SequenceSet[] sequenceSetArray) {\r
529         //-- copy array\r
530         _sequenceSetList.removeAllElements();\r
531 \r
532         for (int i = 0; i < sequenceSetArray.length; i++) {\r
533             _sequenceSetList.addElement(sequenceSetArray[i]);\r
534         }\r
535     }\r
536      //-- void setSequenceSet(jalview.binding.SequenceSet)\r
537 \r
538     /**\r
539      * Method setTree\r
540      *\r
541      *\r
542      *\r
543      * @param index\r
544      * @param vTree\r
545      */\r
546     public void setTree(int index, java.lang.String vTree)\r
547         throws java.lang.IndexOutOfBoundsException {\r
548         //-- check bounds for index\r
549         if ((index < 0) || (index > _treeList.size())) {\r
550             throw new IndexOutOfBoundsException();\r
551         }\r
552 \r
553         _treeList.setElementAt(vTree, index);\r
554     }\r
555      //-- void setTree(int, java.lang.String)\r
556 \r
557     /**\r
558      * Method setTree\r
559      *\r
560      *\r
561      *\r
562      * @param treeArray\r
563      */\r
564     public void setTree(java.lang.String[] treeArray) {\r
565         //-- copy array\r
566         _treeList.removeAllElements();\r
567 \r
568         for (int i = 0; i < treeArray.length; i++) {\r
569             _treeList.addElement(treeArray[i]);\r
570         }\r
571     }\r
572      //-- void setTree(java.lang.String)\r
573 \r
574     /**\r
575      * Method unmarshal\r
576      *\r
577      *\r
578      *\r
579      * @param reader\r
580      * @return Object\r
581      */\r
582     public static java.lang.Object unmarshal(java.io.Reader reader)\r
583         throws org.exolab.castor.xml.MarshalException, \r
584             org.exolab.castor.xml.ValidationException {\r
585         return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VAMSAS.class,\r
586             reader);\r
587     }\r
588      //-- java.lang.Object unmarshal(java.io.Reader)\r
589 \r
590     /**\r
591      * Method validate\r
592      *\r
593      */\r
594     public void validate() throws org.exolab.castor.xml.ValidationException {\r
595         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
596         validator.validate(this);\r
597     }\r
598      //-- void validate()\r
599 }\r