JAL-1620 version bump and release notes
[jalview.git] / src / jalview / schemabinding / version2 / VAMSAS.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1)
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
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 package jalview.schemabinding.version2;
22
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
26
27 import jalview.util.MessageManager;
28
29 import org.exolab.castor.xml.Marshaller;
30 import org.exolab.castor.xml.Unmarshaller;
31
32 /**
33  * Class VAMSAS.
34  * 
35  * @version $Revision$ $Date$
36  */
37 public class VAMSAS implements java.io.Serializable
38 {
39
40   // --------------------------/
41   // - Class/Member Variables -/
42   // --------------------------/
43
44   /**
45    * Field _treeList.
46    */
47   private java.util.Vector _treeList;
48
49   /**
50    * Field _sequenceSetList.
51    */
52   private java.util.Vector _sequenceSetList;
53
54   // ----------------/
55   // - Constructors -/
56   // ----------------/
57
58   public VAMSAS()
59   {
60     super();
61     this._treeList = new java.util.Vector();
62     this._sequenceSetList = new java.util.Vector();
63   }
64
65   // -----------/
66   // - Methods -/
67   // -----------/
68
69   /**
70    * 
71    * 
72    * @param vSequenceSet
73    * @throws java.lang.IndexOutOfBoundsException
74    *           if the index given is outside the bounds of the collection
75    */
76   public void addSequenceSet(
77           final jalview.schemabinding.version2.SequenceSet vSequenceSet)
78           throws java.lang.IndexOutOfBoundsException
79   {
80     this._sequenceSetList.addElement(vSequenceSet);
81   }
82
83   /**
84    * 
85    * 
86    * @param index
87    * @param vSequenceSet
88    * @throws java.lang.IndexOutOfBoundsException
89    *           if the index given is outside the bounds of the collection
90    */
91   public void addSequenceSet(final int index,
92           final jalview.schemabinding.version2.SequenceSet vSequenceSet)
93           throws java.lang.IndexOutOfBoundsException
94   {
95     this._sequenceSetList.add(index, vSequenceSet);
96   }
97
98   /**
99    * 
100    * 
101    * @param vTree
102    * @throws java.lang.IndexOutOfBoundsException
103    *           if the index given is outside the bounds of the collection
104    */
105   public void addTree(final java.lang.String vTree)
106           throws java.lang.IndexOutOfBoundsException
107   {
108     this._treeList.addElement(vTree);
109   }
110
111   /**
112    * 
113    * 
114    * @param index
115    * @param vTree
116    * @throws java.lang.IndexOutOfBoundsException
117    *           if the index given is outside the bounds of the collection
118    */
119   public void addTree(final int index, final java.lang.String vTree)
120           throws java.lang.IndexOutOfBoundsException
121   {
122     this._treeList.add(index, vTree);
123   }
124
125   /**
126    * Method enumerateSequenceSet.
127    * 
128    * @return an Enumeration over all jalview.schemabinding.version2.SequenceSet
129    *         elements
130    */
131   public java.util.Enumeration enumerateSequenceSet()
132   {
133     return this._sequenceSetList.elements();
134   }
135
136   /**
137    * Method enumerateTree.
138    * 
139    * @return an Enumeration over all java.lang.String elements
140    */
141   public java.util.Enumeration enumerateTree()
142   {
143     return this._treeList.elements();
144   }
145
146   /**
147    * Method getSequenceSet.
148    * 
149    * @param index
150    * @throws java.lang.IndexOutOfBoundsException
151    *           if the index given is outside the bounds of the collection
152    * @return the value of the jalview.schemabinding.version2.SequenceSet at the
153    *         given index
154    */
155   public jalview.schemabinding.version2.SequenceSet getSequenceSet(
156           final int index) throws java.lang.IndexOutOfBoundsException
157   {
158     // check bounds for index
159     if (index < 0 || index >= this._sequenceSetList.size())
160     {
161         throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
162                           "getSequenceSet",
163                           Integer.valueOf(index).toString(),
164                           Integer.valueOf((this._sequenceSetList.size() - 1)).toString()
165           })); 
166     }
167
168     return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList
169             .get(index);
170   }
171
172   /**
173    * Method getSequenceSet.Returns the contents of the collection in an Array.
174    * <p>
175    * Note: Just in case the collection contents are changing in another thread,
176    * we pass a 0-length Array of the correct type into the API call. This way we
177    * <i>know</i> that the Array returned is of exactly the correct length.
178    * 
179    * @return this collection as an Array
180    */
181   public jalview.schemabinding.version2.SequenceSet[] getSequenceSet()
182   {
183     jalview.schemabinding.version2.SequenceSet[] array = new jalview.schemabinding.version2.SequenceSet[0];
184     return (jalview.schemabinding.version2.SequenceSet[]) this._sequenceSetList
185             .toArray(array);
186   }
187
188   /**
189    * Method getSequenceSetCount.
190    * 
191    * @return the size of this collection
192    */
193   public int getSequenceSetCount()
194   {
195     return this._sequenceSetList.size();
196   }
197
198   /**
199    * Method getTree.
200    * 
201    * @param index
202    * @throws java.lang.IndexOutOfBoundsException
203    *           if the index given is outside the bounds of the collection
204    * @return the value of the java.lang.String at the given index
205    */
206   public java.lang.String getTree(final int index)
207           throws java.lang.IndexOutOfBoundsException
208   {
209     // check bounds for index
210     if (index < 0 || index >= this._treeList.size())
211     {
212         throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
213                   "getTree",
214                   Integer.valueOf(index).toString(),
215                   Integer.valueOf((this._treeList.size() - 1)).toString()
216         })); 
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(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
381                           "setSequenceSet",
382                           Integer.valueOf(index).toString(),
383                           Integer.valueOf((this._sequenceSetList.size() - 1)).toString()
384           })); 
385     }
386
387     this._sequenceSetList.set(index, vSequenceSet);
388   }
389
390   /**
391    * 
392    * 
393    * @param vSequenceSetArray
394    */
395   public void setSequenceSet(
396           final jalview.schemabinding.version2.SequenceSet[] vSequenceSetArray)
397   {
398     // -- copy array
399     _sequenceSetList.clear();
400
401     for (int i = 0; i < vSequenceSetArray.length; i++)
402     {
403       this._sequenceSetList.add(vSequenceSetArray[i]);
404     }
405   }
406
407   /**
408    * 
409    * 
410    * @param index
411    * @param vTree
412    * @throws java.lang.IndexOutOfBoundsException
413    *           if the index given is outside the bounds of the collection
414    */
415   public void setTree(final int index, final java.lang.String vTree)
416           throws java.lang.IndexOutOfBoundsException
417   {
418     // check bounds for index
419     if (index < 0 || index >= this._treeList.size())
420     {
421         throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
422                   "setTree",
423                   Integer.valueOf(index).toString(),
424                   Integer.valueOf((this._treeList.size() - 1)).toString()
425         })); 
426     }
427
428     this._treeList.set(index, vTree);
429   }
430
431   /**
432    * 
433    * 
434    * @param vTreeArray
435    */
436   public void setTree(final java.lang.String[] vTreeArray)
437   {
438     // -- copy array
439     _treeList.clear();
440
441     for (int i = 0; i < vTreeArray.length; i++)
442     {
443       this._treeList.add(vTreeArray[i]);
444     }
445   }
446
447   /**
448    * Method unmarshal.
449    * 
450    * @param reader
451    * @throws org.exolab.castor.xml.MarshalException
452    *           if object is null or if any SAXException is thrown during
453    *           marshaling
454    * @throws org.exolab.castor.xml.ValidationException
455    *           if this object is an invalid instance according to the schema
456    * @return the unmarshaled jalview.schemabinding.version2.VAMSAS
457    */
458   public static jalview.schemabinding.version2.VAMSAS unmarshal(
459           final java.io.Reader reader)
460           throws org.exolab.castor.xml.MarshalException,
461           org.exolab.castor.xml.ValidationException
462   {
463     return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(
464             jalview.schemabinding.version2.VAMSAS.class, reader);
465   }
466
467   /**
468    * 
469    * 
470    * @throws org.exolab.castor.xml.ValidationException
471    *           if this object is an invalid instance according to the schema
472    */
473   public void validate() throws org.exolab.castor.xml.ValidationException
474   {
475     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
476     validator.validate(this);
477   }
478
479 }