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.schemabinding.version2;
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.lang.String _file;
58 private java.util.Vector _items;
67 this._items = new java.util.Vector();
77 * @param vPdbentryItem
78 * @throws java.lang.IndexOutOfBoundsException
79 * if the index given is outside the bounds of the collection
81 public void addPdbentryItem(
82 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
83 throws java.lang.IndexOutOfBoundsException
85 this._items.addElement(vPdbentryItem);
92 * @param vPdbentryItem
93 * @throws java.lang.IndexOutOfBoundsException
94 * if the index given is outside the bounds of the collection
96 public void addPdbentryItem(final int index,
97 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
98 throws java.lang.IndexOutOfBoundsException
100 this._items.add(index, vPdbentryItem);
104 * Method enumeratePdbentryItem.
106 * @return an Enumeration over all jalview.schemabinding.version2.PdbentryItem
109 public java.util.Enumeration enumeratePdbentryItem()
111 return this._items.elements();
115 * Returns the value of field 'file'.
117 * @return the value of field 'File'.
119 public java.lang.String getFile()
125 * Returns the value of field 'id'.
127 * @return the value of field 'Id'.
129 public java.lang.String getId()
135 * Method getPdbentryItem.
138 * @throws java.lang.IndexOutOfBoundsException
139 * if the index given is outside the bounds of the collection
140 * @return the value of the jalview.schemabinding.version2.PdbentryItem at the
143 public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
144 final int index) throws java.lang.IndexOutOfBoundsException
146 // check bounds for index
147 if (index < 0 || index >= this._items.size())
149 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
150 + index + "' not in range [0.." + (this._items.size() - 1)
154 return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
158 * Method getPdbentryItem.Returns the contents of the collection in an Array.
160 * Note: Just in case the collection contents are changing in another thread,
161 * we pass a 0-length Array of the correct type into the API call. This way we
162 * <i>know</i> that the Array returned is of exactly the correct length.
164 * @return this collection as an Array
166 public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()
168 jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
169 return (jalview.schemabinding.version2.PdbentryItem[]) this._items
174 * Method getPdbentryItemCount.
176 * @return the size of this collection
178 public int getPdbentryItemCount()
180 return this._items.size();
184 * Returns the value of field 'type'.
186 * @return the value of field 'Type'.
188 public java.lang.String getType()
196 * @return true if this object is valid according to the schema
198 public boolean isValid()
203 } catch (org.exolab.castor.xml.ValidationException vex)
214 * @throws org.exolab.castor.xml.MarshalException
215 * if object is null or if any SAXException is thrown during
217 * @throws org.exolab.castor.xml.ValidationException
218 * if this object is an invalid instance according to the schema
220 public void marshal(final java.io.Writer out)
221 throws org.exolab.castor.xml.MarshalException,
222 org.exolab.castor.xml.ValidationException
224 Marshaller.marshal(this, out);
231 * @throws java.io.IOException
232 * if an IOException occurs during marshaling
233 * @throws org.exolab.castor.xml.ValidationException
234 * if this object is an invalid instance according to the schema
235 * @throws org.exolab.castor.xml.MarshalException
236 * if object is null or if any SAXException is thrown during
239 public void marshal(final org.xml.sax.ContentHandler handler)
240 throws java.io.IOException,
241 org.exolab.castor.xml.MarshalException,
242 org.exolab.castor.xml.ValidationException
244 Marshaller.marshal(this, handler);
249 public void removeAllPdbentryItem()
255 * Method removePdbentryItem.
257 * @param vPdbentryItem
258 * @return true if the object was removed from the collection.
260 public boolean removePdbentryItem(
261 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
263 boolean removed = _items.remove(vPdbentryItem);
268 * Method removePdbentryItemAt.
271 * @return the element removed from the collection
273 public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
276 java.lang.Object obj = this._items.remove(index);
277 return (jalview.schemabinding.version2.PdbentryItem) obj;
281 * Sets the value of field 'file'.
284 * the value of field 'file'.
286 public void setFile(final java.lang.String file)
292 * Sets the value of field 'id'.
295 * the value of field 'id'.
297 public void setId(final java.lang.String id)
306 * @param vPdbentryItem
307 * @throws java.lang.IndexOutOfBoundsException
308 * if the index given is outside the bounds of the collection
310 public void setPdbentryItem(final int index,
311 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
312 throws java.lang.IndexOutOfBoundsException
314 // check bounds for index
315 if (index < 0 || index >= this._items.size())
317 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
318 + index + "' not in range [0.." + (this._items.size() - 1)
322 this._items.set(index, vPdbentryItem);
328 * @param vPdbentryItemArray
330 public void setPdbentryItem(
331 final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray)
336 for (int i = 0; i < vPdbentryItemArray.length; i++)
338 this._items.add(vPdbentryItemArray[i]);
343 * Sets the value of field 'type'.
346 * the value of field 'type'.
348 public void setType(final java.lang.String type)
357 * @throws org.exolab.castor.xml.MarshalException
358 * if object is null or if any SAXException is thrown during
360 * @throws org.exolab.castor.xml.ValidationException
361 * if this object is an invalid instance according to the schema
362 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
364 public static jalview.schemabinding.version2.Pdbentry unmarshal(
365 final java.io.Reader reader)
366 throws org.exolab.castor.xml.MarshalException,
367 org.exolab.castor.xml.ValidationException
369 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
370 .unmarshal(jalview.schemabinding.version2.Pdbentry.class,
377 * @throws org.exolab.castor.xml.ValidationException
378 * if this object is an invalid instance according to the schema
380 public void validate() throws org.exolab.castor.xml.ValidationException
382 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
383 validator.validate(this);