2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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 jalview.util.MessageManager;
29 import org.exolab.castor.xml.Marshaller;
30 import org.exolab.castor.xml.Unmarshaller;
35 * @version $Revision$ $Date$
37 public class Pdbentry implements java.io.Serializable
40 // --------------------------/
41 // - Class/Member Variables -/
42 // --------------------------/
47 private java.lang.String _id;
52 private java.lang.String _type;
57 private java.lang.String _file;
62 private java.util.Vector _items;
71 this._items = new java.util.Vector();
81 * @param vPdbentryItem
82 * @throws java.lang.IndexOutOfBoundsException
83 * if the index given is outside the bounds of the collection
85 public void addPdbentryItem(
86 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
87 throws java.lang.IndexOutOfBoundsException
89 this._items.addElement(vPdbentryItem);
96 * @param vPdbentryItem
97 * @throws java.lang.IndexOutOfBoundsException
98 * if the index given is outside the bounds of the collection
100 public void addPdbentryItem(final int index,
101 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
102 throws java.lang.IndexOutOfBoundsException
104 this._items.add(index, vPdbentryItem);
108 * Method enumeratePdbentryItem.
110 * @return an Enumeration over all jalview.schemabinding.version2.PdbentryItem
113 public java.util.Enumeration enumeratePdbentryItem()
115 return this._items.elements();
119 * Returns the value of field 'file'.
121 * @return the value of field 'File'.
123 public java.lang.String getFile()
129 * Returns the value of field 'id'.
131 * @return the value of field 'Id'.
133 public java.lang.String getId()
139 * Method getPdbentryItem.
142 * @throws java.lang.IndexOutOfBoundsException
143 * if the index given is outside the bounds of the collection
144 * @return the value of the jalview.schemabinding.version2.PdbentryItem at the
147 public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
148 final int index) throws java.lang.IndexOutOfBoundsException
150 // check bounds for index
151 if (index < 0 || index >= this._items.size())
153 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
155 Integer.valueOf(index).toString(),
156 Integer.valueOf((this._items.size() - 1)).toString()
160 return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
164 * Method getPdbentryItem.Returns the contents of the collection in an Array.
166 * Note: Just in case the collection contents are changing in another thread,
167 * we pass a 0-length Array of the correct type into the API call. This way we
168 * <i>know</i> that the Array returned is of exactly the correct length.
170 * @return this collection as an Array
172 public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()
174 jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
175 return (jalview.schemabinding.version2.PdbentryItem[]) this._items
180 * Method getPdbentryItemCount.
182 * @return the size of this collection
184 public int getPdbentryItemCount()
186 return this._items.size();
190 * Returns the value of field 'type'.
192 * @return the value of field 'Type'.
194 public java.lang.String getType()
202 * @return true if this object is valid according to the schema
204 public boolean isValid()
209 } catch (org.exolab.castor.xml.ValidationException vex)
220 * @throws org.exolab.castor.xml.MarshalException
221 * if object is null or if any SAXException is thrown during
223 * @throws org.exolab.castor.xml.ValidationException
224 * if this object is an invalid instance according to the schema
226 public void marshal(final java.io.Writer out)
227 throws org.exolab.castor.xml.MarshalException,
228 org.exolab.castor.xml.ValidationException
230 Marshaller.marshal(this, out);
237 * @throws java.io.IOException
238 * if an IOException occurs during marshaling
239 * @throws org.exolab.castor.xml.ValidationException
240 * if this object is an invalid instance according to the schema
241 * @throws org.exolab.castor.xml.MarshalException
242 * if object is null or if any SAXException is thrown during
245 public void marshal(final org.xml.sax.ContentHandler handler)
246 throws java.io.IOException,
247 org.exolab.castor.xml.MarshalException,
248 org.exolab.castor.xml.ValidationException
250 Marshaller.marshal(this, handler);
255 public void removeAllPdbentryItem()
261 * Method removePdbentryItem.
263 * @param vPdbentryItem
264 * @return true if the object was removed from the collection.
266 public boolean removePdbentryItem(
267 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
269 boolean removed = _items.remove(vPdbentryItem);
274 * Method removePdbentryItemAt.
277 * @return the element removed from the collection
279 public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
282 java.lang.Object obj = this._items.remove(index);
283 return (jalview.schemabinding.version2.PdbentryItem) obj;
287 * Sets the value of field 'file'.
290 * the value of field 'file'.
292 public void setFile(final java.lang.String file)
298 * Sets the value of field 'id'.
301 * the value of field 'id'.
303 public void setId(final java.lang.String id)
312 * @param vPdbentryItem
313 * @throws java.lang.IndexOutOfBoundsException
314 * if the index given is outside the bounds of the collection
316 public void setPdbentryItem(final int index,
317 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
318 throws java.lang.IndexOutOfBoundsException
320 // check bounds for index
321 if (index < 0 || index >= this._items.size())
323 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
325 Integer.valueOf(index).toString(),
326 Integer.valueOf((this._items.size() - 1)).toString()
330 this._items.set(index, vPdbentryItem);
336 * @param vPdbentryItemArray
338 public void setPdbentryItem(
339 final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray)
344 for (int i = 0; i < vPdbentryItemArray.length; i++)
346 this._items.add(vPdbentryItemArray[i]);
351 * Sets the value of field 'type'.
354 * the value of field 'type'.
356 public void setType(final java.lang.String type)
365 * @throws org.exolab.castor.xml.MarshalException
366 * if object is null or if any SAXException is thrown during
368 * @throws org.exolab.castor.xml.ValidationException
369 * if this object is an invalid instance according to the schema
370 * @return the unmarshaled jalview.schemabinding.version2.Pdbentry
372 public static jalview.schemabinding.version2.Pdbentry unmarshal(
373 final java.io.Reader reader)
374 throws org.exolab.castor.xml.MarshalException,
375 org.exolab.castor.xml.ValidationException
377 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller
378 .unmarshal(jalview.schemabinding.version2.Pdbentry.class,
385 * @throws org.exolab.castor.xml.ValidationException
386 * if this object is an invalid instance according to the schema
388 public void validate() throws org.exolab.castor.xml.ValidationException
390 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
391 validator.validate(this);