Copyright test
[jalview.git] / src / jalview / binding / VAMSAS.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3  * Copyright (C) $(date) The Jalview Authors
4  *
5  * This file is part of Jalview.
6  *  
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *   
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  *******************************************************************************/
21 /*
22  * This class was automatically generated with 
23  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
24  * Schema.
25  * $Id$
26  */
27
28 package jalview.binding;
29
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
33
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
36
37 /**
38  * Class VAMSAS.
39  * 
40  * @version $Revision$ $Date$
41  */
42 public class VAMSAS implements java.io.Serializable
43 {
44
45   // --------------------------/
46   // - Class/Member Variables -/
47   // --------------------------/
48
49   /**
50    * Field _alignmentList.
51    */
52   private java.util.Vector _alignmentList;
53
54   /**
55    * Field _treeList.
56    */
57   private java.util.Vector _treeList;
58
59   /**
60    * Field _sequenceSetList.
61    */
62   private java.util.Vector _sequenceSetList;
63
64   // ----------------/
65   // - Constructors -/
66   // ----------------/
67
68   public VAMSAS()
69   {
70     super();
71     this._alignmentList = new java.util.Vector();
72     this._treeList = new java.util.Vector();
73     this._sequenceSetList = new java.util.Vector();
74   }
75
76   // -----------/
77   // - Methods -/
78   // -----------/
79
80   /**
81    * 
82    * 
83    * @param vAlignment
84    * @throws java.lang.IndexOutOfBoundsException
85    *           if the index given is outside the bounds of the collection
86    */
87   public void addAlignment(final Alignment vAlignment)
88           throws java.lang.IndexOutOfBoundsException
89   {
90     this._alignmentList.addElement(vAlignment);
91   }
92
93   /**
94    * 
95    * 
96    * @param index
97    * @param vAlignment
98    * @throws java.lang.IndexOutOfBoundsException
99    *           if the index given is outside the bounds of the collection
100    */
101   public void addAlignment(final int index, final Alignment vAlignment)
102           throws java.lang.IndexOutOfBoundsException
103   {
104     this._alignmentList.add(index, vAlignment);
105   }
106
107   /**
108    * 
109    * 
110    * @param vSequenceSet
111    * @throws java.lang.IndexOutOfBoundsException
112    *           if the index given is outside the bounds of the collection
113    */
114   public void addSequenceSet(final SequenceSet vSequenceSet)
115           throws java.lang.IndexOutOfBoundsException
116   {
117     this._sequenceSetList.addElement(vSequenceSet);
118   }
119
120   /**
121    * 
122    * 
123    * @param index
124    * @param vSequenceSet
125    * @throws java.lang.IndexOutOfBoundsException
126    *           if the index given is outside the bounds of the collection
127    */
128   public void addSequenceSet(final int index,
129           final SequenceSet vSequenceSet)
130           throws java.lang.IndexOutOfBoundsException
131   {
132     this._sequenceSetList.add(index, vSequenceSet);
133   }
134
135   /**
136    * 
137    * 
138    * @param vTree
139    * @throws java.lang.IndexOutOfBoundsException
140    *           if the index given is outside the bounds of the collection
141    */
142   public void addTree(final java.lang.String vTree)
143           throws java.lang.IndexOutOfBoundsException
144   {
145     this._treeList.addElement(vTree);
146   }
147
148   /**
149    * 
150    * 
151    * @param index
152    * @param vTree
153    * @throws java.lang.IndexOutOfBoundsException
154    *           if the index given is outside the bounds of the collection
155    */
156   public void addTree(final int index, final java.lang.String vTree)
157           throws java.lang.IndexOutOfBoundsException
158   {
159     this._treeList.add(index, vTree);
160   }
161
162   /**
163    * Method enumerateAlignment.
164    * 
165    * @return an Enumeration over all Alignment elements
166    */
167   public java.util.Enumeration enumerateAlignment()
168   {
169     return this._alignmentList.elements();
170   }
171
172   /**
173    * Method enumerateSequenceSet.
174    * 
175    * @return an Enumeration over all SequenceSet elements
176    */
177   public java.util.Enumeration enumerateSequenceSet()
178   {
179     return this._sequenceSetList.elements();
180   }
181
182   /**
183    * Method enumerateTree.
184    * 
185    * @return an Enumeration over all java.lang.String elements
186    */
187   public java.util.Enumeration enumerateTree()
188   {
189     return this._treeList.elements();
190   }
191
192   /**
193    * Method getAlignment.
194    * 
195    * @param index
196    * @throws java.lang.IndexOutOfBoundsException
197    *           if the index given is outside the bounds of the collection
198    * @return the value of the Alignment at the given index
199    */
200   public Alignment getAlignment(final int index)
201           throws java.lang.IndexOutOfBoundsException
202   {
203     // check bounds for index
204     if (index < 0 || index >= this._alignmentList.size())
205     {
206       throw new IndexOutOfBoundsException(
207               "getAlignment: Index value '" + index + "' not in range [0.."
208                       + (this._alignmentList.size() - 1) + "]");
209     }
210
211     return (Alignment) _alignmentList.get(index);
212   }
213
214   /**
215    * Method getAlignment.Returns the contents of the collection in an Array.
216    * <p>
217    * Note: Just in case the collection contents are changing in another thread,
218    * we pass a 0-length Array of the correct type into the API call. This way we
219    * <i>know</i> that the Array returned is of exactly the correct length.
220    * 
221    * @return this collection as an Array
222    */
223   public Alignment[] getAlignment()
224   {
225     Alignment[] array = new Alignment[0];
226     return (Alignment[]) this._alignmentList.toArray(array);
227   }
228
229   /**
230    * Method getAlignmentCount.
231    * 
232    * @return the size of this collection
233    */
234   public int getAlignmentCount()
235   {
236     return this._alignmentList.size();
237   }
238
239   /**
240    * Method getSequenceSet.
241    * 
242    * @param index
243    * @throws java.lang.IndexOutOfBoundsException
244    *           if the index given is outside the bounds of the collection
245    * @return the value of the SequenceSet at the given index
246    */
247   public SequenceSet getSequenceSet(final int index)
248           throws java.lang.IndexOutOfBoundsException
249   {
250     // check bounds for index
251     if (index < 0 || index >= this._sequenceSetList.size())
252     {
253       throw new IndexOutOfBoundsException("getSequenceSet: Index value '"
254               + index + "' not in range [0.."
255               + (this._sequenceSetList.size() - 1) + "]");
256     }
257
258     return (SequenceSet) _sequenceSetList.get(index);
259   }
260
261   /**
262    * Method getSequenceSet.Returns the contents of the collection in an Array.
263    * <p>
264    * Note: Just in case the collection contents are changing in another thread,
265    * we pass a 0-length Array of the correct type into the API call. This way we
266    * <i>know</i> that the Array returned is of exactly the correct length.
267    * 
268    * @return this collection as an Array
269    */
270   public SequenceSet[] getSequenceSet()
271   {
272     SequenceSet[] array = new SequenceSet[0];
273     return (SequenceSet[]) this._sequenceSetList.toArray(array);
274   }
275
276   /**
277    * Method getSequenceSetCount.
278    * 
279    * @return the size of this collection
280    */
281   public int getSequenceSetCount()
282   {
283     return this._sequenceSetList.size();
284   }
285
286   /**
287    * Method getTree.
288    * 
289    * @param index
290    * @throws java.lang.IndexOutOfBoundsException
291    *           if the index given is outside the bounds of the collection
292    * @return the value of the java.lang.String at the given index
293    */
294   public java.lang.String getTree(final int index)
295           throws java.lang.IndexOutOfBoundsException
296   {
297     // check bounds for index
298     if (index < 0 || index >= this._treeList.size())
299     {
300       throw new IndexOutOfBoundsException("getTree: Index value '" + index
301               + "' not in range [0.." + (this._treeList.size() - 1) + "]");
302     }
303
304     return (java.lang.String) _treeList.get(index);
305   }
306
307   /**
308    * Method getTree.Returns the contents of the collection in an Array.
309    * <p>
310    * Note: Just in case the collection contents are changing in another thread,
311    * we pass a 0-length Array of the correct type into the API call. This way we
312    * <i>know</i> that the Array returned is of exactly the correct length.
313    * 
314    * @return this collection as an Array
315    */
316   public java.lang.String[] getTree()
317   {
318     java.lang.String[] array = new java.lang.String[0];
319     return (java.lang.String[]) this._treeList.toArray(array);
320   }
321
322   /**
323    * Method getTreeCount.
324    * 
325    * @return the size of this collection
326    */
327   public int getTreeCount()
328   {
329     return this._treeList.size();
330   }
331
332   /**
333    * Method isValid.
334    * 
335    * @return true if this object is valid according to the schema
336    */
337   public boolean isValid()
338   {
339     try
340     {
341       validate();
342     } catch (org.exolab.castor.xml.ValidationException vex)
343     {
344       return false;
345     }
346     return true;
347   }
348
349   /**
350    * 
351    * 
352    * @param out
353    * @throws org.exolab.castor.xml.MarshalException
354    *           if object is null or if any SAXException is thrown during
355    *           marshaling
356    * @throws org.exolab.castor.xml.ValidationException
357    *           if this object is an invalid instance according to the schema
358    */
359   public void marshal(final java.io.Writer out)
360           throws org.exolab.castor.xml.MarshalException,
361           org.exolab.castor.xml.ValidationException
362   {
363     Marshaller.marshal(this, out);
364   }
365
366   /**
367    * 
368    * 
369    * @param handler
370    * @throws java.io.IOException
371    *           if an IOException occurs during marshaling
372    * @throws org.exolab.castor.xml.ValidationException
373    *           if this object is an invalid instance according to the schema
374    * @throws org.exolab.castor.xml.MarshalException
375    *           if object is null or if any SAXException is thrown during
376    *           marshaling
377    */
378   public void marshal(final org.xml.sax.ContentHandler handler)
379           throws java.io.IOException,
380           org.exolab.castor.xml.MarshalException,
381           org.exolab.castor.xml.ValidationException
382   {
383     Marshaller.marshal(this, handler);
384   }
385
386   /**
387    * Method removeAlignment.
388    * 
389    * @param vAlignment
390    * @return true if the object was removed from the collection.
391    */
392   public boolean removeAlignment(final Alignment vAlignment)
393   {
394     boolean removed = _alignmentList.remove(vAlignment);
395     return removed;
396   }
397
398   /**
399    * Method removeAlignmentAt.
400    * 
401    * @param index
402    * @return the element removed from the collection
403    */
404   public Alignment removeAlignmentAt(final int index)
405   {
406     java.lang.Object obj = this._alignmentList.remove(index);
407     return (Alignment) obj;
408   }
409
410   /**
411      */
412   public void removeAllAlignment()
413   {
414     this._alignmentList.clear();
415   }
416
417   /**
418      */
419   public void removeAllSequenceSet()
420   {
421     this._sequenceSetList.clear();
422   }
423
424   /**
425      */
426   public void removeAllTree()
427   {
428     this._treeList.clear();
429   }
430
431   /**
432    * Method removeSequenceSet.
433    * 
434    * @param vSequenceSet
435    * @return true if the object was removed from the collection.
436    */
437   public boolean removeSequenceSet(final SequenceSet vSequenceSet)
438   {
439     boolean removed = _sequenceSetList.remove(vSequenceSet);
440     return removed;
441   }
442
443   /**
444    * Method removeSequenceSetAt.
445    * 
446    * @param index
447    * @return the element removed from the collection
448    */
449   public SequenceSet removeSequenceSetAt(final int index)
450   {
451     java.lang.Object obj = this._sequenceSetList.remove(index);
452     return (SequenceSet) obj;
453   }
454
455   /**
456    * Method removeTree.
457    * 
458    * @param vTree
459    * @return true if the object was removed from the collection.
460    */
461   public boolean removeTree(final java.lang.String vTree)
462   {
463     boolean removed = _treeList.remove(vTree);
464     return removed;
465   }
466
467   /**
468    * Method removeTreeAt.
469    * 
470    * @param index
471    * @return the element removed from the collection
472    */
473   public java.lang.String removeTreeAt(final int index)
474   {
475     java.lang.Object obj = this._treeList.remove(index);
476     return (java.lang.String) obj;
477   }
478
479   /**
480    * 
481    * 
482    * @param index
483    * @param vAlignment
484    * @throws java.lang.IndexOutOfBoundsException
485    *           if the index given is outside the bounds of the collection
486    */
487   public void setAlignment(final int index, final Alignment vAlignment)
488           throws java.lang.IndexOutOfBoundsException
489   {
490     // check bounds for index
491     if (index < 0 || index >= this._alignmentList.size())
492     {
493       throw new IndexOutOfBoundsException(
494               "setAlignment: Index value '" + index + "' not in range [0.."
495                       + (this._alignmentList.size() - 1) + "]");
496     }
497
498     this._alignmentList.set(index, vAlignment);
499   }
500
501   /**
502    * 
503    * 
504    * @param vAlignmentArray
505    */
506   public void setAlignment(final Alignment[] vAlignmentArray)
507   {
508     // -- copy array
509     _alignmentList.clear();
510
511     for (int i = 0; i < vAlignmentArray.length; i++)
512     {
513       this._alignmentList.add(vAlignmentArray[i]);
514     }
515   }
516
517   /**
518    * 
519    * 
520    * @param index
521    * @param vSequenceSet
522    * @throws java.lang.IndexOutOfBoundsException
523    *           if the index given is outside the bounds of the collection
524    */
525   public void setSequenceSet(final int index,
526           final SequenceSet vSequenceSet)
527           throws java.lang.IndexOutOfBoundsException
528   {
529     // check bounds for index
530     if (index < 0 || index >= this._sequenceSetList.size())
531     {
532       throw new IndexOutOfBoundsException("setSequenceSet: Index value '"
533               + index + "' not in range [0.."
534               + (this._sequenceSetList.size() - 1) + "]");
535     }
536
537     this._sequenceSetList.set(index, vSequenceSet);
538   }
539
540   /**
541    * 
542    * 
543    * @param vSequenceSetArray
544    */
545   public void setSequenceSet(final SequenceSet[] vSequenceSetArray)
546   {
547     // -- copy array
548     _sequenceSetList.clear();
549
550     for (int i = 0; i < vSequenceSetArray.length; i++)
551     {
552       this._sequenceSetList.add(vSequenceSetArray[i]);
553     }
554   }
555
556   /**
557    * 
558    * 
559    * @param index
560    * @param vTree
561    * @throws java.lang.IndexOutOfBoundsException
562    *           if the index given is outside the bounds of the collection
563    */
564   public void setTree(final int index, final java.lang.String vTree)
565           throws java.lang.IndexOutOfBoundsException
566   {
567     // check bounds for index
568     if (index < 0 || index >= this._treeList.size())
569     {
570       throw new IndexOutOfBoundsException("setTree: Index value '" + index
571               + "' not in range [0.." + (this._treeList.size() - 1) + "]");
572     }
573
574     this._treeList.set(index, vTree);
575   }
576
577   /**
578    * 
579    * 
580    * @param vTreeArray
581    */
582   public void setTree(final java.lang.String[] vTreeArray)
583   {
584     // -- copy array
585     _treeList.clear();
586
587     for (int i = 0; i < vTreeArray.length; i++)
588     {
589       this._treeList.add(vTreeArray[i]);
590     }
591   }
592
593   /**
594    * Method unmarshal.
595    * 
596    * @param reader
597    * @throws org.exolab.castor.xml.MarshalException
598    *           if object is null or if any SAXException is thrown during
599    *           marshaling
600    * @throws org.exolab.castor.xml.ValidationException
601    *           if this object is an invalid instance according to the schema
602    * @return the unmarshaled jalview.binding.VAMSAS
603    */
604   public static jalview.binding.VAMSAS unmarshal(
605           final java.io.Reader reader)
606           throws org.exolab.castor.xml.MarshalException,
607           org.exolab.castor.xml.ValidationException
608   {
609     return (jalview.binding.VAMSAS) Unmarshaller
610             .unmarshal(jalview.binding.VAMSAS.class, reader);
611   }
612
613   /**
614    * 
615    * 
616    * @throws org.exolab.castor.xml.ValidationException
617    *           if this object is an invalid instance according to the schema
618    */
619   public void validate() throws org.exolab.castor.xml.ValidationException
620   {
621     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
622     validator.validate(this);
623   }
624
625 }