1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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.
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.
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 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
35 * Class FeatureSettings.
37 * @version $Revision$ $Date$
39 public class FeatureSettings implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
49 private java.util.Vector _settingList;
54 private java.util.Vector _groupList;
61 public FeatureSettings() {
63 this._settingList = new java.util.Vector();
64 this._groupList = new java.util.Vector();
76 * @throws java.lang.IndexOutOfBoundsException if the index
77 * given is outside the bounds of the collection
80 final jalview.schemabinding.version2.Group vGroup)
81 throws java.lang.IndexOutOfBoundsException {
82 this._groupList.addElement(vGroup);
90 * @throws java.lang.IndexOutOfBoundsException if the index
91 * given is outside the bounds of the collection
95 final jalview.schemabinding.version2.Group vGroup)
96 throws java.lang.IndexOutOfBoundsException {
97 this._groupList.add(index, vGroup);
104 * @throws java.lang.IndexOutOfBoundsException if the index
105 * given is outside the bounds of the collection
107 public void addSetting(
108 final jalview.schemabinding.version2.Setting vSetting)
109 throws java.lang.IndexOutOfBoundsException {
110 this._settingList.addElement(vSetting);
118 * @throws java.lang.IndexOutOfBoundsException if the index
119 * given is outside the bounds of the collection
121 public void addSetting(
123 final jalview.schemabinding.version2.Setting vSetting)
124 throws java.lang.IndexOutOfBoundsException {
125 this._settingList.add(index, vSetting);
129 * Method enumerateGroup.
131 * @return an Enumeration over all
132 * jalview.schemabinding.version2.Group elements
134 public java.util.Enumeration enumerateGroup(
136 return this._groupList.elements();
140 * Method enumerateSetting.
142 * @return an Enumeration over all
143 * jalview.schemabinding.version2.Setting elements
145 public java.util.Enumeration enumerateSetting(
147 return this._settingList.elements();
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
159 public jalview.schemabinding.version2.Group getGroup(
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) + "]");
167 return (jalview.schemabinding.version2.Group) _groupList.get(index);
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.
177 * @return this collection as an Array
179 public jalview.schemabinding.version2.Group[] getGroup(
181 jalview.schemabinding.version2.Group[] array = new jalview.schemabinding.version2.Group[0];
182 return (jalview.schemabinding.version2.Group[]) this._groupList.toArray(array);
186 * Method getGroupCount.
188 * @return the size of this collection
190 public int getGroupCount(
192 return this._groupList.size();
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
204 public jalview.schemabinding.version2.Setting getSetting(
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) + "]");
212 return (jalview.schemabinding.version2.Setting) _settingList.get(index);
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.
222 * @return this collection as an Array
224 public jalview.schemabinding.version2.Setting[] getSetting(
226 jalview.schemabinding.version2.Setting[] array = new jalview.schemabinding.version2.Setting[0];
227 return (jalview.schemabinding.version2.Setting[]) this._settingList.toArray(array);
231 * Method getSettingCount.
233 * @return the size of this collection
235 public int getSettingCount(
237 return this._settingList.size();
243 * @return true if this object is valid according to the schema
245 public boolean isValid(
249 } catch (org.exolab.castor.xml.ValidationException vex) {
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
265 final java.io.Writer out)
266 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
267 Marshaller.marshal(this, out);
274 * @throws java.io.IOException if an IOException occurs during
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
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);
289 public void removeAllGroup(
291 this._groupList.clear();
296 public void removeAllSetting(
298 this._settingList.clear();
302 * Method removeGroup.
305 * @return true if the object was removed from the collection.
307 public boolean removeGroup(
308 final jalview.schemabinding.version2.Group vGroup) {
309 boolean removed = _groupList.remove(vGroup);
314 * Method removeGroupAt.
317 * @return the element removed from the collection
319 public jalview.schemabinding.version2.Group removeGroupAt(
321 java.lang.Object obj = this._groupList.remove(index);
322 return (jalview.schemabinding.version2.Group) obj;
326 * Method removeSetting.
329 * @return true if the object was removed from the collection.
331 public boolean removeSetting(
332 final jalview.schemabinding.version2.Setting vSetting) {
333 boolean removed = _settingList.remove(vSetting);
338 * Method removeSettingAt.
341 * @return the element removed from the collection
343 public jalview.schemabinding.version2.Setting removeSettingAt(
345 java.lang.Object obj = this._settingList.remove(index);
346 return (jalview.schemabinding.version2.Setting) obj;
354 * @throws java.lang.IndexOutOfBoundsException if the index
355 * given is outside the bounds of the collection
357 public void setGroup(
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) + "]");
366 this._groupList.set(index, vGroup);
374 public void setGroup(
375 final jalview.schemabinding.version2.Group[] vGroupArray) {
379 for (int i = 0; i < vGroupArray.length; i++) {
380 this._groupList.add(vGroupArray[i]);
389 * @throws java.lang.IndexOutOfBoundsException if the index
390 * given is outside the bounds of the collection
392 public void setSetting(
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) + "]");
401 this._settingList.set(index, vSetting);
407 * @param vSettingArray
409 public void setSetting(
410 final jalview.schemabinding.version2.Setting[] vSettingArray) {
412 _settingList.clear();
414 for (int i = 0; i < vSettingArray.length; i++) {
415 this._settingList.add(vSettingArray[i]);
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
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);
439 * @throws org.exolab.castor.xml.ValidationException if this
440 * object is an invalid instance according to the schema
442 public void validate(
444 throws org.exolab.castor.xml.ValidationException {
445 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
446 validator.validate(this);