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