JAL-1620 version bump and release notes
[jalview.git] / src / jalview / schemabinding / version2 / AlcodonFrame.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 AlcodonFrame.
34  * 
35  * @version $Revision$ $Date$
36  */
37 public class AlcodonFrame implements java.io.Serializable
38 {
39
40   // --------------------------/
41   // - Class/Member Variables -/
42   // --------------------------/
43
44   /**
45    * Field _alcodonList.
46    */
47   private java.util.Vector _alcodonList;
48
49   /**
50    * Field _alcodMapList.
51    */
52   private java.util.Vector _alcodMapList;
53
54   // ----------------/
55   // - Constructors -/
56   // ----------------/
57
58   public AlcodonFrame()
59   {
60     super();
61     this._alcodonList = new java.util.Vector();
62     this._alcodMapList = new java.util.Vector();
63   }
64
65   // -----------/
66   // - Methods -/
67   // -----------/
68
69   /**
70    * 
71    * 
72    * @param vAlcodMap
73    * @throws java.lang.IndexOutOfBoundsException
74    *           if the index given is outside the bounds of the collection
75    */
76   public void addAlcodMap(
77           final jalview.schemabinding.version2.AlcodMap vAlcodMap)
78           throws java.lang.IndexOutOfBoundsException
79   {
80     this._alcodMapList.addElement(vAlcodMap);
81   }
82
83   /**
84    * 
85    * 
86    * @param index
87    * @param vAlcodMap
88    * @throws java.lang.IndexOutOfBoundsException
89    *           if the index given is outside the bounds of the collection
90    */
91   public void addAlcodMap(final int index,
92           final jalview.schemabinding.version2.AlcodMap vAlcodMap)
93           throws java.lang.IndexOutOfBoundsException
94   {
95     this._alcodMapList.add(index, vAlcodMap);
96   }
97
98   /**
99    * 
100    * 
101    * @param vAlcodon
102    * @throws java.lang.IndexOutOfBoundsException
103    *           if the index given is outside the bounds of the collection
104    */
105   public void addAlcodon(
106           final jalview.schemabinding.version2.Alcodon vAlcodon)
107           throws java.lang.IndexOutOfBoundsException
108   {
109     this._alcodonList.addElement(vAlcodon);
110   }
111
112   /**
113    * 
114    * 
115    * @param index
116    * @param vAlcodon
117    * @throws java.lang.IndexOutOfBoundsException
118    *           if the index given is outside the bounds of the collection
119    */
120   public void addAlcodon(final int index,
121           final jalview.schemabinding.version2.Alcodon vAlcodon)
122           throws java.lang.IndexOutOfBoundsException
123   {
124     this._alcodonList.add(index, vAlcodon);
125   }
126
127   /**
128    * Method enumerateAlcodMap.
129    * 
130    * @return an Enumeration over all jalview.schemabinding.version2.AlcodMap
131    *         elements
132    */
133   public java.util.Enumeration enumerateAlcodMap()
134   {
135     return this._alcodMapList.elements();
136   }
137
138   /**
139    * Method enumerateAlcodon.
140    * 
141    * @return an Enumeration over all jalview.schemabinding.version2.Alcodon
142    *         elements
143    */
144   public java.util.Enumeration enumerateAlcodon()
145   {
146     return this._alcodonList.elements();
147   }
148
149   /**
150    * Method getAlcodMap.
151    * 
152    * @param index
153    * @throws java.lang.IndexOutOfBoundsException
154    *           if the index given is outside the bounds of the collection
155    * @return the value of the jalview.schemabinding.version2.AlcodMap at the
156    *         given index
157    */
158   public jalview.schemabinding.version2.AlcodMap getAlcodMap(final int index)
159           throws java.lang.IndexOutOfBoundsException
160   {
161     // check bounds for index
162     if (index < 0 || index >= this._alcodMapList.size())
163     {
164         throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
165                   "getAlcodMap",
166                   Integer.valueOf(index).toString(),
167                   Integer.valueOf((this._alcodMapList.size() - 1)).toString()
168         })); 
169     }
170
171     return (jalview.schemabinding.version2.AlcodMap) _alcodMapList
172             .get(index);
173   }
174
175   /**
176    * Method getAlcodMap.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.AlcodMap[] getAlcodMap()
185   {
186     jalview.schemabinding.version2.AlcodMap[] array = new jalview.schemabinding.version2.AlcodMap[0];
187     return (jalview.schemabinding.version2.AlcodMap[]) this._alcodMapList
188             .toArray(array);
189   }
190
191   /**
192    * Method getAlcodMapCount.
193    * 
194    * @return the size of this collection
195    */
196   public int getAlcodMapCount()
197   {
198     return this._alcodMapList.size();
199   }
200
201   /**
202    * Method getAlcodon.
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 jalview.schemabinding.version2.Alcodon at the
208    *         given index
209    */
210   public jalview.schemabinding.version2.Alcodon getAlcodon(final int index)
211           throws java.lang.IndexOutOfBoundsException
212   {
213     // check bounds for index
214     if (index < 0 || index >= this._alcodonList.size())
215     {
216         throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
217                   "getAlcodon",
218                   Integer.valueOf(index).toString(),
219                   Integer.valueOf((this._alcodonList.size() - 1)).toString()
220         })); 
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(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
388                           "setAlcodMap",
389                           Integer.valueOf(index).toString(),
390                           Integer.valueOf((this._alcodonList.size() - 1)).toString()
391           })); 
392     }
393
394     this._alcodMapList.set(index, vAlcodMap);
395   }
396
397   /**
398    * 
399    * 
400    * @param vAlcodMapArray
401    */
402   public void setAlcodMap(
403           final jalview.schemabinding.version2.AlcodMap[] vAlcodMapArray)
404   {
405     // -- copy array
406     _alcodMapList.clear();
407
408     for (int i = 0; i < vAlcodMapArray.length; i++)
409     {
410       this._alcodMapList.add(vAlcodMapArray[i]);
411     }
412   }
413
414   /**
415    * 
416    * 
417    * @param index
418    * @param vAlcodon
419    * @throws java.lang.IndexOutOfBoundsException
420    *           if the index given is outside the bounds of the collection
421    */
422   public void setAlcodon(final int index,
423           final jalview.schemabinding.version2.Alcodon vAlcodon)
424           throws java.lang.IndexOutOfBoundsException
425   {
426     // check bounds for index
427     if (index < 0 || index >= this._alcodonList.size())
428     {
429         throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
430                   "setAlcodon",
431                   Integer.valueOf(index).toString(),
432                   Integer.valueOf((this._alcodonList.size() - 1)).toString()
433         })); 
434     }
435
436     this._alcodonList.set(index, vAlcodon);
437   }
438
439   /**
440    * 
441    * 
442    * @param vAlcodonArray
443    */
444   public void setAlcodon(
445           final jalview.schemabinding.version2.Alcodon[] vAlcodonArray)
446   {
447     // -- copy array
448     _alcodonList.clear();
449
450     for (int i = 0; i < vAlcodonArray.length; i++)
451     {
452       this._alcodonList.add(vAlcodonArray[i]);
453     }
454   }
455
456   /**
457    * Method unmarshal.
458    * 
459    * @param reader
460    * @throws org.exolab.castor.xml.MarshalException
461    *           if object is null or if any SAXException is thrown during
462    *           marshaling
463    * @throws org.exolab.castor.xml.ValidationException
464    *           if this object is an invalid instance according to the schema
465    * @return the unmarshaled jalview.schemabinding.version2.AlcodonFrame
466    */
467   public static jalview.schemabinding.version2.AlcodonFrame unmarshal(
468           final java.io.Reader reader)
469           throws org.exolab.castor.xml.MarshalException,
470           org.exolab.castor.xml.ValidationException
471   {
472     return (jalview.schemabinding.version2.AlcodonFrame) Unmarshaller
473             .unmarshal(jalview.schemabinding.version2.AlcodonFrame.class,
474                     reader);
475   }
476
477   /**
478    * 
479    * 
480    * @throws org.exolab.castor.xml.ValidationException
481    *           if this object is an invalid instance according to the schema
482    */
483   public void validate() throws org.exolab.castor.xml.ValidationException
484   {
485     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
486     validator.validate(this);
487   }
488
489 }