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