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