2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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 jalview.util.MessageManager;
29 import org.exolab.castor.xml.Marshaller;
30 import org.exolab.castor.xml.Unmarshaller;
35 * @version $Revision$ $Date$
37 public class Pdbids extends jalview.schemabinding.version2.Pdbentry
38 implements java.io.Serializable
41 // --------------------------/
42 // - Class/Member Variables -/
43 // --------------------------/
46 * Field _structureStateList.
48 private java.util.Vector _structureStateList;
57 this._structureStateList = new java.util.Vector();
67 * @param vStructureState
68 * @throws java.lang.IndexOutOfBoundsException
69 * if the index given is outside the bounds of the collection
71 public void addStructureState(
72 final jalview.schemabinding.version2.StructureState vStructureState)
73 throws java.lang.IndexOutOfBoundsException
75 this._structureStateList.addElement(vStructureState);
82 * @param vStructureState
83 * @throws java.lang.IndexOutOfBoundsException
84 * if the index given is outside the bounds of the collection
86 public void addStructureState(
88 final jalview.schemabinding.version2.StructureState vStructureState)
89 throws java.lang.IndexOutOfBoundsException
91 this._structureStateList.add(index, vStructureState);
95 * Method enumerateStructureState.
97 * @return an Enumeration over all
98 * jalview.schemabinding.version2.StructureState elements
100 public java.util.Enumeration enumerateStructureState()
102 return this._structureStateList.elements();
106 * Method getStructureState.
109 * @throws java.lang.IndexOutOfBoundsException
110 * if the index given is outside the bounds of the collection
111 * @return the value of the jalview.schemabinding.version2.StructureState at
114 public jalview.schemabinding.version2.StructureState getStructureState(
115 final int index) throws java.lang.IndexOutOfBoundsException
117 // check bounds for index
118 if (index < 0 || index >= this._structureStateList.size())
120 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
122 Integer.valueOf(index).toString(),
123 Integer.valueOf((this._structureStateList.size() - 1)).toString()
127 return (jalview.schemabinding.version2.StructureState) _structureStateList
132 * Method getStructureState.Returns the contents of the collection in an
135 * Note: Just in case the collection contents are changing in another thread,
136 * we pass a 0-length Array of the correct type into the API call. This way we
137 * <i>know</i> that the Array returned is of exactly the correct length.
139 * @return this collection as an Array
141 public jalview.schemabinding.version2.StructureState[] getStructureState()
143 jalview.schemabinding.version2.StructureState[] array = new jalview.schemabinding.version2.StructureState[0];
144 return (jalview.schemabinding.version2.StructureState[]) this._structureStateList
149 * Method getStructureStateCount.
151 * @return the size of this collection
153 public int getStructureStateCount()
155 return this._structureStateList.size();
161 * @return true if this object is valid according to the schema
163 public boolean isValid()
168 } catch (org.exolab.castor.xml.ValidationException vex)
179 * @throws org.exolab.castor.xml.MarshalException
180 * if object is null or if any SAXException is thrown during
182 * @throws org.exolab.castor.xml.ValidationException
183 * if this object is an invalid instance according to the schema
185 public void marshal(final java.io.Writer out)
186 throws org.exolab.castor.xml.MarshalException,
187 org.exolab.castor.xml.ValidationException
189 Marshaller.marshal(this, out);
196 * @throws java.io.IOException
197 * if an IOException occurs during marshaling
198 * @throws org.exolab.castor.xml.ValidationException
199 * if this object is an invalid instance according to the schema
200 * @throws org.exolab.castor.xml.MarshalException
201 * if object is null or if any SAXException is thrown during
204 public void marshal(final org.xml.sax.ContentHandler handler)
205 throws java.io.IOException,
206 org.exolab.castor.xml.MarshalException,
207 org.exolab.castor.xml.ValidationException
209 Marshaller.marshal(this, handler);
214 public void removeAllStructureState()
216 this._structureStateList.clear();
220 * Method removeStructureState.
222 * @param vStructureState
223 * @return true if the object was removed from the collection.
225 public boolean removeStructureState(
226 final jalview.schemabinding.version2.StructureState vStructureState)
228 boolean removed = _structureStateList.remove(vStructureState);
233 * Method removeStructureStateAt.
236 * @return the element removed from the collection
238 public jalview.schemabinding.version2.StructureState removeStructureStateAt(
241 java.lang.Object obj = this._structureStateList.remove(index);
242 return (jalview.schemabinding.version2.StructureState) obj;
249 * @param vStructureState
250 * @throws java.lang.IndexOutOfBoundsException
251 * if the index given is outside the bounds of the collection
253 public void setStructureState(
255 final jalview.schemabinding.version2.StructureState vStructureState)
256 throws java.lang.IndexOutOfBoundsException
258 // check bounds for index
259 if (index < 0 || index >= this._structureStateList.size())
261 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
263 Integer.valueOf(index).toString(),
264 Integer.valueOf((this._structureStateList.size() - 1)).toString()
268 this._structureStateList.set(index, vStructureState);
274 * @param vStructureStateArray
276 public void setStructureState(
277 final jalview.schemabinding.version2.StructureState[] vStructureStateArray)
280 _structureStateList.clear();
282 for (int i = 0; i < vStructureStateArray.length; i++)
284 this._structureStateList.add(vStructureStateArray[i]);
292 * @throws org.exolab.castor.xml.MarshalException
293 * if object is null or if any SAXException is thrown during
295 * @throws org.exolab.castor.xml.ValidationException
296 * if this object is an invalid instance according to the schema
297 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
299 public static jalview.schemabinding.version2.Pdbentry unmarshal(
300 final java.io.Reader reader)
301 throws org.exolab.castor.xml.MarshalException,
302 org.exolab.castor.xml.ValidationException
304 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
305 .unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);
311 * @throws org.exolab.castor.xml.ValidationException
312 * if this object is an invalid instance according to the schema
314 public void validate() throws org.exolab.castor.xml.ValidationException
316 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
317 validator.validate(this);