2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
\r
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
\r
11 * Jalview is distributed in the hope that it will be useful, but
\r
12 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
14 * PURPOSE. See the GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
18 package jalview.schemabinding.version2;
\r
20 //---------------------------------/
\r
21 //- Imported classes and packages -/
\r
22 //---------------------------------/
\r
24 import org.exolab.castor.xml.Marshaller;
\r
25 import org.exolab.castor.xml.Unmarshaller;
\r
30 * @version $Revision$ $Date$
\r
32 public class Pdbentry implements java.io.Serializable
\r
35 // --------------------------/
\r
36 // - Class/Member Variables -/
\r
37 // --------------------------/
\r
42 private java.lang.String _id;
\r
47 private java.lang.String _type;
\r
52 private java.lang.String _file;
\r
57 private java.util.Vector _items;
\r
59 // ----------------/
\r
60 // - Constructors -/
\r
61 // ----------------/
\r
66 this._items = new java.util.Vector();
\r
76 * @param vPdbentryItem
\r
77 * @throws java.lang.IndexOutOfBoundsException
\r
78 * if the index given is outside the bounds of the collection
\r
80 public void addPdbentryItem(
\r
81 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
82 throws java.lang.IndexOutOfBoundsException
\r
84 this._items.addElement(vPdbentryItem);
\r
91 * @param vPdbentryItem
\r
92 * @throws java.lang.IndexOutOfBoundsException
\r
93 * if the index given is outside the bounds of the collection
\r
95 public void addPdbentryItem(final int index,
\r
96 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
97 throws java.lang.IndexOutOfBoundsException
\r
99 this._items.add(index, vPdbentryItem);
\r
103 * Method enumeratePdbentryItem.
\r
105 * @return an Enumeration over all jalview.schemabinding.version2.PdbentryItem
\r
108 public java.util.Enumeration enumeratePdbentryItem()
\r
110 return this._items.elements();
\r
114 * Returns the value of field 'file'.
\r
116 * @return the value of field 'File'.
\r
118 public java.lang.String getFile()
\r
124 * Returns the value of field 'id'.
\r
126 * @return the value of field 'Id'.
\r
128 public java.lang.String getId()
\r
134 * Method getPdbentryItem.
\r
137 * @throws java.lang.IndexOutOfBoundsException
\r
138 * if the index given is outside the bounds of the collection
\r
139 * @return the value of the jalview.schemabinding.version2.PdbentryItem at the
\r
142 public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
\r
143 final int index) throws java.lang.IndexOutOfBoundsException
\r
145 // check bounds for index
\r
146 if (index < 0 || index >= this._items.size())
\r
148 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
\r
149 + index + "' not in range [0.." + (this._items.size() - 1)
\r
153 return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
\r
157 * Method getPdbentryItem.Returns the contents of the collection in an Array.
\r
159 * Note: Just in case the collection contents are changing in another thread,
\r
160 * we pass a 0-length Array of the correct type into the API call. This way we
\r
161 * <i>know</i> that the Array returned is of exactly the correct length.
\r
163 * @return this collection as an Array
\r
165 public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()
\r
167 jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
\r
168 return (jalview.schemabinding.version2.PdbentryItem[]) this._items
\r
173 * Method getPdbentryItemCount.
\r
175 * @return the size of this collection
\r
177 public int getPdbentryItemCount()
\r
179 return this._items.size();
\r
183 * Returns the value of field 'type'.
\r
185 * @return the value of field 'Type'.
\r
187 public java.lang.String getType()
\r
195 * @return true if this object is valid according to the schema
\r
197 public boolean isValid()
\r
202 } catch (org.exolab.castor.xml.ValidationException vex)
\r
213 * @throws org.exolab.castor.xml.MarshalException
\r
214 * if object is null or if any SAXException is thrown during
\r
216 * @throws org.exolab.castor.xml.ValidationException
\r
217 * if this object is an invalid instance according to the schema
\r
219 public void marshal(final java.io.Writer out)
\r
220 throws org.exolab.castor.xml.MarshalException,
\r
221 org.exolab.castor.xml.ValidationException
\r
223 Marshaller.marshal(this, out);
\r
230 * @throws java.io.IOException
\r
231 * if an IOException occurs during marshaling
\r
232 * @throws org.exolab.castor.xml.ValidationException
\r
233 * if this object is an invalid instance according to the schema
\r
234 * @throws org.exolab.castor.xml.MarshalException
\r
235 * if object is null or if any SAXException is thrown during
\r
238 public void marshal(final org.xml.sax.ContentHandler handler)
\r
239 throws java.io.IOException,
\r
240 org.exolab.castor.xml.MarshalException,
\r
241 org.exolab.castor.xml.ValidationException
\r
243 Marshaller.marshal(this, handler);
\r
248 public void removeAllPdbentryItem()
\r
250 this._items.clear();
\r
254 * Method removePdbentryItem.
\r
256 * @param vPdbentryItem
\r
257 * @return true if the object was removed from the collection.
\r
259 public boolean removePdbentryItem(
\r
260 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
262 boolean removed = _items.remove(vPdbentryItem);
\r
267 * Method removePdbentryItemAt.
\r
270 * @return the element removed from the collection
\r
272 public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
\r
275 java.lang.Object obj = this._items.remove(index);
\r
276 return (jalview.schemabinding.version2.PdbentryItem) obj;
\r
280 * Sets the value of field 'file'.
\r
283 * the value of field 'file'.
\r
285 public void setFile(final java.lang.String file)
\r
291 * Sets the value of field 'id'.
\r
294 * the value of field 'id'.
\r
296 public void setId(final java.lang.String id)
\r
305 * @param vPdbentryItem
\r
306 * @throws java.lang.IndexOutOfBoundsException
\r
307 * if the index given is outside the bounds of the collection
\r
309 public void setPdbentryItem(final int index,
\r
310 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
311 throws java.lang.IndexOutOfBoundsException
\r
313 // check bounds for index
\r
314 if (index < 0 || index >= this._items.size())
\r
316 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
\r
317 + index + "' not in range [0.." + (this._items.size() - 1)
\r
321 this._items.set(index, vPdbentryItem);
\r
327 * @param vPdbentryItemArray
\r
329 public void setPdbentryItem(
\r
330 final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray)
\r
335 for (int i = 0; i < vPdbentryItemArray.length; i++)
\r
337 this._items.add(vPdbentryItemArray[i]);
\r
342 * Sets the value of field 'type'.
\r
345 * the value of field 'type'.
\r
347 public void setType(final java.lang.String type)
\r
353 * Method unmarshal.
\r
356 * @throws org.exolab.castor.xml.MarshalException
\r
357 * if object is null or if any SAXException is thrown during
\r
359 * @throws org.exolab.castor.xml.ValidationException
\r
360 * if this object is an invalid instance according to the schema
\r
361 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
\r
363 public static jalview.schemabinding.version2.Pdbentry unmarshal(
\r
364 final java.io.Reader reader)
\r
365 throws org.exolab.castor.xml.MarshalException,
\r
366 org.exolab.castor.xml.ValidationException
\r
368 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
\r
369 .unmarshal(jalview.schemabinding.version2.Pdbentry.class,
\r
376 * @throws org.exolab.castor.xml.ValidationException
\r
377 * if this object is an invalid instance according to the schema
\r
379 public void validate() throws org.exolab.castor.xml.ValidationException
\r
381 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
382 validator.validate(this);
\r