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