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