2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
33 * @version $Revision$ $Date$
35 public class Pdbids extends jalview.schemabinding.version2.Pdbentry
36 implements java.io.Serializable
39 // --------------------------/
40 // - Class/Member Variables -/
41 // --------------------------/
44 * Field _structureStateList.
46 private java.util.Vector _structureStateList;
55 this._structureStateList = new java.util.Vector();
65 * @param vStructureState
66 * @throws java.lang.IndexOutOfBoundsException
67 * if the index given is outside the bounds of the collection
69 public void addStructureState(
70 final jalview.schemabinding.version2.StructureState vStructureState)
71 throws java.lang.IndexOutOfBoundsException
73 this._structureStateList.addElement(vStructureState);
80 * @param vStructureState
81 * @throws java.lang.IndexOutOfBoundsException
82 * if the index given is outside the bounds of the collection
84 public void addStructureState(
86 final jalview.schemabinding.version2.StructureState vStructureState)
87 throws java.lang.IndexOutOfBoundsException
89 this._structureStateList.add(index, vStructureState);
93 * Method enumerateStructureState.
95 * @return an Enumeration over all
96 * jalview.schemabinding.version2.StructureState elements
98 public java.util.Enumeration enumerateStructureState()
100 return this._structureStateList.elements();
104 * Method getStructureState.
107 * @throws java.lang.IndexOutOfBoundsException
108 * if the index given is outside the bounds of the collection
109 * @return the value of the jalview.schemabinding.version2.StructureState at
112 public jalview.schemabinding.version2.StructureState getStructureState(
113 final int index) throws java.lang.IndexOutOfBoundsException
115 // check bounds for index
116 if (index < 0 || index >= this._structureStateList.size())
118 throw new IndexOutOfBoundsException(
119 "getStructureState: Index value '" + index
120 + "' not in range [0.."
121 + (this._structureStateList.size() - 1) + "]");
124 return (jalview.schemabinding.version2.StructureState) _structureStateList
129 * Method getStructureState.Returns the contents of the collection in an
132 * Note: Just in case the collection contents are changing in another thread,
133 * we pass a 0-length Array of the correct type into the API call. This way we
134 * <i>know</i> that the Array returned is of exactly the correct length.
136 * @return this collection as an Array
138 public jalview.schemabinding.version2.StructureState[] getStructureState()
140 jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
141 return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
146 * Method getStructureStateCount.
148 * @return the size of this collection
150 public int getStructureStateCount()
152 return this._structureStateList.size();
158 * @return true if this object is valid according to the schema
160 public boolean isValid()
165 } catch (org.exolab.castor.xml.ValidationException vex)
176 * @throws org.exolab.castor.xml.MarshalException
177 * if object is null or if any SAXException is thrown during
179 * @throws org.exolab.castor.xml.ValidationException
180 * if this object is an invalid instance according to the schema
182 public void marshal(final java.io.Writer out)
183 throws org.exolab.castor.xml.MarshalException,
184 org.exolab.castor.xml.ValidationException
186 Marshaller.marshal(this, out);
193 * @throws java.io.IOException
194 * if an IOException occurs during marshaling
195 * @throws org.exolab.castor.xml.ValidationException
196 * if this object is an invalid instance according to the schema
197 * @throws org.exolab.castor.xml.MarshalException
198 * if object is null or if any SAXException is thrown during
201 public void marshal(final org.xml.sax.ContentHandler handler)
202 throws java.io.IOException,
203 org.exolab.castor.xml.MarshalException,
204 org.exolab.castor.xml.ValidationException
206 Marshaller.marshal(this, handler);
211 public void removeAllStructureState()
213 this._structureStateList.clear();
217 * Method removeStructureState.
219 * @param vStructureState
220 * @return true if the object was removed from the collection.
222 public boolean removeStructureState(
223 final jalview.schemabinding.version2.StructureState vStructureState)
225 boolean removed = _structureStateList.remove(vStructureState);
230 * Method removeStructureStateAt.
233 * @return the element removed from the collection
235 public jalview.schemabinding.version2.StructureState removeStructureStateAt(
238 java.lang.Object obj = this._structureStateList.remove(index);
239 return (jalview.schemabinding.version2.StructureState) obj;
246 * @param vStructureState
247 * @throws java.lang.IndexOutOfBoundsException
248 * if the index given is outside the bounds of the collection
250 public void setStructureState(
252 final jalview.schemabinding.version2.StructureState vStructureState)
253 throws java.lang.IndexOutOfBoundsException
255 // check bounds for index
256 if (index < 0 || index >= this._structureStateList.size())
258 throw new IndexOutOfBoundsException(
259 "setStructureState: Index value '" + index
260 + "' not in range [0.."
261 + (this._structureStateList.size() - 1) + "]");
264 this._structureStateList.set(index, vStructureState);
270 * @param vStructureStateArray
272 public void setStructureState(
273 final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
276 _structureStateList.clear();
278 for (int i = 0; i < vStructureStateArray.length; i++)
280 this._structureStateList.add(vStructureStateArray[i]);
288 * @throws org.exolab.castor.xml.MarshalException
289 * if object is null or if any SAXException is thrown during
291 * @throws org.exolab.castor.xml.ValidationException
292 * if this object is an invalid instance according to the schema
293 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
295 public static jalview.schemabinding.version2.Pdbentry unmarshal(
296 final java.io.Reader reader)
297 throws org.exolab.castor.xml.MarshalException,
298 org.exolab.castor.xml.ValidationException
300 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
301 .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
307 * @throws org.exolab.castor.xml.ValidationException
308 * if this object is an invalid instance according to the schema
310 public void validate() throws org.exolab.castor.xml.ValidationException
312 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
313 validator.validate(this);