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.binding;
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 Pdbentry implements java.io.Serializable
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
45 private java.lang.String _id;
50 private java.lang.String _type;
55 private java.util.Vector _items;
64 this._items = new java.util.Vector();
74 * @param vPdbentryItem
75 * @throws java.lang.IndexOutOfBoundsException
76 * if the index given is outside the bounds of the collection
78 public void addPdbentryItem(
79 final jalview.binding.PdbentryItem vPdbentryItem)
80 throws java.lang.IndexOutOfBoundsException
82 this._items.addElement(vPdbentryItem);
89 * @param vPdbentryItem
90 * @throws java.lang.IndexOutOfBoundsException
91 * if the index given is outside the bounds of the collection
93 public void addPdbentryItem(final int index,
94 final jalview.binding.PdbentryItem vPdbentryItem)
95 throws java.lang.IndexOutOfBoundsException
97 this._items.add(index, vPdbentryItem);
101 * Method enumeratePdbentryItem.
103 * @return an Enumeration over all jalview.binding.PdbentryItem elements
105 public java.util.Enumeration enumeratePdbentryItem()
107 return this._items.elements();
111 * Returns the value of field 'id'.
113 * @return the value of field 'Id'.
115 public java.lang.String getId()
121 * Method getPdbentryItem.
124 * @throws java.lang.IndexOutOfBoundsException
125 * if the index given is outside the bounds of the collection
126 * @return the value of the jalview.binding.PdbentryItem at the given index
128 public jalview.binding.PdbentryItem getPdbentryItem(final int index)
129 throws java.lang.IndexOutOfBoundsException
131 // check bounds for index
132 if (index < 0 || index >= this._items.size())
134 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
135 + index + "' not in range [0.." + (this._items.size() - 1)
139 return (jalview.binding.PdbentryItem) _items.get(index);
143 * Method getPdbentryItem.Returns the contents of the collection in an Array.
145 * Note: Just in case the collection contents are changing in another thread,
146 * we pass a 0-length Array of the correct type into the API call. This way we
147 * <i>know</i> that the Array returned is of exactly the correct length.
149 * @return this collection as an Array
151 public jalview.binding.PdbentryItem[] getPdbentryItem()
153 jalview.binding.PdbentryItem[] array = new jalview.binding.PdbentryItem[0];
154 return (jalview.binding.PdbentryItem[]) this._items.toArray(array);
158 * Method getPdbentryItemCount.
160 * @return the size of this collection
162 public int getPdbentryItemCount()
164 return this._items.size();
168 * Returns the value of field 'type'.
170 * @return the value of field 'Type'.
172 public java.lang.String getType()
180 * @return true if this object is valid according to the schema
182 public boolean isValid()
187 } catch (org.exolab.castor.xml.ValidationException vex)
198 * @throws org.exolab.castor.xml.MarshalException
199 * if object is null or if any SAXException is thrown during
201 * @throws org.exolab.castor.xml.ValidationException
202 * if this object is an invalid instance according to the schema
204 public void marshal(final java.io.Writer out)
205 throws org.exolab.castor.xml.MarshalException,
206 org.exolab.castor.xml.ValidationException
208 Marshaller.marshal(this, out);
215 * @throws java.io.IOException
216 * if an IOException occurs during marshaling
217 * @throws org.exolab.castor.xml.ValidationException
218 * if this object is an invalid instance according to the schema
219 * @throws org.exolab.castor.xml.MarshalException
220 * if object is null or if any SAXException is thrown during
223 public void marshal(final org.xml.sax.ContentHandler handler)
224 throws java.io.IOException,
225 org.exolab.castor.xml.MarshalException,
226 org.exolab.castor.xml.ValidationException
228 Marshaller.marshal(this, handler);
233 public void removeAllPdbentryItem()
239 * Method removePdbentryItem.
241 * @param vPdbentryItem
242 * @return true if the object was removed from the collection.
244 public boolean removePdbentryItem(
245 final jalview.binding.PdbentryItem vPdbentryItem)
247 boolean removed = _items.remove(vPdbentryItem);
252 * Method removePdbentryItemAt.
255 * @return the element removed from the collection
257 public jalview.binding.PdbentryItem removePdbentryItemAt(final int index)
259 java.lang.Object obj = this._items.remove(index);
260 return (jalview.binding.PdbentryItem) obj;
264 * Sets the value of field 'id'.
267 * the value of field 'id'.
269 public void setId(final java.lang.String id)
278 * @param vPdbentryItem
279 * @throws java.lang.IndexOutOfBoundsException
280 * if the index given is outside the bounds of the collection
282 public void setPdbentryItem(final int index,
283 final jalview.binding.PdbentryItem vPdbentryItem)
284 throws java.lang.IndexOutOfBoundsException
286 // check bounds for index
287 if (index < 0 || index >= this._items.size())
289 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
290 + index + "' not in range [0.." + (this._items.size() - 1)
294 this._items.set(index, vPdbentryItem);
300 * @param vPdbentryItemArray
302 public void setPdbentryItem(
303 final jalview.binding.PdbentryItem[] vPdbentryItemArray)
308 for (int i = 0; i < vPdbentryItemArray.length; i++)
310 this._items.add(vPdbentryItemArray[i]);
315 * Sets the value of field 'type'.
318 * the value of field 'type'.
320 public void setType(final java.lang.String type)
329 * @throws org.exolab.castor.xml.MarshalException
330 * if object is null or if any SAXException is thrown during
332 * @throws org.exolab.castor.xml.ValidationException
333 * if this object is an invalid instance according to the schema
334 * @return the unmarshaled jalview.binding.Pdbentry
336 public static jalview.binding.Pdbentry unmarshal(
337 final java.io.Reader reader)
338 throws org.exolab.castor.xml.MarshalException,
339 org.exolab.castor.xml.ValidationException
341 return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(
342 jalview.binding.Pdbentry.class, reader);
348 * @throws org.exolab.castor.xml.ValidationException
349 * if this object is an invalid instance according to the schema
351 public void validate() throws org.exolab.castor.xml.ValidationException
353 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
354 validator.validate(this);