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