2.08, not 2.07
[jalview.git] / src / jalview / binding / SequenceSet.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 package jalview.binding;\r
9 \r
10   //---------------------------------/\r
11  //- Imported classes and packages -/\r
12 //---------------------------------/\r
13 \r
14 import java.io.IOException;\r
15 import java.io.Reader;\r
16 import java.io.Serializable;\r
17 import java.io.Writer;\r
18 import java.util.Enumeration;\r
19 import java.util.Vector;\r
20 import org.exolab.castor.xml.MarshalException;\r
21 import org.exolab.castor.xml.Marshaller;\r
22 import org.exolab.castor.xml.Unmarshaller;\r
23 import org.exolab.castor.xml.ValidationException;\r
24 import org.xml.sax.ContentHandler;\r
25 \r
26 /**\r
27  * Class SequenceSet.\r
28  * \r
29  * @version $Revision$ $Date$\r
30  */\r
31 public class SequenceSet implements java.io.Serializable {\r
32 \r
33 \r
34       //--------------------------/\r
35      //- Class/Member Variables -/\r
36     //--------------------------/\r
37 \r
38     /**\r
39      * Field _gapChar\r
40      */\r
41     private java.lang.String _gapChar;\r
42 \r
43     /**\r
44      * Field _aligned\r
45      */\r
46     private boolean _aligned;\r
47 \r
48     /**\r
49      * keeps track of state for field: _aligned\r
50      */\r
51     private boolean _has_aligned;\r
52 \r
53     /**\r
54      * Field _sequenceList\r
55      */\r
56     private java.util.Vector _sequenceList;\r
57 \r
58     /**\r
59      * Field _annotationList\r
60      */\r
61     private java.util.Vector _annotationList;\r
62 \r
63 \r
64       //----------------/\r
65      //- Constructors -/\r
66     //----------------/\r
67 \r
68     public SequenceSet() {\r
69         super();\r
70         _sequenceList = new Vector();\r
71         _annotationList = new Vector();\r
72     } //-- jalview.binding.SequenceSet()\r
73 \r
74 \r
75       //-----------/\r
76      //- Methods -/\r
77     //-----------/\r
78 \r
79     /**\r
80      * Method addAnnotation\r
81      * \r
82      * \r
83      * \r
84      * @param vAnnotation\r
85      */\r
86     public void addAnnotation(jalview.binding.Annotation vAnnotation)\r
87         throws java.lang.IndexOutOfBoundsException\r
88     {\r
89         _annotationList.addElement(vAnnotation);\r
90     } //-- void addAnnotation(jalview.binding.Annotation) \r
91 \r
92     /**\r
93      * Method addAnnotation\r
94      * \r
95      * \r
96      * \r
97      * @param index\r
98      * @param vAnnotation\r
99      */\r
100     public void addAnnotation(int index, jalview.binding.Annotation vAnnotation)\r
101         throws java.lang.IndexOutOfBoundsException\r
102     {\r
103         _annotationList.insertElementAt(vAnnotation, index);\r
104     } //-- void addAnnotation(int, jalview.binding.Annotation) \r
105 \r
106     /**\r
107      * Method addSequence\r
108      * \r
109      * \r
110      * \r
111      * @param vSequence\r
112      */\r
113     public void addSequence(jalview.binding.Sequence vSequence)\r
114         throws java.lang.IndexOutOfBoundsException\r
115     {\r
116         _sequenceList.addElement(vSequence);\r
117     } //-- void addSequence(jalview.binding.Sequence) \r
118 \r
119     /**\r
120      * Method addSequence\r
121      * \r
122      * \r
123      * \r
124      * @param index\r
125      * @param vSequence\r
126      */\r
127     public void addSequence(int index, jalview.binding.Sequence vSequence)\r
128         throws java.lang.IndexOutOfBoundsException\r
129     {\r
130         _sequenceList.insertElementAt(vSequence, index);\r
131     } //-- void addSequence(int, jalview.binding.Sequence) \r
132 \r
133     /**\r
134      * Method deleteAligned\r
135      * \r
136      */\r
137     public void deleteAligned()\r
138     {\r
139         this._has_aligned= false;\r
140     } //-- void deleteAligned() \r
141 \r
142     /**\r
143      * Method enumerateAnnotation\r
144      * \r
145      * \r
146      * \r
147      * @return Enumeration\r
148      */\r
149     public java.util.Enumeration enumerateAnnotation()\r
150     {\r
151         return _annotationList.elements();\r
152     } //-- java.util.Enumeration enumerateAnnotation() \r
153 \r
154     /**\r
155      * Method enumerateSequence\r
156      * \r
157      * \r
158      * \r
159      * @return Enumeration\r
160      */\r
161     public java.util.Enumeration enumerateSequence()\r
162     {\r
163         return _sequenceList.elements();\r
164     } //-- java.util.Enumeration enumerateSequence() \r
165 \r
166     /**\r
167      * Returns the value of field 'aligned'.\r
168      * \r
169      * @return boolean\r
170      * @return the value of field 'aligned'.\r
171      */\r
172     public boolean getAligned()\r
173     {\r
174         return this._aligned;\r
175     } //-- boolean getAligned() \r
176 \r
177     /**\r
178      * Method getAnnotation\r
179      * \r
180      * \r
181      * \r
182      * @param index\r
183      * @return Annotation\r
184      */\r
185     public jalview.binding.Annotation getAnnotation(int index)\r
186         throws java.lang.IndexOutOfBoundsException\r
187     {\r
188         //-- check bounds for index\r
189         if ((index < 0) || (index > _annotationList.size())) {\r
190             throw new IndexOutOfBoundsException();\r
191         }\r
192         \r
193         return (jalview.binding.Annotation) _annotationList.elementAt(index);\r
194     } //-- jalview.binding.Annotation getAnnotation(int) \r
195 \r
196     /**\r
197      * Method getAnnotation\r
198      * \r
199      * \r
200      * \r
201      * @return Annotation\r
202      */\r
203     public jalview.binding.Annotation[] getAnnotation()\r
204     {\r
205         int size = _annotationList.size();\r
206         jalview.binding.Annotation[] mArray = new jalview.binding.Annotation[size];\r
207         for (int index = 0; index < size; index++) {\r
208             mArray[index] = (jalview.binding.Annotation) _annotationList.elementAt(index);\r
209         }\r
210         return mArray;\r
211     } //-- jalview.binding.Annotation[] getAnnotation() \r
212 \r
213     /**\r
214      * Method getAnnotationCount\r
215      * \r
216      * \r
217      * \r
218      * @return int\r
219      */\r
220     public int getAnnotationCount()\r
221     {\r
222         return _annotationList.size();\r
223     } //-- int getAnnotationCount() \r
224 \r
225     /**\r
226      * Returns the value of field 'gapChar'.\r
227      * \r
228      * @return String\r
229      * @return the value of field 'gapChar'.\r
230      */\r
231     public java.lang.String getGapChar()\r
232     {\r
233         return this._gapChar;\r
234     } //-- java.lang.String getGapChar() \r
235 \r
236     /**\r
237      * Method getSequence\r
238      * \r
239      * \r
240      * \r
241      * @param index\r
242      * @return Sequence\r
243      */\r
244     public jalview.binding.Sequence getSequence(int index)\r
245         throws java.lang.IndexOutOfBoundsException\r
246     {\r
247         //-- check bounds for index\r
248         if ((index < 0) || (index > _sequenceList.size())) {\r
249             throw new IndexOutOfBoundsException();\r
250         }\r
251         \r
252         return (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
253     } //-- jalview.binding.Sequence getSequence(int) \r
254 \r
255     /**\r
256      * Method getSequence\r
257      * \r
258      * \r
259      * \r
260      * @return Sequence\r
261      */\r
262     public jalview.binding.Sequence[] getSequence()\r
263     {\r
264         int size = _sequenceList.size();\r
265         jalview.binding.Sequence[] mArray = new jalview.binding.Sequence[size];\r
266         for (int index = 0; index < size; index++) {\r
267             mArray[index] = (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
268         }\r
269         return mArray;\r
270     } //-- jalview.binding.Sequence[] getSequence() \r
271 \r
272     /**\r
273      * Method getSequenceCount\r
274      * \r
275      * \r
276      * \r
277      * @return int\r
278      */\r
279     public int getSequenceCount()\r
280     {\r
281         return _sequenceList.size();\r
282     } //-- int getSequenceCount() \r
283 \r
284     /**\r
285      * Method hasAligned\r
286      * \r
287      * \r
288      * \r
289      * @return boolean\r
290      */\r
291     public boolean hasAligned()\r
292     {\r
293         return this._has_aligned;\r
294     } //-- boolean hasAligned() \r
295 \r
296     /**\r
297      * Method isValid\r
298      * \r
299      * \r
300      * \r
301      * @return boolean\r
302      */\r
303     public boolean isValid()\r
304     {\r
305         try {\r
306             validate();\r
307         }\r
308         catch (org.exolab.castor.xml.ValidationException vex) {\r
309             return false;\r
310         }\r
311         return true;\r
312     } //-- boolean isValid() \r
313 \r
314     /**\r
315      * Method marshal\r
316      * \r
317      * \r
318      * \r
319      * @param out\r
320      */\r
321     public void marshal(java.io.Writer out)\r
322         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
323     {\r
324         \r
325         Marshaller.marshal(this, out);\r
326     } //-- void marshal(java.io.Writer) \r
327 \r
328     /**\r
329      * Method marshal\r
330      * \r
331      * \r
332      * \r
333      * @param handler\r
334      */\r
335     public void marshal(org.xml.sax.ContentHandler handler)\r
336         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
337     {\r
338         \r
339         Marshaller.marshal(this, handler);\r
340     } //-- void marshal(org.xml.sax.ContentHandler) \r
341 \r
342     /**\r
343      * Method removeAllAnnotation\r
344      * \r
345      */\r
346     public void removeAllAnnotation()\r
347     {\r
348         _annotationList.removeAllElements();\r
349     } //-- void removeAllAnnotation() \r
350 \r
351     /**\r
352      * Method removeAllSequence\r
353      * \r
354      */\r
355     public void removeAllSequence()\r
356     {\r
357         _sequenceList.removeAllElements();\r
358     } //-- void removeAllSequence() \r
359 \r
360     /**\r
361      * Method removeAnnotation\r
362      * \r
363      * \r
364      * \r
365      * @param index\r
366      * @return Annotation\r
367      */\r
368     public jalview.binding.Annotation removeAnnotation(int index)\r
369     {\r
370         java.lang.Object obj = _annotationList.elementAt(index);\r
371         _annotationList.removeElementAt(index);\r
372         return (jalview.binding.Annotation) obj;\r
373     } //-- jalview.binding.Annotation removeAnnotation(int) \r
374 \r
375     /**\r
376      * Method removeSequence\r
377      * \r
378      * \r
379      * \r
380      * @param index\r
381      * @return Sequence\r
382      */\r
383     public jalview.binding.Sequence removeSequence(int index)\r
384     {\r
385         java.lang.Object obj = _sequenceList.elementAt(index);\r
386         _sequenceList.removeElementAt(index);\r
387         return (jalview.binding.Sequence) obj;\r
388     } //-- jalview.binding.Sequence removeSequence(int) \r
389 \r
390     /**\r
391      * Sets the value of field 'aligned'.\r
392      * \r
393      * @param aligned the value of field 'aligned'.\r
394      */\r
395     public void setAligned(boolean aligned)\r
396     {\r
397         this._aligned = aligned;\r
398         this._has_aligned = true;\r
399     } //-- void setAligned(boolean) \r
400 \r
401     /**\r
402      * Method setAnnotation\r
403      * \r
404      * \r
405      * \r
406      * @param index\r
407      * @param vAnnotation\r
408      */\r
409     public void setAnnotation(int index, jalview.binding.Annotation vAnnotation)\r
410         throws java.lang.IndexOutOfBoundsException\r
411     {\r
412         //-- check bounds for index\r
413         if ((index < 0) || (index > _annotationList.size())) {\r
414             throw new IndexOutOfBoundsException();\r
415         }\r
416         _annotationList.setElementAt(vAnnotation, index);\r
417     } //-- void setAnnotation(int, jalview.binding.Annotation) \r
418 \r
419     /**\r
420      * Method setAnnotation\r
421      * \r
422      * \r
423      * \r
424      * @param annotationArray\r
425      */\r
426     public void setAnnotation(jalview.binding.Annotation[] annotationArray)\r
427     {\r
428         //-- copy array\r
429         _annotationList.removeAllElements();\r
430         for (int i = 0; i < annotationArray.length; i++) {\r
431             _annotationList.addElement(annotationArray[i]);\r
432         }\r
433     } //-- void setAnnotation(jalview.binding.Annotation) \r
434 \r
435     /**\r
436      * Sets the value of field 'gapChar'.\r
437      * \r
438      * @param gapChar the value of field 'gapChar'.\r
439      */\r
440     public void setGapChar(java.lang.String gapChar)\r
441     {\r
442         this._gapChar = gapChar;\r
443     } //-- void setGapChar(java.lang.String) \r
444 \r
445     /**\r
446      * Method setSequence\r
447      * \r
448      * \r
449      * \r
450      * @param index\r
451      * @param vSequence\r
452      */\r
453     public void setSequence(int index, jalview.binding.Sequence vSequence)\r
454         throws java.lang.IndexOutOfBoundsException\r
455     {\r
456         //-- check bounds for index\r
457         if ((index < 0) || (index > _sequenceList.size())) {\r
458             throw new IndexOutOfBoundsException();\r
459         }\r
460         _sequenceList.setElementAt(vSequence, index);\r
461     } //-- void setSequence(int, jalview.binding.Sequence) \r
462 \r
463     /**\r
464      * Method setSequence\r
465      * \r
466      * \r
467      * \r
468      * @param sequenceArray\r
469      */\r
470     public void setSequence(jalview.binding.Sequence[] sequenceArray)\r
471     {\r
472         //-- copy array\r
473         _sequenceList.removeAllElements();\r
474         for (int i = 0; i < sequenceArray.length; i++) {\r
475             _sequenceList.addElement(sequenceArray[i]);\r
476         }\r
477     } //-- void setSequence(jalview.binding.Sequence) \r
478 \r
479     /**\r
480      * Method unmarshal\r
481      * \r
482      * \r
483      * \r
484      * @param reader\r
485      * @return Object\r
486      */\r
487     public static java.lang.Object unmarshal(java.io.Reader reader)\r
488         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
489     {\r
490         return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader);\r
491     } //-- java.lang.Object unmarshal(java.io.Reader) \r
492 \r
493     /**\r
494      * Method validate\r
495      * \r
496      */\r
497     public void validate()\r
498         throws org.exolab.castor.xml.ValidationException\r
499     {\r
500         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
501         validator.validate(this);\r
502     } //-- void validate() \r
503 \r
504 }\r