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