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