2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
\r
3 * Copyright (C) 2009 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
67 this._items = new java.util.Vector();
\r
78 * @param vPdbentryItem
\r
79 * @throws java.lang.IndexOutOfBoundsException if the index
\r
80 * given is outside the bounds of the collection
\r
82 public void addPdbentryItem(
\r
83 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
84 throws java.lang.IndexOutOfBoundsException {
\r
85 this._items.addElement(vPdbentryItem);
\r
92 * @param vPdbentryItem
\r
93 * @throws java.lang.IndexOutOfBoundsException if the index
\r
94 * given is outside the bounds of the collection
\r
96 public void addPdbentryItem(
\r
98 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
99 throws java.lang.IndexOutOfBoundsException {
\r
100 this._items.add(index, vPdbentryItem);
\r
104 * Method enumeratePdbentryItem.
\r
106 * @return an Enumeration over all
\r
107 * jalview.schemabinding.version2.PdbentryItem elements
\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 if the index
\r
139 * given is outside the bounds of the collection
\r
140 * @return the value of the
\r
141 * jalview.schemabinding.version2.PdbentryItem at the given inde
\r
143 public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(
\r
145 throws java.lang.IndexOutOfBoundsException {
\r
146 // check bounds for index
\r
147 if (index < 0 || index >= this._items.size()) {
\r
148 throw new IndexOutOfBoundsException("getPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");
\r
151 return (jalview.schemabinding.version2.PdbentryItem) _items.get(index);
\r
155 * Method getPdbentryItem.Returns the contents of the
\r
156 * collection in an Array. <p>Note: Just in case the
\r
157 * collection contents are changing in another thread, we pass
\r
158 * a 0-length Array of the correct type into the API call.
\r
159 * This way we <i>know</i> that the Array returned is of
\r
160 * exactly the correct length.
\r
162 * @return this collection as an Array
\r
164 public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem(
\r
166 jalview.schemabinding.version2.PdbentryItem[] array = new jalview.schemabinding.version2.PdbentryItem[0];
\r
167 return (jalview.schemabinding.version2.PdbentryItem[]) this._items.toArray(array);
\r
171 * Method getPdbentryItemCount.
\r
173 * @return the size of this collection
\r
175 public int getPdbentryItemCount(
\r
177 return this._items.size();
\r
181 * Returns the value of field 'type'.
\r
183 * @return the value of field 'Type'.
\r
185 public java.lang.String getType(
\r
193 * @return true if this object is valid according to the schema
\r
195 public boolean isValid(
\r
199 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
209 * @throws org.exolab.castor.xml.MarshalException if object is
\r
210 * null or if any SAXException is thrown during marshaling
\r
211 * @throws org.exolab.castor.xml.ValidationException if this
\r
212 * object is an invalid instance according to the schema
\r
214 public void marshal(
\r
215 final java.io.Writer out)
\r
216 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
217 Marshaller.marshal(this, out);
\r
224 * @throws java.io.IOException if an IOException occurs during
\r
226 * @throws org.exolab.castor.xml.ValidationException if this
\r
227 * object is an invalid instance according to the schema
\r
228 * @throws org.exolab.castor.xml.MarshalException if object is
\r
229 * null or if any SAXException is thrown during marshaling
\r
231 public void marshal(
\r
232 final org.xml.sax.ContentHandler handler)
\r
233 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
234 Marshaller.marshal(this, handler);
\r
239 public void removeAllPdbentryItem(
\r
241 this._items.clear();
\r
245 * Method removePdbentryItem.
\r
247 * @param vPdbentryItem
\r
248 * @return true if the object was removed from the collection.
\r
250 public boolean removePdbentryItem(
\r
251 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem) {
\r
252 boolean removed = _items.remove(vPdbentryItem);
\r
257 * Method removePdbentryItemAt.
\r
260 * @return the element removed from the collection
\r
262 public jalview.schemabinding.version2.PdbentryItem removePdbentryItemAt(
\r
264 java.lang.Object obj = this._items.remove(index);
\r
265 return (jalview.schemabinding.version2.PdbentryItem) obj;
\r
269 * Sets the value of field 'file'.
\r
271 * @param file the value of field 'file'.
\r
273 public void setFile(
\r
274 final java.lang.String file) {
\r
279 * Sets the value of field 'id'.
\r
281 * @param id the value of field 'id'.
\r
284 final java.lang.String id) {
\r
292 * @param vPdbentryItem
\r
293 * @throws java.lang.IndexOutOfBoundsException if the index
\r
294 * given is outside the bounds of the collection
\r
296 public void setPdbentryItem(
\r
298 final jalview.schemabinding.version2.PdbentryItem vPdbentryItem)
\r
299 throws java.lang.IndexOutOfBoundsException {
\r
300 // check bounds for index
\r
301 if (index < 0 || index >= this._items.size()) {
\r
302 throw new IndexOutOfBoundsException("setPdbentryItem: Index value '" + index + "' not in range [0.." + (this._items.size() - 1) + "]");
\r
305 this._items.set(index, vPdbentryItem);
\r
311 * @param vPdbentryItemArray
\r
313 public void setPdbentryItem(
\r
314 final jalview.schemabinding.version2.PdbentryItem[] vPdbentryItemArray) {
\r
318 for (int i = 0; i < vPdbentryItemArray.length; i++) {
\r
319 this._items.add(vPdbentryItemArray[i]);
\r
324 * Sets the value of field 'type'.
\r
326 * @param type the value of field 'type'.
\r
328 public void setType(
\r
329 final java.lang.String type) {
\r
334 * Method unmarshal.
\r
337 * @throws org.exolab.castor.xml.MarshalException if object is
\r
338 * null or if any SAXException is thrown during marshaling
\r
339 * @throws org.exolab.castor.xml.ValidationException if this
\r
340 * object is an invalid instance according to the schema
\r
341 * @return the unmarshaled
\r
342 * jalview.schemabinding.version2.Pdbentry
\r
344 public static jalview.schemabinding.version2.Pdbentry unmarshal(
\r
345 final java.io.Reader reader)
\r
346 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
347 return (jalview.schemabinding.version2.Pdbentry) Unmarshaller.unmarshal(jalview.schemabinding.version2.Pdbentry.class, reader);
\r
353 * @throws org.exolab.castor.xml.ValidationException if this
\r
354 * object is an invalid instance according to the schema
\r
356 public void validate(
\r
358 throws org.exolab.castor.xml.ValidationException {
\r
359 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
360 validator.validate(this);
\r