Copyright test
[jalview.git] / src / jalview / schemabinding / version2 / 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.schemabinding.version2;
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 _treeList.
51    */
52   private java.util.Vector _treeList;
53
54   /**
55    * Field _sequenceSetList.
56    */
57   private java.util.Vector _sequenceSetList;
58
59   // ----------------/
60   // - Constructors -/
61   // ----------------/
62
63   public VAMSAS()
64   {
65     super();
66     this._treeList = new java.util.Vector();
67     this._sequenceSetList = new java.util.Vector();
68   }
69
70   // -----------/
71   // - Methods -/
72   // -----------/
73
74   /**
75    * 
76    * 
77    * @param vSequenceSet
78    * @throws java.lang.IndexOutOfBoundsException
79    *           if the index given is outside the bounds of the collection
80    */
81   public void addSequenceSet(
82           final jalview.schemabinding.version2.SequenceSet vSequenceSet)
83           throws java.lang.IndexOutOfBoundsException
84   {
85     this._sequenceSetList.addElement(vSequenceSet);
86   }
87
88   /**
89    * 
90    * 
91    * @param index
92    * @param vSequenceSet
93    * @throws java.lang.IndexOutOfBoundsException
94    *           if the index given is outside the bounds of the collection
95    */
96   public void addSequenceSet(final int index,
97           final jalview.schemabinding.version2.SequenceSet vSequenceSet)
98           throws java.lang.IndexOutOfBoundsException
99   {
100     this._sequenceSetList.add(index, vSequenceSet);
101   }
102
103   /**
104    * 
105    * 
106    * @param vTree
107    * @throws java.lang.IndexOutOfBoundsException
108    *           if the index given is outside the bounds of the collection
109    */
110   public void addTree(final java.lang.String vTree)
111           throws java.lang.IndexOutOfBoundsException
112   {
113     this._treeList.addElement(vTree);
114   }
115
116   /**
117    * 
118    * 
119    * @param index
120    * @param vTree
121    * @throws java.lang.IndexOutOfBoundsException
122    *           if the index given is outside the bounds of the collection
123    */
124   public void addTree(final int index, final java.lang.String vTree)
125           throws java.lang.IndexOutOfBoundsException
126   {
127     this._treeList.add(index, vTree);
128   }
129
130   /**
131    * Method enumerateSequenceSet.
132    * 
133    * @return an Enumeration over all jalview.schemabinding.version2.SequenceSet
134    *         elements
135    */
136   public java.util.Enumeration enumerateSequenceSet()
137   {
138     return this._sequenceSetList.elements();
139   }
140
141   /**
142    * Method enumerateTree.
143    * 
144    * @return an Enumeration over all java.lang.String elements
145    */
146   public java.util.Enumeration enumerateTree()
147   {
148     return this._treeList.elements();
149   }
150
151   /**
152    * Method getSequenceSet.
153    * 
154    * @param index
155    * @throws java.lang.IndexOutOfBoundsException
156    *           if the index given is outside the bounds of the collection
157    * @return the value of the jalview.schemabinding.version2.SequenceSet at the
158    *         given index
159    */
160   public jalview.schemabinding.version2.SequenceSet getSequenceSet(
161           final int index) throws java.lang.IndexOutOfBoundsException
162   {
163     // check bounds for index
164     if (index < 0 || index >= this._sequenceSetList.size())
165     {
166       throw new IndexOutOfBoundsException("getSequenceSet: Index value '"
167               + index + "' not in range [0.."
168               + (this._sequenceSetList.size() - 1) + "]");
169     }
170
171     return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList
172             .get(index);
173   }
174
175   /**
176    * Method getSequenceSet.Returns the contents of the collection in an Array.
177    * <p>
178    * Note: Just in case the collection contents are changing in another thread,
179    * we pass a 0-length Array of the correct type into the API call. This way we
180    * <i>know</i> that the Array returned is of exactly the correct length.
181    * 
182    * @return this collection as an Array
183    */
184   public jalview.schemabinding.version2.SequenceSet[] getSequenceSet()
185   {
186     jalview.schemabinding.version2.SequenceSet[] array = new jalview.schemabinding.version2.SequenceSet[0];
187     return (jalview.schemabinding.version2.SequenceSet[]) this._sequenceSetList
188             .toArray(array);
189   }
190
191   /**
192    * Method getSequenceSetCount.
193    * 
194    * @return the size of this collection
195    */
196   public int getSequenceSetCount()
197   {
198     return this._sequenceSetList.size();
199   }
200
201   /**
202    * Method getTree.
203    * 
204    * @param index
205    * @throws java.lang.IndexOutOfBoundsException
206    *           if the index given is outside the bounds of the collection
207    * @return the value of the java.lang.String at the given index
208    */
209   public java.lang.String getTree(final int index)
210           throws java.lang.IndexOutOfBoundsException
211   {
212     // check bounds for index
213     if (index < 0 || index >= this._treeList.size())
214     {
215       throw new IndexOutOfBoundsException("getTree: Index value '" + index
216               + "' not in range [0.." + (this._treeList.size() - 1) + "]");
217     }
218
219     return (java.lang.String) _treeList.get(index);
220   }
221
222   /**
223    * Method getTree.Returns the contents of the collection in an Array.
224    * <p>
225    * Note: Just in case the collection contents are changing in another thread,
226    * we pass a 0-length Array of the correct type into the API call. This way we
227    * <i>know</i> that the Array returned is of exactly the correct length.
228    * 
229    * @return this collection as an Array
230    */
231   public java.lang.String[] getTree()
232   {
233     java.lang.String[] array = new java.lang.String[0];
234     return (java.lang.String[]) this._treeList.toArray(array);
235   }
236
237   /**
238    * Method getTreeCount.
239    * 
240    * @return the size of this collection
241    */
242   public int getTreeCount()
243   {
244     return this._treeList.size();
245   }
246
247   /**
248    * Method isValid.
249    * 
250    * @return true if this object is valid according to the schema
251    */
252   public boolean isValid()
253   {
254     try
255     {
256       validate();
257     } catch (org.exolab.castor.xml.ValidationException vex)
258     {
259       return false;
260     }
261     return true;
262   }
263
264   /**
265    * 
266    * 
267    * @param out
268    * @throws org.exolab.castor.xml.MarshalException
269    *           if object is null or if any SAXException is thrown during
270    *           marshaling
271    * @throws org.exolab.castor.xml.ValidationException
272    *           if this object is an invalid instance according to the schema
273    */
274   public void marshal(final java.io.Writer out)
275           throws org.exolab.castor.xml.MarshalException,
276           org.exolab.castor.xml.ValidationException
277   {
278     Marshaller.marshal(this, out);
279   }
280
281   /**
282    * 
283    * 
284    * @param handler
285    * @throws java.io.IOException
286    *           if an IOException occurs during marshaling
287    * @throws org.exolab.castor.xml.ValidationException
288    *           if this object is an invalid instance according to the schema
289    * @throws org.exolab.castor.xml.MarshalException
290    *           if object is null or if any SAXException is thrown during
291    *           marshaling
292    */
293   public void marshal(final org.xml.sax.ContentHandler handler)
294           throws java.io.IOException,
295           org.exolab.castor.xml.MarshalException,
296           org.exolab.castor.xml.ValidationException
297   {
298     Marshaller.marshal(this, handler);
299   }
300
301   /**
302      */
303   public void removeAllSequenceSet()
304   {
305     this._sequenceSetList.clear();
306   }
307
308   /**
309      */
310   public void removeAllTree()
311   {
312     this._treeList.clear();
313   }
314
315   /**
316    * Method removeSequenceSet.
317    * 
318    * @param vSequenceSet
319    * @return true if the object was removed from the collection.
320    */
321   public boolean removeSequenceSet(
322           final jalview.schemabinding.version2.SequenceSet vSequenceSet)
323   {
324     boolean removed = _sequenceSetList.remove(vSequenceSet);
325     return removed;
326   }
327
328   /**
329    * Method removeSequenceSetAt.
330    * 
331    * @param index
332    * @return the element removed from the collection
333    */
334   public jalview.schemabinding.version2.SequenceSet removeSequenceSetAt(
335           final int index)
336   {
337     java.lang.Object obj = this._sequenceSetList.remove(index);
338     return (jalview.schemabinding.version2.SequenceSet) obj;
339   }
340
341   /**
342    * Method removeTree.
343    * 
344    * @param vTree
345    * @return true if the object was removed from the collection.
346    */
347   public boolean removeTree(final java.lang.String vTree)
348   {
349     boolean removed = _treeList.remove(vTree);
350     return removed;
351   }
352
353   /**
354    * Method removeTreeAt.
355    * 
356    * @param index
357    * @return the element removed from the collection
358    */
359   public java.lang.String removeTreeAt(final int index)
360   {
361     java.lang.Object obj = this._treeList.remove(index);
362     return (java.lang.String) obj;
363   }
364
365   /**
366    * 
367    * 
368    * @param index
369    * @param vSequenceSet
370    * @throws java.lang.IndexOutOfBoundsException
371    *           if the index given is outside the bounds of the collection
372    */
373   public void setSequenceSet(final int index,
374           final jalview.schemabinding.version2.SequenceSet vSequenceSet)
375           throws java.lang.IndexOutOfBoundsException
376   {
377     // check bounds for index
378     if (index < 0 || index >= this._sequenceSetList.size())
379     {
380       throw new IndexOutOfBoundsException("setSequenceSet: Index value '"
381               + index + "' not in range [0.."
382               + (this._sequenceSetList.size() - 1) + "]");
383     }
384
385     this._sequenceSetList.set(index, vSequenceSet);
386   }
387
388   /**
389    * 
390    * 
391    * @param vSequenceSetArray
392    */
393   public void setSequenceSet(
394           final jalview.schemabinding.version2.SequenceSet[] vSequenceSetArray)
395   {
396     // -- copy array
397     _sequenceSetList.clear();
398
399     for (int i = 0; i < vSequenceSetArray.length; i++)
400     {
401       this._sequenceSetList.add(vSequenceSetArray[i]);
402     }
403   }
404
405   /**
406    * 
407    * 
408    * @param index
409    * @param vTree
410    * @throws java.lang.IndexOutOfBoundsException
411    *           if the index given is outside the bounds of the collection
412    */
413   public void setTree(final int index, final java.lang.String vTree)
414           throws java.lang.IndexOutOfBoundsException
415   {
416     // check bounds for index
417     if (index < 0 || index >= this._treeList.size())
418     {
419       throw new IndexOutOfBoundsException("setTree: Index value '" + index
420               + "' not in range [0.." + (this._treeList.size() - 1) + "]");
421     }
422
423     this._treeList.set(index, vTree);
424   }
425
426   /**
427    * 
428    * 
429    * @param vTreeArray
430    */
431   public void setTree(final java.lang.String[] vTreeArray)
432   {
433     // -- copy array
434     _treeList.clear();
435
436     for (int i = 0; i < vTreeArray.length; i++)
437     {
438       this._treeList.add(vTreeArray[i]);
439     }
440   }
441
442   /**
443    * Method unmarshal.
444    * 
445    * @param reader
446    * @throws org.exolab.castor.xml.MarshalException
447    *           if object is null or if any SAXException is thrown during
448    *           marshaling
449    * @throws org.exolab.castor.xml.ValidationException
450    *           if this object is an invalid instance according to the schema
451    * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
452    */
453   public static jalview.schemabinding.version2.VAMSAS unmarshal(
454           final java.io.Reader reader)
455           throws org.exolab.castor.xml.MarshalException,
456           org.exolab.castor.xml.ValidationException
457   {
458     return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(
459             jalview.schemabinding.version2.VAMSAS.class, reader);
460   }
461
462   /**
463    * 
464    * 
465    * @throws org.exolab.castor.xml.ValidationException
466    *           if this object is an invalid instance according to the schema
467    */
468   public void validate() throws org.exolab.castor.xml.ValidationException
469   {
470     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
471     validator.validate(this);
472   }
473
474 }