2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
\r
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.schemabinding.version2;
\r
21 // ---------------------------------/
\r
22 // - Imported classes and packages -/
\r
23 // ---------------------------------/
\r
25 import org.exolab.castor.xml.Marshaller;
\r
26 import org.exolab.castor.xml.Unmarshaller;
\r
31 * @version $Revision$ $Date$
\r
33 public class Pdbids extends jalview.schemabinding.version2.Pdbentry
\r
34 implements java.io.Serializable
\r
37 // --------------------------/
\r
38 // - Class/Member Variables -/
\r
39 // --------------------------/
\r
42 * Field _structureStateList.
\r
44 private java.util.Vector _structureStateList;
\r
46 // ----------------/
\r
47 // - Constructors -/
\r
48 // ----------------/
\r
53 this._structureStateList = new java.util.Vector();
\r
63 * @param vStructureState
\r
64 * @throws java.lang.IndexOutOfBoundsException
\r
65 * if the index given is outside the bounds of the collection
\r
67 public void addStructureState(
\r
68 final jalview.schemabinding.version2.StructureState vStructureState)
\r
69 throws java.lang.IndexOutOfBoundsException
\r
71 this._structureStateList.addElement(vStructureState);
\r
78 * @param vStructureState
\r
79 * @throws java.lang.IndexOutOfBoundsException
\r
80 * if the index given is outside the bounds of the collection
\r
82 public void addStructureState(
\r
84 final jalview.schemabinding.version2.StructureState vStructureState)
\r
85 throws java.lang.IndexOutOfBoundsException
\r
87 this._structureStateList.add(index, vStructureState);
\r
91 * Method enumerateStructureState.
\r
93 * @return an Enumeration over all
\r
94 * jalview.schemabinding.version2.StructureState elements
\r
96 public java.util.Enumeration enumerateStructureState()
\r
98 return this._structureStateList.elements();
\r
102 * Method getStructureState.
\r
105 * @throws java.lang.IndexOutOfBoundsException
\r
106 * if the index given is outside the bounds of the collection
\r
107 * @return the value of the jalview.schemabinding.version2.StructureState at
\r
110 public jalview.schemabinding.version2.StructureState getStructureState(
\r
111 final int index) throws java.lang.IndexOutOfBoundsException
\r
113 // check bounds for index
\r
114 if (index < 0 || index >= this._structureStateList.size())
\r
116 throw new IndexOutOfBoundsException(
\r
117 "getStructureState: Index value '" + index
\r
118 + "' not in range [0.."
\r
119 + (this._structureStateList.size() - 1) + "]");
\r
122 return (jalview.schemabinding.version2.StructureState) _structureStateList
\r
127 * Method getStructureState.Returns the contents of the collection in an
\r
130 * Note: Just in case the collection contents are changing in another thread,
\r
131 * we pass a 0-length Array of the correct type into the API call. This way we
\r
132 * <i>know</i> that the Array returned is of exactly the correct length.
\r
134 * @return this collection as an Array
\r
136 public jalview.schemabinding.version2.StructureState[] getStructureState()
\r
138 jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
\r
139 return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
\r
144 * Method getStructureStateCount.
\r
146 * @return the size of this collection
\r
148 public int getStructureStateCount()
\r
150 return this._structureStateList.size();
\r
156 * @return true if this object is valid according to the schema
\r
158 public boolean isValid()
\r
163 } catch (org.exolab.castor.xml.ValidationException vex)
\r
174 * @throws org.exolab.castor.xml.MarshalException
\r
175 * if object is null or if any SAXException is thrown during
\r
177 * @throws org.exolab.castor.xml.ValidationException
\r
178 * if this object is an invalid instance according to the
\r
181 public void marshal(final java.io.Writer out)
\r
182 throws org.exolab.castor.xml.MarshalException,
\r
183 org.exolab.castor.xml.ValidationException
\r
185 Marshaller.marshal(this, out);
\r
192 * @throws java.io.IOException
\r
193 * if an IOException occurs during marshaling
\r
194 * @throws org.exolab.castor.xml.ValidationException
\r
195 * if this object is an invalid instance according to the
\r
197 * @throws org.exolab.castor.xml.MarshalException
\r
198 * if object is null or if any SAXException is thrown during
\r
201 public void marshal(final org.xml.sax.ContentHandler handler)
\r
202 throws java.io.IOException,
\r
203 org.exolab.castor.xml.MarshalException,
\r
204 org.exolab.castor.xml.ValidationException
\r
206 Marshaller.marshal(this, handler);
\r
211 public void removeAllStructureState()
\r
213 this._structureStateList.clear();
\r
217 * Method removeStructureState.
\r
219 * @param vStructureState
\r
220 * @return true if the object was removed from the collection.
\r
222 public boolean removeStructureState(
\r
223 final jalview.schemabinding.version2.StructureState vStructureState)
\r
225 boolean removed = _structureStateList.remove(vStructureState);
\r
230 * Method removeStructureStateAt.
\r
233 * @return the element removed from the collection
\r
235 public jalview.schemabinding.version2.StructureState removeStructureStateAt(
\r
238 java.lang.Object obj = this._structureStateList.remove(index);
\r
239 return (jalview.schemabinding.version2.StructureState) obj;
\r
246 * @param vStructureState
\r
247 * @throws java.lang.IndexOutOfBoundsException
\r
248 * if the index given is outside the bounds of the collection
\r
250 public void setStructureState(
\r
252 final jalview.schemabinding.version2.StructureState vStructureState)
\r
253 throws java.lang.IndexOutOfBoundsException
\r
255 // check bounds for index
\r
256 if (index < 0 || index >= this._structureStateList.size())
\r
258 throw new IndexOutOfBoundsException(
\r
259 "setStructureState: Index value '" + index
\r
260 + "' not in range [0.."
\r
261 + (this._structureStateList.size() - 1) + "]");
\r
264 this._structureStateList.set(index, vStructureState);
\r
270 * @param vStructureStateArray
\r
272 public void setStructureState(
\r
273 final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
\r
276 _structureStateList.clear();
\r
278 for (int i = 0; i < vStructureStateArray.length; i++)
\r
280 this._structureStateList.add(vStructureStateArray[i]);
\r
285 * Method unmarshal.
\r
288 * @throws org.exolab.castor.xml.MarshalException
\r
289 * if object is null or if any SAXException is thrown during
\r
291 * @throws org.exolab.castor.xml.ValidationException
\r
292 * if this object is an invalid instance according to the
\r
294 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
\r
296 public static jalview.schemabinding.version2.Pdbentry unmarshal(
\r
297 final java.io.Reader reader)
\r
298 throws org.exolab.castor.xml.MarshalException,
\r
299 org.exolab.castor.xml.ValidationException
\r
301 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
\r
302 .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
\r
308 * @throws org.exolab.castor.xml.ValidationException
\r
309 * if this object is an invalid instance according to the
\r
312 public void validate() throws org.exolab.castor.xml.ValidationException
\r
314 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
315 validator.validate(this);
\r