update author list in license for (JAL-826)
[jalview.git] / src / jalview / binding / 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.binding;
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       //----------------/
53      //- Constructors -/
54     //----------------/
55
56     public FeatureSettings() {
57         super();
58         this._settingList = new java.util.Vector();
59     }
60
61
62       //-----------/
63      //- Methods -/
64     //-----------/
65
66     /**
67      * 
68      * 
69      * @param vSetting
70      * @throws java.lang.IndexOutOfBoundsException if the index
71      * given is outside the bounds of the collection
72      */
73     public void addSetting(
74             final jalview.binding.Setting vSetting)
75     throws java.lang.IndexOutOfBoundsException {
76         this._settingList.addElement(vSetting);
77     }
78
79     /**
80      * 
81      * 
82      * @param index
83      * @param vSetting
84      * @throws java.lang.IndexOutOfBoundsException if the index
85      * given is outside the bounds of the collection
86      */
87     public void addSetting(
88             final int index,
89             final jalview.binding.Setting vSetting)
90     throws java.lang.IndexOutOfBoundsException {
91         this._settingList.add(index, vSetting);
92     }
93
94     /**
95      * Method enumerateSetting.
96      * 
97      * @return an Enumeration over all jalview.binding.Setting
98      * elements
99      */
100     public java.util.Enumeration enumerateSetting(
101     ) {
102         return this._settingList.elements();
103     }
104
105     /**
106      * Method getSetting.
107      * 
108      * @param index
109      * @throws java.lang.IndexOutOfBoundsException if the index
110      * given is outside the bounds of the collection
111      * @return the value of the jalview.binding.Setting at the
112      * given index
113      */
114     public jalview.binding.Setting getSetting(
115             final int index)
116     throws java.lang.IndexOutOfBoundsException {
117         // check bounds for index
118         if (index < 0 || index >= this._settingList.size()) {
119             throw new IndexOutOfBoundsException("getSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]");
120         }
121         
122         return (jalview.binding.Setting) _settingList.get(index);
123     }
124
125     /**
126      * Method getSetting.Returns the contents of the collection in
127      * an Array.  <p>Note:  Just in case the collection contents
128      * are changing in another thread, we pass a 0-length Array of
129      * the correct type into the API call.  This way we <i>know</i>
130      * that the Array returned is of exactly the correct length.
131      * 
132      * @return this collection as an Array
133      */
134     public jalview.binding.Setting[] getSetting(
135     ) {
136         jalview.binding.Setting[] array = new jalview.binding.Setting[0];
137         return (jalview.binding.Setting[]) this._settingList.toArray(array);
138     }
139
140     /**
141      * Method getSettingCount.
142      * 
143      * @return the size of this collection
144      */
145     public int getSettingCount(
146     ) {
147         return this._settingList.size();
148     }
149
150     /**
151      * Method isValid.
152      * 
153      * @return true if this object is valid according to the schema
154      */
155     public boolean isValid(
156     ) {
157         try {
158             validate();
159         } catch (org.exolab.castor.xml.ValidationException vex) {
160             return false;
161         }
162         return true;
163     }
164
165     /**
166      * 
167      * 
168      * @param out
169      * @throws org.exolab.castor.xml.MarshalException if object is
170      * null or if any SAXException is thrown during marshaling
171      * @throws org.exolab.castor.xml.ValidationException if this
172      * object is an invalid instance according to the schema
173      */
174     public void marshal(
175             final java.io.Writer out)
176     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
177         Marshaller.marshal(this, out);
178     }
179
180     /**
181      * 
182      * 
183      * @param handler
184      * @throws java.io.IOException if an IOException occurs during
185      * marshaling
186      * @throws org.exolab.castor.xml.ValidationException if this
187      * object is an invalid instance according to the schema
188      * @throws org.exolab.castor.xml.MarshalException if object is
189      * null or if any SAXException is thrown during marshaling
190      */
191     public void marshal(
192             final org.xml.sax.ContentHandler handler)
193     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
194         Marshaller.marshal(this, handler);
195     }
196
197     /**
198      */
199     public void removeAllSetting(
200     ) {
201         this._settingList.clear();
202     }
203
204     /**
205      * Method removeSetting.
206      * 
207      * @param vSetting
208      * @return true if the object was removed from the collection.
209      */
210     public boolean removeSetting(
211             final jalview.binding.Setting vSetting) {
212         boolean removed = _settingList.remove(vSetting);
213         return removed;
214     }
215
216     /**
217      * Method removeSettingAt.
218      * 
219      * @param index
220      * @return the element removed from the collection
221      */
222     public jalview.binding.Setting removeSettingAt(
223             final int index) {
224         java.lang.Object obj = this._settingList.remove(index);
225         return (jalview.binding.Setting) obj;
226     }
227
228     /**
229      * 
230      * 
231      * @param index
232      * @param vSetting
233      * @throws java.lang.IndexOutOfBoundsException if the index
234      * given is outside the bounds of the collection
235      */
236     public void setSetting(
237             final int index,
238             final jalview.binding.Setting vSetting)
239     throws java.lang.IndexOutOfBoundsException {
240         // check bounds for index
241         if (index < 0 || index >= this._settingList.size()) {
242             throw new IndexOutOfBoundsException("setSetting: Index value '" + index + "' not in range [0.." + (this._settingList.size() - 1) + "]");
243         }
244         
245         this._settingList.set(index, vSetting);
246     }
247
248     /**
249      * 
250      * 
251      * @param vSettingArray
252      */
253     public void setSetting(
254             final jalview.binding.Setting[] vSettingArray) {
255         //-- copy array
256         _settingList.clear();
257         
258         for (int i = 0; i < vSettingArray.length; i++) {
259                 this._settingList.add(vSettingArray[i]);
260         }
261     }
262
263     /**
264      * Method unmarshal.
265      * 
266      * @param reader
267      * @throws org.exolab.castor.xml.MarshalException if object is
268      * null or if any SAXException is thrown during marshaling
269      * @throws org.exolab.castor.xml.ValidationException if this
270      * object is an invalid instance according to the schema
271      * @return the unmarshaled jalview.binding.FeatureSettings
272      */
273     public static jalview.binding.FeatureSettings unmarshal(
274             final java.io.Reader reader)
275     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
276         return (jalview.binding.FeatureSettings) Unmarshaller.unmarshal(jalview.binding.FeatureSettings.class, reader);
277     }
278
279     /**
280      * 
281      * 
282      * @throws org.exolab.castor.xml.ValidationException if this
283      * object is an invalid instance according to the schema
284      */
285     public void validate(
286     )
287     throws org.exolab.castor.xml.ValidationException {
288         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
289         validator.validate(this);
290     }
291
292 }