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