2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
\r
3 * Copyright (C) 2009 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
38 //--------------------------/
\r
39 //- Class/Member Variables -/
\r
40 //--------------------------/
\r
43 * Field _structureStateList.
\r
45 private java.util.Vector _structureStateList;
\r
54 this._structureStateList = new java.util.Vector();
\r
65 * @param vStructureState
\r
66 * @throws java.lang.IndexOutOfBoundsException if the index
\r
67 * given is outside the bounds of the collection
\r
69 public void addStructureState(
\r
70 final jalview.schemabinding.version2.StructureState vStructureState)
\r
71 throws java.lang.IndexOutOfBoundsException {
\r
72 this._structureStateList.addElement(vStructureState);
\r
79 * @param vStructureState
\r
80 * @throws java.lang.IndexOutOfBoundsException if the index
\r
81 * given is outside the bounds of the collection
\r
83 public void addStructureState(
\r
85 final jalview.schemabinding.version2.StructureState vStructureState)
\r
86 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 if the index
\r
106 * given is outside the bounds of the collection
\r
107 * @return the value of the
\r
108 * jalview.schemabinding.version2.StructureState at the given
\r
111 public jalview.schemabinding.version2.StructureState getStructureState(
\r
113 throws java.lang.IndexOutOfBoundsException {
\r
114 // check bounds for index
\r
115 if (index < 0 || index >= this._structureStateList.size()) {
\r
116 throw new IndexOutOfBoundsException("getStructureState: Index value '" + index + "' not in range [0.." + (this._structureStateList.size() - 1) + "]");
\r
119 return (jalview.schemabinding.version2.StructureState) _structureStateList.get(index);
\r
123 * Method getStructureState.Returns the contents of the
\r
124 * collection in an Array. <p>Note: Just in case the
\r
125 * collection contents are changing in another thread, we pass
\r
126 * a 0-length Array of the correct type into the API call.
\r
127 * This way we <i>know</i> that the Array returned is of
\r
128 * exactly the correct length.
\r
130 * @return this collection as an Array
\r
132 public jalview.schemabinding.version2.StructureState[] getStructureState(
\r
134 jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
\r
135 return (jalview.schemabinding.version2.StructureState[]) this._structureStateList.toArray(array);
\r
139 * Method getStructureStateCount.
\r
141 * @return the size of this collection
\r
143 public int getStructureStateCount(
\r
145 return this._structureStateList.size();
\r
151 * @return true if this object is valid according to the schema
\r
153 public boolean isValid(
\r
157 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
167 * @throws org.exolab.castor.xml.MarshalException if object is
\r
168 * null or if any SAXException is thrown during marshaling
\r
169 * @throws org.exolab.castor.xml.ValidationException if this
\r
170 * object is an invalid instance according to the schema
\r
172 public void marshal(
\r
173 final java.io.Writer out)
\r
174 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
175 Marshaller.marshal(this, out);
\r
182 * @throws java.io.IOException if an IOException occurs during
\r
184 * @throws org.exolab.castor.xml.ValidationException if this
\r
185 * object is an invalid instance according to the schema
\r
186 * @throws org.exolab.castor.xml.MarshalException if object is
\r
187 * null or if any SAXException is thrown during marshaling
\r
189 public void marshal(
\r
190 final org.xml.sax.ContentHandler handler)
\r
191 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
192 Marshaller.marshal(this, handler);
\r
197 public void removeAllStructureState(
\r
199 this._structureStateList.clear();
\r
203 * Method removeStructureState.
\r
205 * @param vStructureState
\r
206 * @return true if the object was removed from the collection.
\r
208 public boolean removeStructureState(
\r
209 final jalview.schemabinding.version2.StructureState vStructureState) {
\r
210 boolean removed = _structureStateList.remove(vStructureState);
\r
215 * Method removeStructureStateAt.
\r
218 * @return the element removed from the collection
\r
220 public jalview.schemabinding.version2.StructureState removeStructureStateAt(
\r
222 java.lang.Object obj = this._structureStateList.remove(index);
\r
223 return (jalview.schemabinding.version2.StructureState) obj;
\r
230 * @param vStructureState
\r
231 * @throws java.lang.IndexOutOfBoundsException if the index
\r
232 * given is outside the bounds of the collection
\r
234 public void setStructureState(
\r
236 final jalview.schemabinding.version2.StructureState vStructureState)
\r
237 throws java.lang.IndexOutOfBoundsException {
\r
238 // check bounds for index
\r
239 if (index < 0 || index >= this._structureStateList.size()) {
\r
240 throw new IndexOutOfBoundsException("setStructureState: Index value '" + index + "' not in range [0.." + (this._structureStateList.size() - 1) + "]");
\r
243 this._structureStateList.set(index, vStructureState);
\r
249 * @param vStructureStateArray
\r
251 public void setStructureState(
\r
252 final jalview.schemabinding.version2.StructureState[] vStructureStateArray) {
\r
254 _structureStateList.clear();
\r
256 for (int i = 0; i < vStructureStateArray.length; i++) {
\r
257 this._structureStateList.add(vStructureStateArray[i]);
\r
262 * Method unmarshal.
\r
265 * @throws org.exolab.castor.xml.MarshalException if object is
\r
266 * null or if any SAXException is thrown during marshaling
\r
267 * @throws org.exolab.castor.xml.ValidationException if this
\r
268 * object is an invalid instance according to the schema
\r
269 * @return the unmarshaled
\r
270 * jalview.schemabinding.version2.Pdbentry
\r
272 public static jalview.schemabinding.version2.Pdbentry unmarshal(
\r
273 final java.io.Reader reader)
\r
274 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
275 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller.unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
\r
281 * @throws org.exolab.castor.xml.ValidationException if this
\r
282 * object is an invalid instance according to the schema
\r
284 public void validate(
\r
286 throws org.exolab.castor.xml.ValidationException {
\r
287 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
288 validator.validate(this);
\r