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.binding;
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 Pdbentry implements java.io.Serializable
36 // --------------------------/
37 // - Class/Member Variables -/
38 // --------------------------/
43 private java.lang.String _id;
48 private java.lang.String _type;
53 private java.util.Vector _items;
62 this._items = new java.util.Vector();
72 * @param vPdbentryItem
73 * @throws java.lang.IndexOutOfBoundsException
74 * if the index given is outside the bounds of the collection
76 public void addPdbentryItem(
77 final jalview.binding.PdbentryItem vPdbentryItem)
78 throws java.lang.IndexOutOfBoundsException
80 this._items.addElement(vPdbentryItem);
87 * @param vPdbentryItem
88 * @throws java.lang.IndexOutOfBoundsException
89 * if the index given is outside the bounds of the collection
91 public void addPdbentryItem(final int index,
92 final jalview.binding.PdbentryItem vPdbentryItem)
93 throws java.lang.IndexOutOfBoundsException
95 this._items.add(index, vPdbentryItem);
99 * Method enumeratePdbentryItem.
101 * @return an Enumeration over all jalview.binding.PdbentryItem elements
103 public java.util.Enumeration enumeratePdbentryItem()
105 return this._items.elements();
109 * Returns the value of field 'id'.
111 * @return the value of field 'Id'.
113 public java.lang.String getId()
119 * Method getPdbentryItem.
122 * @throws java.lang.IndexOutOfBoundsException
123 * if the index given is outside the bounds of the collection
124 * @return the value of the jalview.binding.PdbentryItem at the given index
126 public jalview.binding.PdbentryItem getPdbentryItem(final int index)
127 throws java.lang.IndexOutOfBoundsException
129 // check bounds for index
130 if (index < 0 || index >= this._items.size())
132 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
133 + index + "' not in range [0.." + (this._items.size() - 1)
137 return (jalview.binding.PdbentryItem) _items.get(index);
141 * Method getPdbentryItem.Returns the contents of the collection in an Array.
143 * Note: Just in case the collection contents are changing in another thread,
144 * we pass a 0-length Array of the correct type into the API call. This way we
145 * <i>know</i> that the Array returned is of exactly the correct length.
147 * @return this collection as an Array
149 public jalview.binding.PdbentryItem[] getPdbentryItem()
151 jalview.binding.PdbentryItem[] array = new jalview.binding.PdbentryItem[0];
152 return (jalview.binding.PdbentryItem[]) this._items.toArray(array);
156 * Method getPdbentryItemCount.
158 * @return the size of this collection
160 public int getPdbentryItemCount()
162 return this._items.size();
166 * Returns the value of field 'type'.
168 * @return the value of field 'Type'.
170 public java.lang.String getType()
178 * @return true if this object is valid according to the schema
180 public boolean isValid()
185 } catch (org.exolab.castor.xml.ValidationException vex)
196 * @throws org.exolab.castor.xml.MarshalException
197 * if object is null or if any SAXException is thrown during
199 * @throws org.exolab.castor.xml.ValidationException
200 * if this object is an invalid instance according to the schema
202 public void marshal(final java.io.Writer out)
203 throws org.exolab.castor.xml.MarshalException,
204 org.exolab.castor.xml.ValidationException
206 Marshaller.marshal(this, out);
213 * @throws java.io.IOException
214 * if an IOException occurs during marshaling
215 * @throws org.exolab.castor.xml.ValidationException
216 * if this object is an invalid instance according to the schema
217 * @throws org.exolab.castor.xml.MarshalException
218 * if object is null or if any SAXException is thrown during
221 public void marshal(final org.xml.sax.ContentHandler handler)
222 throws java.io.IOException,
223 org.exolab.castor.xml.MarshalException,
224 org.exolab.castor.xml.ValidationException
226 Marshaller.marshal(this, handler);
231 public void removeAllPdbentryItem()
237 * Method removePdbentryItem.
239 * @param vPdbentryItem
240 * @return true if the object was removed from the collection.
242 public boolean removePdbentryItem(
243 final jalview.binding.PdbentryItem vPdbentryItem)
245 boolean removed = _items.remove(vPdbentryItem);
250 * Method removePdbentryItemAt.
253 * @return the element removed from the collection
255 public jalview.binding.PdbentryItem removePdbentryItemAt(final int index)
257 java.lang.Object obj = this._items.remove(index);
258 return (jalview.binding.PdbentryItem) obj;
262 * Sets the value of field 'id'.
265 * the value of field 'id'.
267 public void setId(final java.lang.String id)
276 * @param vPdbentryItem
277 * @throws java.lang.IndexOutOfBoundsException
278 * if the index given is outside the bounds of the collection
280 public void setPdbentryItem(final int index,
281 final jalview.binding.PdbentryItem vPdbentryItem)
282 throws java.lang.IndexOutOfBoundsException
284 // check bounds for index
285 if (index < 0 || index >= this._items.size())
287 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
288 + index + "' not in range [0.." + (this._items.size() - 1)
292 this._items.set(index, vPdbentryItem);
298 * @param vPdbentryItemArray
300 public void setPdbentryItem(
301 final jalview.binding.PdbentryItem[] vPdbentryItemArray)
306 for (int i = 0; i < vPdbentryItemArray.length; i++)
308 this._items.add(vPdbentryItemArray[i]);
313 * Sets the value of field 'type'.
316 * the value of field 'type'.
318 public void setType(final java.lang.String type)
327 * @throws org.exolab.castor.xml.MarshalException
328 * if object is null or if any SAXException is thrown during
330 * @throws org.exolab.castor.xml.ValidationException
331 * if this object is an invalid instance according to the schema
332 * @return the unmarshaled jalview.binding.Pdbentry
334 public static jalview.binding.Pdbentry unmarshal(
335 final java.io.Reader reader)
336 throws org.exolab.castor.xml.MarshalException,
337 org.exolab.castor.xml.ValidationException
339 return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(
340 jalview.binding.Pdbentry.class, reader);
346 * @throws org.exolab.castor.xml.ValidationException
347 * if this object is an invalid instance according to the schema
349 public void validate() throws org.exolab.castor.xml.ValidationException
351 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
352 validator.validate(this);