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