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
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.binding;
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;
56 public FeatureSettings() {
58 this._settingList = new java.util.Vector();
70 * @throws java.lang.IndexOutOfBoundsException if the index
71 * given is outside the bounds of the collection
73 public void addSetting(
74 final jalview.binding.Setting vSetting)
75 throws java.lang.IndexOutOfBoundsException {
76 this._settingList.addElement(vSetting);
84 * @throws java.lang.IndexOutOfBoundsException if the index
85 * given is outside the bounds of the collection
87 public void addSetting(
89 final jalview.binding.Setting vSetting)
90 throws java.lang.IndexOutOfBoundsException {
91 this._settingList.add(index, vSetting);
95 * Method enumerateSetting.
97 * @return an Enumeration over all jalview.binding.Setting
100 public java.util.Enumeration enumerateSetting(
102 return this._settingList.elements();
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
114 public jalview.binding.Setting getSetting(
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) + "]");
122 return (jalview.binding.Setting) _settingList.get(index);
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.
132 * @return this collection as an Array
134 public jalview.binding.Setting[] getSetting(
136 jalview.binding.Setting[] array = new jalview.binding.Setting[0];
137 return (jalview.binding.Setting[]) this._settingList.toArray(array);
141 * Method getSettingCount.
143 * @return the size of this collection
145 public int getSettingCount(
147 return this._settingList.size();
153 * @return true if this object is valid according to the schema
155 public boolean isValid(
159 } catch (org.exolab.castor.xml.ValidationException vex) {
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
175 final java.io.Writer out)
176 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
177 Marshaller.marshal(this, out);
184 * @throws java.io.IOException if an IOException occurs during
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
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);
199 public void removeAllSetting(
201 this._settingList.clear();
205 * Method removeSetting.
208 * @return true if the object was removed from the collection.
210 public boolean removeSetting(
211 final jalview.binding.Setting vSetting) {
212 boolean removed = _settingList.remove(vSetting);
217 * Method removeSettingAt.
220 * @return the element removed from the collection
222 public jalview.binding.Setting removeSettingAt(
224 java.lang.Object obj = this._settingList.remove(index);
225 return (jalview.binding.Setting) obj;
233 * @throws java.lang.IndexOutOfBoundsException if the index
234 * given is outside the bounds of the collection
236 public void setSetting(
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) + "]");
245 this._settingList.set(index, vSetting);
251 * @param vSettingArray
253 public void setSetting(
254 final jalview.binding.Setting[] vSettingArray) {
256 _settingList.clear();
258 for (int i = 0; i < vSettingArray.length; i++) {
259 this._settingList.add(vSettingArray[i]);
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
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);
282 * @throws org.exolab.castor.xml.ValidationException if this
283 * object is an invalid instance according to the schema
285 public void validate(
287 throws org.exolab.castor.xml.ValidationException {
288 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
289 validator.validate(this);