2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
\r
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
\r
11 * Jalview is distributed in the hope that it will be useful, but
\r
12 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
14 * PURPOSE. See the GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
18 package jalview.schemabinding.version2;
\r
20 //---------------------------------/
\r
21 //- Imported classes and packages -/
\r
22 //---------------------------------/
\r
24 import org.exolab.castor.xml.Marshaller;
\r
25 import org.exolab.castor.xml.Unmarshaller;
\r
30 * @version $Revision$ $Date$
\r
32 public class Pdbids extends jalview.schemabinding.version2.Pdbentry
\r
33 implements java.io.Serializable
\r
36 // --------------------------/
\r
37 // - Class/Member Variables -/
\r
38 // --------------------------/
\r
41 * Field _structureStateList.
\r
43 private java.util.Vector _structureStateList;
\r
45 // ----------------/
\r
46 // - Constructors -/
\r
47 // ----------------/
\r
52 this._structureStateList = new java.util.Vector();
\r
62 * @param vStructureState
\r
63 * @throws java.lang.IndexOutOfBoundsException
\r
64 * if the index given is outside the bounds of the collection
\r
66 public void addStructureState(
\r
67 final jalview.schemabinding.version2.StructureState vStructureState)
\r
68 throws java.lang.IndexOutOfBoundsException
\r
70 this._structureStateList.addElement(vStructureState);
\r
77 * @param vStructureState
\r
78 * @throws java.lang.IndexOutOfBoundsException
\r
79 * if the index given is outside the bounds of the collection
\r
81 public void addStructureState(
\r
83 final jalview.schemabinding.version2.StructureState vStructureState)
\r
84 throws java.lang.IndexOutOfBoundsException
\r
86 this._structureStateList.add(index, vStructureState);
\r
90 * Method enumerateStructureState.
\r
92 * @return an Enumeration over all
\r
93 * jalview.schemabinding.version2.StructureState elements
\r
95 public java.util.Enumeration enumerateStructureState()
\r
97 return this._structureStateList.elements();
\r
101 * Method getStructureState.
\r
104 * @throws java.lang.IndexOutOfBoundsException
\r
105 * if the index given is outside the bounds of the collection
\r
106 * @return the value of the jalview.schemabinding.version2.StructureState at
\r
109 public jalview.schemabinding.version2.StructureState getStructureState(
\r
110 final int index) throws java.lang.IndexOutOfBoundsException
\r
112 // check bounds for index
\r
113 if (index < 0 || index >= this._structureStateList.size())
\r
115 throw new IndexOutOfBoundsException(
\r
116 "getStructureState: Index value '" + index
\r
117 + "' not in range [0.."
\r
118 + (this._structureStateList.size() - 1) + "]");
\r
121 return (jalview.schemabinding.version2.StructureState) _structureStateList
\r
126 * Method getStructureState.Returns the contents of the collection in an
\r
129 * Note: Just in case the collection contents are changing in another thread,
\r
130 * we pass a 0-length Array of the correct type into the API call. This way we
\r
131 * <i>know</i> that the Array returned is of exactly the correct length.
\r
133 * @return this collection as an Array
\r
135 public jalview.schemabinding.version2.StructureState[] getStructureState()
\r
137 jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
\r
138 return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
\r
143 * Method getStructureStateCount.
\r
145 * @return the size of this collection
\r
147 public int getStructureStateCount()
\r
149 return this._structureStateList.size();
\r
155 * @return true if this object is valid according to the schema
\r
157 public boolean isValid()
\r
162 } catch (org.exolab.castor.xml.ValidationException vex)
\r
173 * @throws org.exolab.castor.xml.MarshalException
\r
174 * if object is null or if any SAXException is thrown during
\r
176 * @throws org.exolab.castor.xml.ValidationException
\r
177 * if this object is an invalid instance according to the schema
\r
179 public void marshal(final java.io.Writer out)
\r
180 throws org.exolab.castor.xml.MarshalException,
\r
181 org.exolab.castor.xml.ValidationException
\r
183 Marshaller.marshal(this, out);
\r
190 * @throws java.io.IOException
\r
191 * if an IOException occurs during marshaling
\r
192 * @throws org.exolab.castor.xml.ValidationException
\r
193 * if this object is an invalid instance according to the schema
\r
194 * @throws org.exolab.castor.xml.MarshalException
\r
195 * if object is null or if any SAXException is thrown during
\r
198 public void marshal(final org.xml.sax.ContentHandler handler)
\r
199 throws java.io.IOException,
\r
200 org.exolab.castor.xml.MarshalException,
\r
201 org.exolab.castor.xml.ValidationException
\r
203 Marshaller.marshal(this, handler);
\r
208 public void removeAllStructureState()
\r
210 this._structureStateList.clear();
\r
214 * Method removeStructureState.
\r
216 * @param vStructureState
\r
217 * @return true if the object was removed from the collection.
\r
219 public boolean removeStructureState(
\r
220 final jalview.schemabinding.version2.StructureState vStructureState)
\r
222 boolean removed = _structureStateList.remove(vStructureState);
\r
227 * Method removeStructureStateAt.
\r
230 * @return the element removed from the collection
\r
232 public jalview.schemabinding.version2.StructureState removeStructureStateAt(
\r
235 java.lang.Object obj = this._structureStateList.remove(index);
\r
236 return (jalview.schemabinding.version2.StructureState) obj;
\r
243 * @param vStructureState
\r
244 * @throws java.lang.IndexOutOfBoundsException
\r
245 * if the index given is outside the bounds of the collection
\r
247 public void setStructureState(
\r
249 final jalview.schemabinding.version2.StructureState vStructureState)
\r
250 throws java.lang.IndexOutOfBoundsException
\r
252 // check bounds for index
\r
253 if (index < 0 || index >= this._structureStateList.size())
\r
255 throw new IndexOutOfBoundsException(
\r
256 "setStructureState: Index value '" + index
\r
257 + "' not in range [0.."
\r
258 + (this._structureStateList.size() - 1) + "]");
\r
261 this._structureStateList.set(index, vStructureState);
\r
267 * @param vStructureStateArray
\r
269 public void setStructureState(
\r
270 final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
\r
273 _structureStateList.clear();
\r
275 for (int i = 0; i < vStructureStateArray.length; i++)
\r
277 this._structureStateList.add(vStructureStateArray[i]);
\r
282 * Method unmarshal.
\r
285 * @throws org.exolab.castor.xml.MarshalException
\r
286 * if object is null or if any SAXException is thrown during
\r
288 * @throws org.exolab.castor.xml.ValidationException
\r
289 * if this object is an invalid instance according to the schema
\r
290 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
\r
292 public static jalview.schemabinding.version2.Pdbentry unmarshal(
\r
293 final java.io.Reader reader)
\r
294 throws org.exolab.castor.xml.MarshalException,
\r
295 org.exolab.castor.xml.ValidationException
\r
297 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
\r
298 .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
\r
304 * @throws org.exolab.castor.xml.ValidationException
\r
305 * if this object is an invalid instance according to the schema
\r
307 public void validate() throws org.exolab.castor.xml.ValidationException
\r
309 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
310 validator.validate(this);
\r