2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
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/>.
18 package jalview.binding;
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
30 * @version $Revision$ $Date$
32 public class Pdbentry implements java.io.Serializable
35 // --------------------------/
36 // - Class/Member Variables -/
37 // --------------------------/
42 private java.lang.String _id;
47 private java.lang.String _type;
52 private java.util.Vector _items;
61 this._items = new java.util.Vector();
71 * @param vPdbentryItem
72 * @throws java.lang.IndexOutOfBoundsException
73 * if the index given is outside the bounds of the collection
75 public void addPdbentryItem(
76 final jalview.binding.PdbentryItem vPdbentryItem)
77 throws java.lang.IndexOutOfBoundsException
79 this._items.addElement(vPdbentryItem);
86 * @param vPdbentryItem
87 * @throws java.lang.IndexOutOfBoundsException
88 * if the index given is outside the bounds of the collection
90 public void addPdbentryItem(final int index,
91 final jalview.binding.PdbentryItem vPdbentryItem)
92 throws java.lang.IndexOutOfBoundsException
94 this._items.add(index, vPdbentryItem);
98 * Method enumeratePdbentryItem.
100 * @return an Enumeration over all jalview.binding.PdbentryItem elements
102 public java.util.Enumeration enumeratePdbentryItem()
104 return this._items.elements();
108 * Returns the value of field 'id'.
110 * @return the value of field 'Id'.
112 public java.lang.String getId()
118 * Method getPdbentryItem.
121 * @throws java.lang.IndexOutOfBoundsException
122 * if the index given is outside the bounds of the collection
123 * @return the value of the jalview.binding.PdbentryItem at the given index
125 public jalview.binding.PdbentryItem getPdbentryItem(final int index)
126 throws java.lang.IndexOutOfBoundsException
128 // check bounds for index
129 if (index < 0 || index >= this._items.size())
131 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
132 + index + "' not in range [0.." + (this._items.size() - 1)
136 return (jalview.binding.PdbentryItem) _items.get(index);
140 * Method getPdbentryItem.Returns the contents of the collection in an Array.
142 * Note: Just in case the collection contents are changing in another thread,
143 * we pass a 0-length Array of the correct type into the API call. This way we
144 * <i>know</i> that the Array returned is of exactly the correct length.
146 * @return this collection as an Array
148 public jalview.binding.PdbentryItem[] getPdbentryItem()
150 jalview.binding.PdbentryItem[] array = new jalview.binding.PdbentryItem[0];
151 return (jalview.binding.PdbentryItem[]) this._items.toArray(array);
155 * Method getPdbentryItemCount.
157 * @return the size of this collection
159 public int getPdbentryItemCount()
161 return this._items.size();
165 * Returns the value of field 'type'.
167 * @return the value of field 'Type'.
169 public java.lang.String getType()
177 * @return true if this object is valid according to the schema
179 public boolean isValid()
184 } catch (org.exolab.castor.xml.ValidationException vex)
195 * @throws org.exolab.castor.xml.MarshalException
196 * if object is null or if any SAXException is thrown during
198 * @throws org.exolab.castor.xml.ValidationException
199 * if this object is an invalid instance according to the schema
201 public void marshal(final java.io.Writer out)
202 throws org.exolab.castor.xml.MarshalException,
203 org.exolab.castor.xml.ValidationException
205 Marshaller.marshal(this, out);
212 * @throws java.io.IOException
213 * if an IOException occurs during marshaling
214 * @throws org.exolab.castor.xml.ValidationException
215 * if this object is an invalid instance according to the schema
216 * @throws org.exolab.castor.xml.MarshalException
217 * if object is null or if any SAXException is thrown during
220 public void marshal(final org.xml.sax.ContentHandler handler)
221 throws java.io.IOException,
222 org.exolab.castor.xml.MarshalException,
223 org.exolab.castor.xml.ValidationException
225 Marshaller.marshal(this, handler);
230 public void removeAllPdbentryItem()
236 * Method removePdbentryItem.
238 * @param vPdbentryItem
239 * @return true if the object was removed from the collection.
241 public boolean removePdbentryItem(
242 final jalview.binding.PdbentryItem vPdbentryItem)
244 boolean removed = _items.remove(vPdbentryItem);
249 * Method removePdbentryItemAt.
252 * @return the element removed from the collection
254 public jalview.binding.PdbentryItem removePdbentryItemAt(final int index)
256 java.lang.Object obj = this._items.remove(index);
257 return (jalview.binding.PdbentryItem) obj;
261 * Sets the value of field 'id'.
264 * the value of field 'id'.
266 public void setId(final java.lang.String id)
275 * @param vPdbentryItem
276 * @throws java.lang.IndexOutOfBoundsException
277 * if the index given is outside the bounds of the collection
279 public void setPdbentryItem(final int index,
280 final jalview.binding.PdbentryItem vPdbentryItem)
281 throws java.lang.IndexOutOfBoundsException
283 // check bounds for index
284 if (index < 0 || index >= this._items.size())
286 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
287 + index + "' not in range [0.." + (this._items.size() - 1)
291 this._items.set(index, vPdbentryItem);
297 * @param vPdbentryItemArray
299 public void setPdbentryItem(
300 final jalview.binding.PdbentryItem[] vPdbentryItemArray)
305 for (int i = 0; i < vPdbentryItemArray.length; i++)
307 this._items.add(vPdbentryItemArray[i]);
312 * Sets the value of field 'type'.
315 * the value of field 'type'.
317 public void setType(final java.lang.String type)
326 * @throws org.exolab.castor.xml.MarshalException
327 * if object is null or if any SAXException is thrown during
329 * @throws org.exolab.castor.xml.ValidationException
330 * if this object is an invalid instance according to the schema
331 * @return the unmarshaled jalview.binding.Pdbentry
333 public static jalview.binding.Pdbentry unmarshal(
334 final java.io.Reader reader)
335 throws org.exolab.castor.xml.MarshalException,
336 org.exolab.castor.xml.ValidationException
338 return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(
339 jalview.binding.Pdbentry.class, reader);
345 * @throws org.exolab.castor.xml.ValidationException
346 * if this object is an invalid instance according to the schema
348 public void validate() throws org.exolab.castor.xml.ValidationException
350 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
351 validator.validate(this);