2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
33 * @version $Revision$ $Date$
35 public class Pdbentry implements java.io.Serializable
38 // --------------------------/
39 // - Class/Member Variables -/
40 // --------------------------/
45 private java.lang.String _id;
50 private java.lang.String _type;
55 private java.lang.String _file;
60 private java.util.Vector _items;
69 this._items = new java.util.Vector();
79 * @param vPdbentryItem
80 * @throws java.lang.IndexOutOfBoundsException
81 * if the index given is outside the bounds of the collection
83 public void addPdbentryItem(
84 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
85 throws java.lang.IndexOutOfBoundsException
87 this._items.addElement(vPdbentryItem);
94 * @param vPdbentryItem
95 * @throws java.lang.IndexOutOfBoundsException
96 * if the index given is outside the bounds of the collection
98 public void addPdbentryItem(final int index,
99 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
100 throws java.lang.IndexOutOfBoundsException
102 this._items.add(index, vPdbentryItem);
106 * Method enumeratePdbentryItem.
108 * @return an Enumeration over all jalview.schemabinding.version2.PdbentryItem
111 public java.util.Enumeration enumeratePdbentryItem()
113 return this._items.elements();
117 * Returns the value of field 'file'.
119 * @return the value of field 'File'.
121 public java.lang.String getFile()
127 * Returns the value of field 'id'.
129 * @return the value of field 'Id'.
131 public java.lang.String getId()
137 * Method getPdbentryItem.
140 * @throws java.lang.IndexOutOfBoundsException
141 * if the index given is outside the bounds of the collection
142 * @return the value of the jalview.schemabinding.version2.PdbentryItem at the
145 public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
146 final int index) throws java.lang.IndexOutOfBoundsException
148 // check bounds for index
149 if (index < 0 || index >= this._items.size())
151 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '"
152 + index + "' not in range [0.." + (this._items.size() - 1)
156 return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
160 * Method getPdbentryItem.Returns the contents of the collection in an Array.
162 * Note: Just in case the collection contents are changing in another thread,
163 * we pass a 0-length Array of the correct type into the API call. This way we
164 * <i>know</i> that the Array returned is of exactly the correct length.
166 * @return this collection as an Array
168 public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()
170 jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
171 return (jalview.schemabinding.version2.PdbentryItem[]) this._items
176 * Method getPdbentryItemCount.
178 * @return the size of this collection
180 public int getPdbentryItemCount()
182 return this._items.size();
186 * Returns the value of field 'type'.
188 * @return the value of field 'Type'.
190 public java.lang.String getType()
198 * @return true if this object is valid according to the schema
200 public boolean isValid()
205 } catch (org.exolab.castor.xml.ValidationException vex)
216 * @throws org.exolab.castor.xml.MarshalException
217 * if object is null or if any SAXException is thrown during
219 * @throws org.exolab.castor.xml.ValidationException
220 * if this object is an invalid instance according to the schema
222 public void marshal(final java.io.Writer out)
223 throws org.exolab.castor.xml.MarshalException,
224 org.exolab.castor.xml.ValidationException
226 Marshaller.marshal(this, out);
233 * @throws java.io.IOException
234 * if an IOException occurs during marshaling
235 * @throws org.exolab.castor.xml.ValidationException
236 * if this object is an invalid instance according to the schema
237 * @throws org.exolab.castor.xml.MarshalException
238 * if object is null or if any SAXException is thrown during
241 public void marshal(final org.xml.sax.ContentHandler handler)
242 throws java.io.IOException,
243 org.exolab.castor.xml.MarshalException,
244 org.exolab.castor.xml.ValidationException
246 Marshaller.marshal(this, handler);
251 public void removeAllPdbentryItem()
257 * Method removePdbentryItem.
259 * @param vPdbentryItem
260 * @return true if the object was removed from the collection.
262 public boolean removePdbentryItem(
263 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
265 boolean removed = _items.remove(vPdbentryItem);
270 * Method removePdbentryItemAt.
273 * @return the element removed from the collection
275 public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
278 java.lang.Object obj = this._items.remove(index);
279 return (jalview.schemabinding.version2.PdbentryItem) obj;
283 * Sets the value of field 'file'.
286 * the value of field 'file'.
288 public void setFile(final java.lang.String file)
294 * Sets the value of field 'id'.
297 * the value of field 'id'.
299 public void setId(final java.lang.String id)
308 * @param vPdbentryItem
309 * @throws java.lang.IndexOutOfBoundsException
310 * if the index given is outside the bounds of the collection
312 public void setPdbentryItem(final int index,
313 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
314 throws java.lang.IndexOutOfBoundsException
316 // check bounds for index
317 if (index < 0 || index >= this._items.size())
319 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '"
320 + index + "' not in range [0.." + (this._items.size() - 1)
324 this._items.set(index, vPdbentryItem);
330 * @param vPdbentryItemArray
332 public void setPdbentryItem(
333 final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray)
338 for (int i = 0; i < vPdbentryItemArray.length; i++)
340 this._items.add(vPdbentryItemArray[i]);
345 * Sets the value of field 'type'.
348 * the value of field 'type'.
350 public void setType(final java.lang.String type)
359 * @throws org.exolab.castor.xml.MarshalException
360 * if object is null or if any SAXException is thrown during
362 * @throws org.exolab.castor.xml.ValidationException
363 * if this object is an invalid instance according to the schema
364 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
366 public static jalview.schemabinding.version2.Pdbentry unmarshal(
367 final java.io.Reader reader)
368 throws org.exolab.castor.xml.MarshalException,
369 org.exolab.castor.xml.ValidationException
371 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
372 .unmarshal(jalview.schemabinding.version2.Pdbentry.class,
379 * @throws org.exolab.castor.xml.ValidationException
380 * if this object is an invalid instance according to the schema
382 public void validate() throws org.exolab.castor.xml.ValidationException
384 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
385 validator.validate(this);