2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
\r
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.schemabinding.version2;
\r
21 // ---------------------------------/
\r
22 // - Imported classes and packages -/
\r
23 // ---------------------------------/
\r
25 import org.exolab.castor.xml.Marshaller;
\r
26 import org.exolab.castor.xml.Unmarshaller;
\r
31 * @version $Revision$ $Date$
\r
33 public class Pdbentry implements java.io.Serializable
\r
36 // --------------------------/
\r
37 // - Class/Member Variables -/
\r
38 // --------------------------/
\r
43 private java.lang.String _id;
\r
48 private java.lang.String _type;
\r
53 private java.lang.String _file;
\r
58 private java.util.Vector _items;
\r
60 // ----------------/
\r
61 // - Constructors -/
\r
62 // ----------------/
\r
67 this._items = new java.util.Vector();
\r
77 * @param vPdbentryItem
\r
78 * @throws java.lang.IndexOutOfBoundsException
\r
79 * if the index given is outside the bounds of the collection
\r
81 public void addPdbentryItem(
\r
82 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
83 throws java.lang.IndexOutOfBoundsException
\r
85 this._items.addElement(vPdbentryItem);
\r
92 * @param vPdbentryItem
\r
93 * @throws java.lang.IndexOutOfBoundsException
\r
94 * if the index given is outside the bounds of the collection
\r
96 public void addPdbentryItem(final int index,
\r
97 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
98 throws java.lang.IndexOutOfBoundsException
\r
100 this._items.add(index, vPdbentryItem);
\r
104 * Method enumeratePdbentryItem.
\r
106 * @return an Enumeration over all jalview.schemabinding.version2.PdbentryItem
\r
109 public java.util.Enumeration enumeratePdbentryItem()
\r
111 return this._items.elements();
\r
115 * Returns the value of field 'file'.
\r
117 * @return the value of field 'File'.
\r
119 public java.lang.String getFile()
\r
125 * Returns the value of field 'id'.
\r
127 * @return the value of field 'Id'.
\r
129 public java.lang.String getId()
\r
135 * Method getPdbentryItem.
\r
138 * @throws java.lang.IndexOutOfBoundsException
\r
139 * if the index given is outside the bounds of the collection
\r
140 * @return the value of the jalview.schemabinding.version2.PdbentryItem at the
\r
143 public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
\r
144 final int index) throws java.lang.IndexOutOfBoundsException
\r
146 // check bounds for index
\r
147 if (index < 0 || index >= this._items.size())
\r
149 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
\r
150 + index + "' not in range [0.." + (this._items.size() - 1)
\r
154 return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
\r
158 * Method getPdbentryItem.Returns the contents of the collection in an Array.
\r
160 * Note: Just in case the collection contents are changing in another thread,
\r
161 * we pass a 0-length Array of the correct type into the API call. This way we
\r
162 * <i>know</i> that the Array returned is of exactly the correct length.
\r
164 * @return this collection as an Array
\r
166 public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()
\r
168 jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
\r
169 return (jalview.schemabinding.version2.PdbentryItem[]) this._items
\r
174 * Method getPdbentryItemCount.
\r
176 * @return the size of this collection
\r
178 public int getPdbentryItemCount()
\r
180 return this._items.size();
\r
184 * Returns the value of field 'type'.
\r
186 * @return the value of field 'Type'.
\r
188 public java.lang.String getType()
\r
196 * @return true if this object is valid according to the schema
\r
198 public boolean isValid()
\r
203 } catch (org.exolab.castor.xml.ValidationException vex)
\r
214 * @throws org.exolab.castor.xml.MarshalException
\r
215 * if object is null or if any SAXException is thrown during
\r
217 * @throws org.exolab.castor.xml.ValidationException
\r
218 * if this object is an invalid instance according to the
\r
221 public void marshal(final java.io.Writer out)
\r
222 throws org.exolab.castor.xml.MarshalException,
\r
223 org.exolab.castor.xml.ValidationException
\r
225 Marshaller.marshal(this, out);
\r
232 * @throws java.io.IOException
\r
233 * if an IOException occurs during marshaling
\r
234 * @throws org.exolab.castor.xml.ValidationException
\r
235 * if this object is an invalid instance according to the
\r
237 * @throws org.exolab.castor.xml.MarshalException
\r
238 * if object is null or if any SAXException is thrown during
\r
241 public void marshal(final org.xml.sax.ContentHandler handler)
\r
242 throws java.io.IOException,
\r
243 org.exolab.castor.xml.MarshalException,
\r
244 org.exolab.castor.xml.ValidationException
\r
246 Marshaller.marshal(this, handler);
\r
251 public void removeAllPdbentryItem()
\r
253 this._items.clear();
\r
257 * Method removePdbentryItem.
\r
259 * @param vPdbentryItem
\r
260 * @return true if the object was removed from the collection.
\r
262 public boolean removePdbentryItem(
\r
263 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
265 boolean removed = _items.remove(vPdbentryItem);
\r
270 * Method removePdbentryItemAt.
\r
273 * @return the element removed from the collection
\r
275 public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
\r
278 java.lang.Object obj = this._items.remove(index);
\r
279 return (jalview.schemabinding.version2.PdbentryItem) obj;
\r
283 * Sets the value of field 'file'.
\r
286 * the value of field 'file'.
\r
288 public void setFile(final java.lang.String file)
\r
294 * Sets the value of field 'id'.
\r
297 * the value of field 'id'.
\r
299 public void setId(final java.lang.String id)
\r
308 * @param vPdbentryItem
\r
309 * @throws java.lang.IndexOutOfBoundsException
\r
310 * if the index given is outside the bounds of the collection
\r
312 public void setPdbentryItem(final int index,
\r
313 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
314 throws java.lang.IndexOutOfBoundsException
\r
316 // check bounds for index
\r
317 if (index < 0 || index >= this._items.size())
\r
319 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
\r
320 + index + "' not in range [0.." + (this._items.size() - 1)
\r
324 this._items.set(index, vPdbentryItem);
\r
330 * @param vPdbentryItemArray
\r
332 public void setPdbentryItem(
\r
333 final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray)
\r
338 for (int i = 0; i < vPdbentryItemArray.length; i++)
\r
340 this._items.add(vPdbentryItemArray[i]);
\r
345 * Sets the value of field 'type'.
\r
348 * the value of field 'type'.
\r
350 public void setType(final java.lang.String type)
\r
356 * Method unmarshal.
\r
359 * @throws org.exolab.castor.xml.MarshalException
\r
360 * if object is null or if any SAXException is thrown during
\r
362 * @throws org.exolab.castor.xml.ValidationException
\r
363 * if this object is an invalid instance according to the
\r
365 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
\r
367 public static jalview.schemabinding.version2.Pdbentry unmarshal(
\r
368 final java.io.Reader reader)
\r
369 throws org.exolab.castor.xml.MarshalException,
\r
370 org.exolab.castor.xml.ValidationException
\r
372 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
\r
373 .unmarshal(jalview.schemabinding.version2.Pdbentry.class,
\r
380 * @throws org.exolab.castor.xml.ValidationException
\r
381 * if this object is an invalid instance according to the
\r
384 public void validate() throws org.exolab.castor.xml.ValidationException
\r
386 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
387 validator.validate(this);
\r