1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $(date) 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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
20 *******************************************************************************/
22 * This class was automatically generated with
23 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
28 package jalview.schemabinding.version2;
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
38 * Class FeatureSettings.
40 * @version $Revision$ $Date$
42 public class FeatureSettings implements java.io.Serializable
45 // --------------------------/
46 // - Class/Member Variables -/
47 // --------------------------/
52 private java.util.Vector _settingList;
57 private java.util.Vector _groupList;
63 public FeatureSettings()
66 this._settingList = new java.util.Vector();
67 this._groupList = new java.util.Vector();
78 * @throws java.lang.IndexOutOfBoundsException
79 * if the index given is outside the bounds of the collection
81 public void addGroup(final jalview.schemabinding.version2.Group vGroup)
82 throws java.lang.IndexOutOfBoundsException
84 this._groupList.addElement(vGroup);
92 * @throws java.lang.IndexOutOfBoundsException
93 * if the index given is outside the bounds of the collection
95 public void addGroup(final int index,
96 final jalview.schemabinding.version2.Group vGroup)
97 throws java.lang.IndexOutOfBoundsException
99 this._groupList.add(index, vGroup);
106 * @throws java.lang.IndexOutOfBoundsException
107 * if the index given is outside the bounds of the collection
109 public void addSetting(
110 final jalview.schemabinding.version2.Setting vSetting)
111 throws java.lang.IndexOutOfBoundsException
113 this._settingList.addElement(vSetting);
121 * @throws java.lang.IndexOutOfBoundsException
122 * if the index given is outside the bounds of the collection
124 public void addSetting(final int index,
125 final jalview.schemabinding.version2.Setting vSetting)
126 throws java.lang.IndexOutOfBoundsException
128 this._settingList.add(index, vSetting);
132 * Method enumerateGroup.
134 * @return an Enumeration over all jalview.schemabinding.version2.Group
137 public java.util.Enumeration enumerateGroup()
139 return this._groupList.elements();
143 * Method enumerateSetting.
145 * @return an Enumeration over all jalview.schemabinding.version2.Setting
148 public java.util.Enumeration enumerateSetting()
150 return this._settingList.elements();
157 * @throws java.lang.IndexOutOfBoundsException
158 * if the index given is outside the bounds of the collection
159 * @return the value of the jalview.schemabinding.version2.Group at the given
162 public jalview.schemabinding.version2.Group getGroup(final int index)
163 throws java.lang.IndexOutOfBoundsException
165 // check bounds for index
166 if (index < 0 || index >= this._groupList.size())
168 throw new IndexOutOfBoundsException("getGroup: Index value '" + index
169 + "' not in range [0.." + (this._groupList.size() - 1) + "]");
172 return (jalview.schemabinding.version2.Group) _groupList.get(index);
176 * Method getGroup.Returns the contents of the collection in an Array.
178 * Note: Just in case the collection contents are changing in another thread,
179 * we pass a 0-length Array of the correct type into the API call. This way we
180 * <i>know</i> that the Array returned is of exactly the correct length.
182 * @return this collection as an Array
184 public jalview.schemabinding.version2.Group[] getGroup()
186 jalview.schemabinding.version2.Group[] array = new jalview.schemabinding.version2.Group[0];
187 return (jalview.schemabinding.version2.Group[]) this._groupList
192 * Method getGroupCount.
194 * @return the size of this collection
196 public int getGroupCount()
198 return this._groupList.size();
205 * @throws java.lang.IndexOutOfBoundsException
206 * if the index given is outside the bounds of the collection
207 * @return the value of the jalview.schemabinding.version2.Setting at the
210 public jalview.schemabinding.version2.Setting getSetting(final int index)
211 throws java.lang.IndexOutOfBoundsException
213 // check bounds for index
214 if (index < 0 || index >= this._settingList.size())
216 throw new IndexOutOfBoundsException("getSetting: Index value '"
217 + index + "' not in range [0.."
218 + (this._settingList.size() - 1) + "]");
221 return (jalview.schemabinding.version2.Setting) _settingList.get(index);
225 * Method getSetting.Returns the contents of the collection in an Array.
227 * Note: Just in case the collection contents are changing in another thread,
228 * we pass a 0-length Array of the correct type into the API call. This way we
229 * <i>know</i> that the Array returned is of exactly the correct length.
231 * @return this collection as an Array
233 public jalview.schemabinding.version2.Setting[] getSetting()
235 jalview.schemabinding.version2.Setting[] array = new jalview.schemabinding.version2.Setting[0];
236 return (jalview.schemabinding.version2.Setting[]) this._settingList
241 * Method getSettingCount.
243 * @return the size of this collection
245 public int getSettingCount()
247 return this._settingList.size();
253 * @return true if this object is valid according to the schema
255 public boolean isValid()
260 } catch (org.exolab.castor.xml.ValidationException vex)
271 * @throws org.exolab.castor.xml.MarshalException
272 * if object is null or if any SAXException is thrown during
274 * @throws org.exolab.castor.xml.ValidationException
275 * if this object is an invalid instance according to the schema
277 public void marshal(final java.io.Writer out)
278 throws org.exolab.castor.xml.MarshalException,
279 org.exolab.castor.xml.ValidationException
281 Marshaller.marshal(this, out);
288 * @throws java.io.IOException
289 * if an IOException occurs during marshaling
290 * @throws org.exolab.castor.xml.ValidationException
291 * if this object is an invalid instance according to the schema
292 * @throws org.exolab.castor.xml.MarshalException
293 * if object is null or if any SAXException is thrown during
296 public void marshal(final org.xml.sax.ContentHandler handler)
297 throws java.io.IOException,
298 org.exolab.castor.xml.MarshalException,
299 org.exolab.castor.xml.ValidationException
301 Marshaller.marshal(this, handler);
306 public void removeAllGroup()
308 this._groupList.clear();
313 public void removeAllSetting()
315 this._settingList.clear();
319 * Method removeGroup.
322 * @return true if the object was removed from the collection.
324 public boolean removeGroup(
325 final jalview.schemabinding.version2.Group vGroup)
327 boolean removed = _groupList.remove(vGroup);
332 * Method removeGroupAt.
335 * @return the element removed from the collection
337 public jalview.schemabinding.version2.Group removeGroupAt(final int index)
339 java.lang.Object obj = this._groupList.remove(index);
340 return (jalview.schemabinding.version2.Group) obj;
344 * Method removeSetting.
347 * @return true if the object was removed from the collection.
349 public boolean removeSetting(
350 final jalview.schemabinding.version2.Setting vSetting)
352 boolean removed = _settingList.remove(vSetting);
357 * Method removeSettingAt.
360 * @return the element removed from the collection
362 public jalview.schemabinding.version2.Setting removeSettingAt(
365 java.lang.Object obj = this._settingList.remove(index);
366 return (jalview.schemabinding.version2.Setting) obj;
374 * @throws java.lang.IndexOutOfBoundsException
375 * if the index given is outside the bounds of the collection
377 public void setGroup(final int index,
378 final jalview.schemabinding.version2.Group vGroup)
379 throws java.lang.IndexOutOfBoundsException
381 // check bounds for index
382 if (index < 0 || index >= this._groupList.size())
384 throw new IndexOutOfBoundsException("setGroup: Index value '" + index
385 + "' not in range [0.." + (this._groupList.size() - 1) + "]");
388 this._groupList.set(index, vGroup);
396 public void setGroup(
397 final jalview.schemabinding.version2.Group[] vGroupArray)
402 for (int i = 0; i < vGroupArray.length; i++)
404 this._groupList.add(vGroupArray[i]);
413 * @throws java.lang.IndexOutOfBoundsException
414 * if the index given is outside the bounds of the collection
416 public void setSetting(final int index,
417 final jalview.schemabinding.version2.Setting vSetting)
418 throws java.lang.IndexOutOfBoundsException
420 // check bounds for index
421 if (index < 0 || index >= this._settingList.size())
423 throw new IndexOutOfBoundsException("setSetting: Index value '"
424 + index + "' not in range [0.."
425 + (this._settingList.size() - 1) + "]");
428 this._settingList.set(index, vSetting);
434 * @param vSettingArray
436 public void setSetting(
437 final jalview.schemabinding.version2.Setting[] vSettingArray)
440 _settingList.clear();
442 for (int i = 0; i < vSettingArray.length; i++)
444 this._settingList.add(vSettingArray[i]);
452 * @throws org.exolab.castor.xml.MarshalException
453 * if object is null or if any SAXException is thrown during
455 * @throws org.exolab.castor.xml.ValidationException
456 * if this object is an invalid instance according to the schema
457 * @return the unmarshaled jalview.schemabinding.version2.FeatureSettings
459 public static jalview.schemabinding.version2.FeatureSettings unmarshal(
460 final java.io.Reader reader)
461 throws org.exolab.castor.xml.MarshalException,
462 org.exolab.castor.xml.ValidationException
464 return (jalview.schemabinding.version2.FeatureSettings) Unmarshaller
466 jalview.schemabinding.version2.FeatureSettings.class,
473 * @throws org.exolab.castor.xml.ValidationException
474 * if this object is an invalid instance according to the schema
476 public void validate() throws org.exolab.castor.xml.ValidationException
478 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
479 validator.validate(this);