2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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/>.
18 package jalview.schemabinding.version2;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
30 * @version $Revision$ $Date$
32 public class Pdbids extends jalview.schemabinding.version2.Pdbentry
33 implements java.io.Serializable
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
41 * Field _structureStateList.
43 private java.util.Vector _structureStateList;
52 this._structureStateList = new java.util.Vector();
62 * @param vStructureState
63 * @throws java.lang.IndexOutOfBoundsException
64 * if the index given is outside the bounds of the collection
66 public void addStructureState(
67 final jalview.schemabinding.version2.StructureState vStructureState)
68 throws java.lang.IndexOutOfBoundsException
70 this._structureStateList.addElement(vStructureState);
77 * @param vStructureState
78 * @throws java.lang.IndexOutOfBoundsException
79 * if the index given is outside the bounds of the collection
81 public void addStructureState(
83 final jalview.schemabinding.version2.StructureState vStructureState)
84 throws java.lang.IndexOutOfBoundsException
86 this._structureStateList.add(index, vStructureState);
90 * Method enumerateStructureState.
92 * @return an Enumeration over all
93 * jalview.schemabinding.version2.StructureState elements
95 public java.util.Enumeration enumerateStructureState()
97 return this._structureStateList.elements();
101 * Method getStructureState.
104 * @throws java.lang.IndexOutOfBoundsException
105 * if the index given is outside the bounds of the collection
106 * @return the value of the jalview.schemabinding.version2.StructureState at
109 public jalview.schemabinding.version2.StructureState getStructureState(
110 final int index) throws java.lang.IndexOutOfBoundsException
112 // check bounds for index
113 if (index < 0 || index >= this._structureStateList.size())
115 throw new IndexOutOfBoundsException(
116 "getStructureState: Index value '" + index
117 + "' not in range [0.."
118 + (this._structureStateList.size() - 1) + "]");
121 return (jalview.schemabinding.version2.StructureState) _structureStateList
126 * Method getStructureState.Returns the contents of the collection in an
129 * Note: Just in case the collection contents are changing in another thread,
130 * we pass a 0-length Array of the correct type into the API call. This way we
131 * <i>know</i> that the Array returned is of exactly the correct length.
133 * @return this collection as an Array
135 public jalview.schemabinding.version2.StructureState[] getStructureState()
137 jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
138 return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
143 * Method getStructureStateCount.
145 * @return the size of this collection
147 public int getStructureStateCount()
149 return this._structureStateList.size();
155 * @return true if this object is valid according to the schema
157 public boolean isValid()
162 } catch (org.exolab.castor.xml.ValidationException vex)
173 * @throws org.exolab.castor.xml.MarshalException
174 * if object is null or if any SAXException is thrown during
176 * @throws org.exolab.castor.xml.ValidationException
177 * if this object is an invalid instance according to the schema
179 public void marshal(final java.io.Writer out)
180 throws org.exolab.castor.xml.MarshalException,
181 org.exolab.castor.xml.ValidationException
183 Marshaller.marshal(this, out);
190 * @throws java.io.IOException
191 * if an IOException occurs during marshaling
192 * @throws org.exolab.castor.xml.ValidationException
193 * if this object is an invalid instance according to the schema
194 * @throws org.exolab.castor.xml.MarshalException
195 * if object is null or if any SAXException is thrown during
198 public void marshal(final org.xml.sax.ContentHandler handler)
199 throws java.io.IOException,
200 org.exolab.castor.xml.MarshalException,
201 org.exolab.castor.xml.ValidationException
203 Marshaller.marshal(this, handler);
208 public void removeAllStructureState()
210 this._structureStateList.clear();
214 * Method removeStructureState.
216 * @param vStructureState
217 * @return true if the object was removed from the collection.
219 public boolean removeStructureState(
220 final jalview.schemabinding.version2.StructureState vStructureState)
222 boolean removed = _structureStateList.remove(vStructureState);
227 * Method removeStructureStateAt.
230 * @return the element removed from the collection
232 public jalview.schemabinding.version2.StructureState removeStructureStateAt(
235 java.lang.Object obj = this._structureStateList.remove(index);
236 return (jalview.schemabinding.version2.StructureState) obj;
243 * @param vStructureState
244 * @throws java.lang.IndexOutOfBoundsException
245 * if the index given is outside the bounds of the collection
247 public void setStructureState(
249 final jalview.schemabinding.version2.StructureState vStructureState)
250 throws java.lang.IndexOutOfBoundsException
252 // check bounds for index
253 if (index < 0 || index >= this._structureStateList.size())
255 throw new IndexOutOfBoundsException(
256 "setStructureState: Index value '" + index
257 + "' not in range [0.."
258 + (this._structureStateList.size() - 1) + "]");
261 this._structureStateList.set(index, vStructureState);
267 * @param vStructureStateArray
269 public void setStructureState(
270 final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
273 _structureStateList.clear();
275 for (int i = 0; i < vStructureStateArray.length; i++)
277 this._structureStateList.add(vStructureStateArray[i]);
285 * @throws org.exolab.castor.xml.MarshalException
286 * if object is null or if any SAXException is thrown during
288 * @throws org.exolab.castor.xml.ValidationException
289 * if this object is an invalid instance according to the schema
290 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
292 public static jalview.schemabinding.version2.Pdbentry unmarshal(
293 final java.io.Reader reader)
294 throws org.exolab.castor.xml.MarshalException,
295 org.exolab.castor.xml.ValidationException
297 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
298 .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
304 * @throws org.exolab.castor.xml.ValidationException
305 * if this object is an invalid instance according to the schema
307 public void validate() throws org.exolab.castor.xml.ValidationException
309 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
310 validator.validate(this);