2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
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();
73 * @param vPdbentryItem
74 * @throws java.lang.IndexOutOfBoundsException if the index
75 * given is outside the bounds of the collection
77 public void addPdbentryItem(
78 final jalview.binding.PdbentryItem vPdbentryItem)
79 throws java.lang.IndexOutOfBoundsException {
80 this._items.addElement(vPdbentryItem);
87 * @param vPdbentryItem
88 * @throws java.lang.IndexOutOfBoundsException if the index
89 * given is outside the bounds of the collection
91 public void addPdbentryItem(
93 final jalview.binding.PdbentryItem vPdbentryItem)
94 throws java.lang.IndexOutOfBoundsException {
95 this._items.add(index, vPdbentryItem);
99 * Method enumeratePdbentryItem.
101 * @return an Enumeration over all jalview.binding.PdbentryItem
104 public java.util.Enumeration enumeratePdbentryItem(
106 return this._items.elements();
110 * Returns the value of field 'id'.
112 * @return the value of field 'Id'.
114 public java.lang.String getId(
120 * Method getPdbentryItem.
123 * @throws java.lang.IndexOutOfBoundsException if the index
124 * given is outside the bounds of the collection
125 * @return the value of the jalview.binding.PdbentryItem at the
128 public jalview.binding.PdbentryItem getPdbentryItem(
130 throws java.lang.IndexOutOfBoundsException {
131 // check bounds for index
132 if (index < 0 || index >= this._items.size()) {
133 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '" + 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
141 * collection in an Array. <p>Note: Just in case the
142 * collection contents are changing in another thread, we pass
143 * a 0-length Array of the correct type into the API call.
144 * This way we <i>know</i> that the Array returned is of
145 * 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(
184 } catch (org.exolab.castor.xml.ValidationException vex) {
194 * @throws org.exolab.castor.xml.MarshalException if object is
195 * null or if any SAXException is thrown during marshaling
196 * @throws org.exolab.castor.xml.ValidationException if this
197 * object is an invalid instance according to the schema
200 final java.io.Writer out)
201 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
202 Marshaller.marshal(this, out);
209 * @throws java.io.IOException if an IOException occurs during
211 * @throws org.exolab.castor.xml.ValidationException if this
212 * object is an invalid instance according to the schema
213 * @throws org.exolab.castor.xml.MarshalException if object is
214 * null or if any SAXException is thrown during marshaling
217 final org.xml.sax.ContentHandler handler)
218 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
219 Marshaller.marshal(this, handler);
224 public void removeAllPdbentryItem(
230 * Method removePdbentryItem.
232 * @param vPdbentryItem
233 * @return true if the object was removed from the collection.
235 public boolean removePdbentryItem(
236 final jalview.binding.PdbentryItem vPdbentryItem) {
237 boolean removed = _items.remove(vPdbentryItem);
242 * Method removePdbentryItemAt.
245 * @return the element removed from the collection
247 public jalview.binding.PdbentryItem removePdbentryItemAt(
249 java.lang.Object obj = this._items.remove(index);
250 return (jalview.binding.PdbentryItem) obj;
254 * Sets the value of field 'id'.
256 * @param id the value of field 'id'.
259 final java.lang.String id) {
267 * @param vPdbentryItem
268 * @throws java.lang.IndexOutOfBoundsException if the index
269 * given is outside the bounds of the collection
271 public void setPdbentryItem(
273 final jalview.binding.PdbentryItem vPdbentryItem)
274 throws java.lang.IndexOutOfBoundsException {
275 // check bounds for index
276 if (index < 0 || index >= this._items.size()) {
277 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");
280 this._items.set(index, vPdbentryItem);
286 * @param vPdbentryItemArray
288 public void setPdbentryItem(
289 final jalview.binding.PdbentryItem[] vPdbentryItemArray) {
293 for (int i = 0; i < vPdbentryItemArray.length; i++) {
294 this._items.add(vPdbentryItemArray[i]);
299 * Sets the value of field 'type'.
301 * @param type the value of field 'type'.
304 final java.lang.String type) {
312 * @throws org.exolab.castor.xml.MarshalException if object is
313 * null or if any SAXException is thrown during marshaling
314 * @throws org.exolab.castor.xml.ValidationException if this
315 * object is an invalid instance according to the schema
316 * @return the unmarshaled jalview.binding.Pdbentry
318 public static jalview.binding.Pdbentry unmarshal(
319 final java.io.Reader reader)
320 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
321 return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(jalview.binding.Pdbentry.class, reader);
327 * @throws org.exolab.castor.xml.ValidationException if this
328 * object is an invalid instance according to the schema
330 public void validate(
332 throws org.exolab.castor.xml.ValidationException {
333 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
334 validator.validate(this);