2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
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 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemabinding.version2;
21 //---------------------------------/
22 //- Imported classes and packages -/
23 //---------------------------------/
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
31 * @version $Revision$ $Date$
33 public class Pdbids extends jalview.schemabinding.version2.Pdbentry
34 implements java.io.Serializable
37 // --------------------------/
38 // - Class/Member Variables -/
39 // --------------------------/
42 * Field _structureStateList.
44 private java.util.Vector _structureStateList;
53 this._structureStateList = new java.util.Vector();
63 * @param vStructureState
64 * @throws java.lang.IndexOutOfBoundsException
65 * if the index given is outside the bounds of the collection
67 public void addStructureState(
68 final jalview.schemabinding.version2.StructureState vStructureState)
69 throws java.lang.IndexOutOfBoundsException
71 this._structureStateList.addElement(vStructureState);
78 * @param vStructureState
79 * @throws java.lang.IndexOutOfBoundsException
80 * if the index given is outside the bounds of the collection
82 public void addStructureState(
84 final jalview.schemabinding.version2.StructureState vStructureState)
85 throws java.lang.IndexOutOfBoundsException
87 this._structureStateList.add(index, vStructureState);
91 * Method enumerateStructureState.
93 * @return an Enumeration over all
94 * jalview.schemabinding.version2.StructureState elements
96 public java.util.Enumeration enumerateStructureState()
98 return this._structureStateList.elements();
102 * Method getStructureState.
105 * @throws java.lang.IndexOutOfBoundsException
106 * if the index given is outside the bounds of the collection
107 * @return the value of the jalview.schemabinding.version2.StructureState at
110 public jalview.schemabinding.version2.StructureState getStructureState(
111 final int index) throws java.lang.IndexOutOfBoundsException
113 // check bounds for index
114 if (index < 0 || index >= this._structureStateList.size())
116 throw new IndexOutOfBoundsException(
117 "getStructureState: Index value '" + index
118 + "' not in range [0.."
119 + (this._structureStateList.size() - 1) + "]");
122 return (jalview.schemabinding.version2.StructureState) _structureStateList
127 * Method getStructureState.Returns the contents of the collection in an
130 * Note: Just in case the collection contents are changing in another thread,
131 * we pass a 0-length Array of the correct type into the API call. This way we
132 * <i>know</i> that the Array returned is of exactly the correct length.
134 * @return this collection as an Array
136 public jalview.schemabinding.version2.StructureState[] getStructureState()
138 jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
139 return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
144 * Method getStructureStateCount.
146 * @return the size of this collection
148 public int getStructureStateCount()
150 return this._structureStateList.size();
156 * @return true if this object is valid according to the schema
158 public boolean isValid()
163 } catch (org.exolab.castor.xml.ValidationException vex)
174 * @throws org.exolab.castor.xml.MarshalException
175 * if object is null or if any SAXException is thrown during
177 * @throws org.exolab.castor.xml.ValidationException
178 * if this object is an invalid instance according to the schema
180 public void marshal(final java.io.Writer out)
181 throws org.exolab.castor.xml.MarshalException,
182 org.exolab.castor.xml.ValidationException
184 Marshaller.marshal(this, out);
191 * @throws java.io.IOException
192 * if an IOException occurs during marshaling
193 * @throws org.exolab.castor.xml.ValidationException
194 * if this object is an invalid instance according to the schema
195 * @throws org.exolab.castor.xml.MarshalException
196 * if object is null or if any SAXException is thrown during
199 public void marshal(final org.xml.sax.ContentHandler handler)
200 throws java.io.IOException,
201 org.exolab.castor.xml.MarshalException,
202 org.exolab.castor.xml.ValidationException
204 Marshaller.marshal(this, handler);
209 public void removeAllStructureState()
211 this._structureStateList.clear();
215 * Method removeStructureState.
217 * @param vStructureState
218 * @return true if the object was removed from the collection.
220 public boolean removeStructureState(
221 final jalview.schemabinding.version2.StructureState vStructureState)
223 boolean removed = _structureStateList.remove(vStructureState);
228 * Method removeStructureStateAt.
231 * @return the element removed from the collection
233 public jalview.schemabinding.version2.StructureState removeStructureStateAt(
236 java.lang.Object obj = this._structureStateList.remove(index);
237 return (jalview.schemabinding.version2.StructureState) obj;
244 * @param vStructureState
245 * @throws java.lang.IndexOutOfBoundsException
246 * if the index given is outside the bounds of the collection
248 public void setStructureState(
250 final jalview.schemabinding.version2.StructureState vStructureState)
251 throws java.lang.IndexOutOfBoundsException
253 // check bounds for index
254 if (index < 0 || index >= this._structureStateList.size())
256 throw new IndexOutOfBoundsException(
257 "setStructureState: Index value '" + index
258 + "' not in range [0.."
259 + (this._structureStateList.size() - 1) + "]");
262 this._structureStateList.set(index, vStructureState);
268 * @param vStructureStateArray
270 public void setStructureState(
271 final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
274 _structureStateList.clear();
276 for (int i = 0; i < vStructureStateArray.length; i++)
278 this._structureStateList.add(vStructureStateArray[i]);
286 * @throws org.exolab.castor.xml.MarshalException
287 * if object is null or if any SAXException is thrown during
289 * @throws org.exolab.castor.xml.ValidationException
290 * if this object is an invalid instance according to the schema
291 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
293 public static jalview.schemabinding.version2.Pdbentry unmarshal(
294 final java.io.Reader reader)
295 throws org.exolab.castor.xml.MarshalException,
296 org.exolab.castor.xml.ValidationException
298 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
299 .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
305 * @throws org.exolab.castor.xml.ValidationException
306 * if this object is an invalid instance according to the schema
308 public void validate() throws org.exolab.castor.xml.ValidationException
310 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
311 validator.validate(this);