1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 The Jalview Authors
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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import org.exolab.castor.xml.Marshaller;
34 import org.exolab.castor.xml.Unmarshaller;
37 * Class FeatureSettings.
39 * @version $Revision$ $Date$
41 public class FeatureSettings implements java.io.Serializable
44 // --------------------------/
45 // - Class/Member Variables -/
46 // --------------------------/
51 private java.util.Vector _settingList;
56 private java.util.Vector _groupList;
62 public FeatureSettings()
65 this._settingList = new java.util.Vector();
66 this._groupList = new java.util.Vector();
77 * @throws java.lang.IndexOutOfBoundsException
78 * if the index given is outside the bounds of the collection
80 public void addGroup(final jalview.schemabinding.version2.Group vGroup)
81 throws java.lang.IndexOutOfBoundsException
83 this._groupList.addElement(vGroup);
91 * @throws java.lang.IndexOutOfBoundsException
92 * if the index given is outside the bounds of the collection
94 public void addGroup(final int index,
95 final jalview.schemabinding.version2.Group vGroup)
96 throws java.lang.IndexOutOfBoundsException
98 this._groupList.add(index, vGroup);
105 * @throws java.lang.IndexOutOfBoundsException
106 * if the index given is outside the bounds of the collection
108 public void addSetting(
109 final jalview.schemabinding.version2.Setting vSetting)
110 throws java.lang.IndexOutOfBoundsException
112 this._settingList.addElement(vSetting);
120 * @throws java.lang.IndexOutOfBoundsException
121 * if the index given is outside the bounds of the collection
123 public void addSetting(final int index,
124 final jalview.schemabinding.version2.Setting vSetting)
125 throws java.lang.IndexOutOfBoundsException
127 this._settingList.add(index, vSetting);
131 * Method enumerateGroup.
133 * @return an Enumeration over all jalview.schemabinding.version2.Group
136 public java.util.Enumeration enumerateGroup()
138 return this._groupList.elements();
142 * Method enumerateSetting.
144 * @return an Enumeration over all jalview.schemabinding.version2.Setting
147 public java.util.Enumeration enumerateSetting()
149 return this._settingList.elements();
156 * @throws java.lang.IndexOutOfBoundsException
157 * if the index given is outside the bounds of the collection
158 * @return the value of the jalview.schemabinding.version2.Group at the given
161 public jalview.schemabinding.version2.Group getGroup(final int index)
162 throws java.lang.IndexOutOfBoundsException
164 // check bounds for index
165 if (index < 0 || index >= this._groupList.size())
167 throw new IndexOutOfBoundsException("getGroup: Index value '" + index
168 + "' not in range [0.." + (this._groupList.size() - 1) + "]");
171 return (jalview.schemabinding.version2.Group) _groupList.get(index);
175 * Method getGroup.Returns the contents of the collection in an Array.
177 * Note: Just in case the collection contents are changing in another thread,
178 * we pass a 0-length Array of the correct type into the API call. This way we
179 * <i>know</i> that the Array returned is of exactly the correct length.
181 * @return this collection as an Array
183 public jalview.schemabinding.version2.Group[] getGroup()
185 jalview.schemabinding.version2.Group[] array = new jalview.schemabinding.version2.Group[0];
186 return (jalview.schemabinding.version2.Group[]) this._groupList
191 * Method getGroupCount.
193 * @return the size of this collection
195 public int getGroupCount()
197 return this._groupList.size();
204 * @throws java.lang.IndexOutOfBoundsException
205 * if the index given is outside the bounds of the collection
206 * @return the value of the jalview.schemabinding.version2.Setting at the
209 public jalview.schemabinding.version2.Setting getSetting(final int index)
210 throws java.lang.IndexOutOfBoundsException
212 // check bounds for index
213 if (index < 0 || index >= this._settingList.size())
215 throw new IndexOutOfBoundsException("getSetting: Index value '"
216 + index + "' not in range [0.."
217 + (this._settingList.size() - 1) + "]");
220 return (jalview.schemabinding.version2.Setting) _settingList.get(index);
224 * Method getSetting.Returns the contents of the collection in an Array.
226 * Note: Just in case the collection contents are changing in another thread,
227 * we pass a 0-length Array of the correct type into the API call. This way we
228 * <i>know</i> that the Array returned is of exactly the correct length.
230 * @return this collection as an Array
232 public jalview.schemabinding.version2.Setting[] getSetting()
234 jalview.schemabinding.version2.Setting[] array = new jalview.schemabinding.version2.Setting[0];
235 return (jalview.schemabinding.version2.Setting[]) this._settingList
240 * Method getSettingCount.
242 * @return the size of this collection
244 public int getSettingCount()
246 return this._settingList.size();
252 * @return true if this object is valid according to the schema
254 public boolean isValid()
259 } catch (org.exolab.castor.xml.ValidationException vex)
270 * @throws org.exolab.castor.xml.MarshalException
271 * if object is null or if any SAXException is thrown during
273 * @throws org.exolab.castor.xml.ValidationException
274 * if this object is an invalid instance according to the schema
276 public void marshal(final java.io.Writer out)
277 throws org.exolab.castor.xml.MarshalException,
278 org.exolab.castor.xml.ValidationException
280 Marshaller.marshal(this, out);
287 * @throws java.io.IOException
288 * if an IOException occurs during marshaling
289 * @throws org.exolab.castor.xml.ValidationException
290 * if this object is an invalid instance according to the schema
291 * @throws org.exolab.castor.xml.MarshalException
292 * if object is null or if any SAXException is thrown during
295 public void marshal(final org.xml.sax.ContentHandler handler)
296 throws java.io.IOException,
297 org.exolab.castor.xml.MarshalException,
298 org.exolab.castor.xml.ValidationException
300 Marshaller.marshal(this, handler);
305 public void removeAllGroup()
307 this._groupList.clear();
312 public void removeAllSetting()
314 this._settingList.clear();
318 * Method removeGroup.
321 * @return true if the object was removed from the collection.
323 public boolean removeGroup(
324 final jalview.schemabinding.version2.Group vGroup)
326 boolean removed = _groupList.remove(vGroup);
331 * Method removeGroupAt.
334 * @return the element removed from the collection
336 public jalview.schemabinding.version2.Group removeGroupAt(final int index)
338 java.lang.Object obj = this._groupList.remove(index);
339 return (jalview.schemabinding.version2.Group) obj;
343 * Method removeSetting.
346 * @return true if the object was removed from the collection.
348 public boolean removeSetting(
349 final jalview.schemabinding.version2.Setting vSetting)
351 boolean removed = _settingList.remove(vSetting);
356 * Method removeSettingAt.
359 * @return the element removed from the collection
361 public jalview.schemabinding.version2.Setting removeSettingAt(
364 java.lang.Object obj = this._settingList.remove(index);
365 return (jalview.schemabinding.version2.Setting) obj;
373 * @throws java.lang.IndexOutOfBoundsException
374 * if the index given is outside the bounds of the collection
376 public void setGroup(final int index,
377 final jalview.schemabinding.version2.Group vGroup)
378 throws java.lang.IndexOutOfBoundsException
380 // check bounds for index
381 if (index < 0 || index >= this._groupList.size())
383 throw new IndexOutOfBoundsException("setGroup: Index value '" + index
384 + "' not in range [0.." + (this._groupList.size() - 1) + "]");
387 this._groupList.set(index, vGroup);
395 public void setGroup(
396 final jalview.schemabinding.version2.Group[] vGroupArray)
401 for (int i = 0; i < vGroupArray.length; i++)
403 this._groupList.add(vGroupArray[i]);
412 * @throws java.lang.IndexOutOfBoundsException
413 * if the index given is outside the bounds of the collection
415 public void setSetting(final int index,
416 final jalview.schemabinding.version2.Setting vSetting)
417 throws java.lang.IndexOutOfBoundsException
419 // check bounds for index
420 if (index < 0 || index >= this._settingList.size())
422 throw new IndexOutOfBoundsException("setSetting: Index value '"
423 + index + "' not in range [0.."
424 + (this._settingList.size() - 1) + "]");
427 this._settingList.set(index, vSetting);
433 * @param vSettingArray
435 public void setSetting(
436 final jalview.schemabinding.version2.Setting[] vSettingArray)
439 _settingList.clear();
441 for (int i = 0; i < vSettingArray.length; i++)
443 this._settingList.add(vSettingArray[i]);
451 * @throws org.exolab.castor.xml.MarshalException
452 * if object is null or if any SAXException is thrown during
454 * @throws org.exolab.castor.xml.ValidationException
455 * if this object is an invalid instance according to the schema
456 * @return the unmarshaled jalview.schemabinding.version2.FeatureSettings
458 public static jalview.schemabinding.version2.FeatureSettings unmarshal(
459 final java.io.Reader reader)
460 throws org.exolab.castor.xml.MarshalException,
461 org.exolab.castor.xml.ValidationException
463 return (jalview.schemabinding.version2.FeatureSettings) Unmarshaller
465 jalview.schemabinding.version2.FeatureSettings.class,
472 * @throws org.exolab.castor.xml.ValidationException
473 * if this object is an invalid instance according to the schema
475 public void validate() throws org.exolab.castor.xml.ValidationException
477 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
478 validator.validate(this);