2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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.schemabinding.version2;
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.lang.String _file;
57 private java.util.Vector _items;
66 this._items = new java.util.Vector();
76 * @param vPdbentryItem
77 * @throws java.lang.IndexOutOfBoundsException
78 * if the index given is outside the bounds of the collection
80 public void addPdbentryItem(
81 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
82 throws java.lang.IndexOutOfBoundsException
84 this._items.addElement(vPdbentryItem);
91 * @param vPdbentryItem
92 * @throws java.lang.IndexOutOfBoundsException
93 * if the index given is outside the bounds of the collection
95 public void addPdbentryItem(final int index,
96 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
97 throws java.lang.IndexOutOfBoundsException
99 this._items.add(index, vPdbentryItem);
103 * Method enumeratePdbentryItem.
105 * @return an Enumeration over all jalview.schemabinding.version2.PdbentryItem
108 public java.util.Enumeration enumeratePdbentryItem()
110 return this._items.elements();
114 * Returns the value of field 'file'.
116 * @return the value of field 'File'.
118 public java.lang.String getFile()
124 * Returns the value of field 'id'.
126 * @return the value of field 'Id'.
128 public java.lang.String getId()
134 * Method getPdbentryItem.
137 * @throws java.lang.IndexOutOfBoundsException
138 * if the index given is outside the bounds of the collection
139 * @return the value of the jalview.schemabinding.version2.PdbentryItem at the
142 public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
143 final int index) throws java.lang.IndexOutOfBoundsException
145 // check bounds for index
146 if (index < 0 || index >= this._items.size())
148 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
149 + index + "' not in range [0.." + (this._items.size() - 1)
153 return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
157 * Method getPdbentryItem.Returns the contents of the collection in an Array.
159 * Note: Just in case the collection contents are changing in another thread,
160 * we pass a 0-length Array of the correct type into the API call. This way we
161 * <i>know</i> that the Array returned is of exactly the correct length.
163 * @return this collection as an Array
165 public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()
167 jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
168 return (jalview.schemabinding.version2.PdbentryItem[]) this._items
173 * Method getPdbentryItemCount.
175 * @return the size of this collection
177 public int getPdbentryItemCount()
179 return this._items.size();
183 * Returns the value of field 'type'.
185 * @return the value of field 'Type'.
187 public java.lang.String getType()
195 * @return true if this object is valid according to the schema
197 public boolean isValid()
202 } catch (org.exolab.castor.xml.ValidationException vex)
213 * @throws org.exolab.castor.xml.MarshalException
214 * if object is null or if any SAXException is thrown during
216 * @throws org.exolab.castor.xml.ValidationException
217 * if this object is an invalid instance according to the schema
219 public void marshal(final java.io.Writer out)
220 throws org.exolab.castor.xml.MarshalException,
221 org.exolab.castor.xml.ValidationException
223 Marshaller.marshal(this, out);
230 * @throws java.io.IOException
231 * if an IOException occurs during marshaling
232 * @throws org.exolab.castor.xml.ValidationException
233 * if this object is an invalid instance according to the schema
234 * @throws org.exolab.castor.xml.MarshalException
235 * if object is null or if any SAXException is thrown during
238 public void marshal(final org.xml.sax.ContentHandler handler)
239 throws java.io.IOException,
240 org.exolab.castor.xml.MarshalException,
241 org.exolab.castor.xml.ValidationException
243 Marshaller.marshal(this, handler);
248 public void removeAllPdbentryItem()
254 * Method removePdbentryItem.
256 * @param vPdbentryItem
257 * @return true if the object was removed from the collection.
259 public boolean removePdbentryItem(
260 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
262 boolean removed = _items.remove(vPdbentryItem);
267 * Method removePdbentryItemAt.
270 * @return the element removed from the collection
272 public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
275 java.lang.Object obj = this._items.remove(index);
276 return (jalview.schemabinding.version2.PdbentryItem) obj;
280 * Sets the value of field 'file'.
283 * the value of field 'file'.
285 public void setFile(final java.lang.String file)
291 * Sets the value of field 'id'.
294 * the value of field 'id'.
296 public void setId(final java.lang.String id)
305 * @param vPdbentryItem
306 * @throws java.lang.IndexOutOfBoundsException
307 * if the index given is outside the bounds of the collection
309 public void setPdbentryItem(final int index,
310 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
311 throws java.lang.IndexOutOfBoundsException
313 // check bounds for index
314 if (index < 0 || index >= this._items.size())
316 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
317 + index + "' not in range [0.." + (this._items.size() - 1)
321 this._items.set(index, vPdbentryItem);
327 * @param vPdbentryItemArray
329 public void setPdbentryItem(
330 final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray)
335 for (int i = 0; i < vPdbentryItemArray.length; i++)
337 this._items.add(vPdbentryItemArray[i]);
342 * Sets the value of field 'type'.
345 * the value of field 'type'.
347 public void setType(final java.lang.String type)
356 * @throws org.exolab.castor.xml.MarshalException
357 * if object is null or if any SAXException is thrown during
359 * @throws org.exolab.castor.xml.ValidationException
360 * if this object is an invalid instance according to the schema
361 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
363 public static jalview.schemabinding.version2.Pdbentry unmarshal(
364 final java.io.Reader reader)
365 throws org.exolab.castor.xml.MarshalException,
366 org.exolab.castor.xml.ValidationException
368 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
369 .unmarshal(jalview.schemabinding.version2.Pdbentry.class,
376 * @throws org.exolab.castor.xml.ValidationException
377 * if this object is an invalid instance according to the schema
379 public void validate() throws org.exolab.castor.xml.ValidationException
381 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
382 validator.validate(this);