1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
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.
17 * If not, see <http://www.gnu.org/licenses/>.
18 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 ******************************************************************************/
21 * This class was automatically generated with
22 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
27 package jalview.schemabinding.version2;
29 //---------------------------------/
30 //- Imported classes and packages -/
31 //---------------------------------/
33 import org.exolab.castor.xml.Marshaller;
34 import org.exolab.castor.xml.Unmarshaller;
39 * @version $Revision$ $Date$
41 public class Sequence extends jalview.schemabinding.version2.SequenceType
42 implements java.io.Serializable
45 // --------------------------/
46 // - Class/Member Variables -/
47 // --------------------------/
50 * dataset sequence id for this sequence. Will be created as union of
54 private java.lang.String _dsseqid;
59 private java.util.Vector _DBRefList;
68 this._DBRefList = new java.util.Vector();
79 * @throws java.lang.IndexOutOfBoundsException
80 * if the index given is outside the bounds of the collection
82 public void addDBRef(final jalview.schemabinding.version2.DBRef vDBRef)
83 throws java.lang.IndexOutOfBoundsException
85 this._DBRefList.addElement(vDBRef);
93 * @throws java.lang.IndexOutOfBoundsException
94 * if the index given is outside the bounds of the collection
96 public void addDBRef(final int index,
97 final jalview.schemabinding.version2.DBRef vDBRef)
98 throws java.lang.IndexOutOfBoundsException
100 this._DBRefList.add(index, vDBRef);
104 * Method enumerateDBRef.
106 * @return an Enumeration over all jalview.schemabinding.version2.DBRef
109 public java.util.Enumeration enumerateDBRef()
111 return this._DBRefList.elements();
118 * @throws java.lang.IndexOutOfBoundsException
119 * if the index given is outside the bounds of the collection
120 * @return the value of the jalview.schemabinding.version2.DBRef at the given
123 public jalview.schemabinding.version2.DBRef getDBRef(final int index)
124 throws java.lang.IndexOutOfBoundsException
126 // check bounds for index
127 if (index < 0 || index >= this._DBRefList.size())
129 throw new IndexOutOfBoundsException("getDBRef: Index value '" + index
130 + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
133 return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
137 * Method getDBRef.Returns the contents of the collection in an Array.
139 * Note: Just in case the collection contents are changing in another thread,
140 * we pass a 0-length Array of the correct type into the API call. This way we
141 * <i>know</i> that the Array returned is of exactly the correct length.
143 * @return this collection as an Array
145 public jalview.schemabinding.version2.DBRef[] getDBRef()
147 jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
148 return (jalview.schemabinding.version2.DBRef[]) this._DBRefList
153 * Method getDBRefCount.
155 * @return the size of this collection
157 public int getDBRefCount()
159 return this._DBRefList.size();
163 * Returns the value of field 'dsseqid'. The field 'dsseqid' has the following
164 * description: dataset sequence id for this sequence. Will be created as
165 * union of sequences.
168 * @return the value of field 'Dsseqid'.
170 public java.lang.String getDsseqid()
172 return this._dsseqid;
178 * @return true if this object is valid according to the schema
180 public boolean isValid()
185 } catch (org.exolab.castor.xml.ValidationException vex)
196 * @throws org.exolab.castor.xml.MarshalException
197 * if object is null or if any SAXException is thrown during
199 * @throws org.exolab.castor.xml.ValidationException
200 * if this object is an invalid instance according to the schema
202 public void marshal(final java.io.Writer out)
203 throws org.exolab.castor.xml.MarshalException,
204 org.exolab.castor.xml.ValidationException
206 Marshaller.marshal(this, out);
213 * @throws java.io.IOException
214 * if an IOException occurs during marshaling
215 * @throws org.exolab.castor.xml.ValidationException
216 * if this object is an invalid instance according to the schema
217 * @throws org.exolab.castor.xml.MarshalException
218 * if object is null or if any SAXException is thrown during
221 public void marshal(final org.xml.sax.ContentHandler handler)
222 throws java.io.IOException,
223 org.exolab.castor.xml.MarshalException,
224 org.exolab.castor.xml.ValidationException
226 Marshaller.marshal(this, handler);
231 public void removeAllDBRef()
233 this._DBRefList.clear();
237 * Method removeDBRef.
240 * @return true if the object was removed from the collection.
242 public boolean removeDBRef(
243 final jalview.schemabinding.version2.DBRef vDBRef)
245 boolean removed = _DBRefList.remove(vDBRef);
250 * Method removeDBRefAt.
253 * @return the element removed from the collection
255 public jalview.schemabinding.version2.DBRef removeDBRefAt(final int index)
257 java.lang.Object obj = this._DBRefList.remove(index);
258 return (jalview.schemabinding.version2.DBRef) obj;
266 * @throws java.lang.IndexOutOfBoundsException
267 * if the index given is outside the bounds of the collection
269 public void setDBRef(final int index,
270 final jalview.schemabinding.version2.DBRef vDBRef)
271 throws java.lang.IndexOutOfBoundsException
273 // check bounds for index
274 if (index < 0 || index >= this._DBRefList.size())
276 throw new IndexOutOfBoundsException("setDBRef: Index value '" + index
277 + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
280 this._DBRefList.set(index, vDBRef);
288 public void setDBRef(
289 final jalview.schemabinding.version2.DBRef[] vDBRefArray)
294 for (int i = 0; i < vDBRefArray.length; i++)
296 this._DBRefList.add(vDBRefArray[i]);
301 * Sets the value of field 'dsseqid'. The field 'dsseqid' has the following
302 * description: dataset sequence id for this sequence. Will be created as
303 * union of sequences.
307 * the value of field 'dsseqid'.
309 public void setDsseqid(final java.lang.String dsseqid)
311 this._dsseqid = dsseqid;
318 * @throws org.exolab.castor.xml.MarshalException
319 * if object is null or if any SAXException is thrown during
321 * @throws org.exolab.castor.xml.ValidationException
322 * if this object is an invalid instance according to the schema
323 * @return the unmarshaled jalview.schemabinding.version2.SequenceType
325 public static jalview.schemabinding.version2.SequenceType unmarshal(
326 final java.io.Reader reader)
327 throws org.exolab.castor.xml.MarshalException,
328 org.exolab.castor.xml.ValidationException
330 return (jalview.schemabinding.version2.SequenceType) Unmarshaller
331 .unmarshal(jalview.schemabinding.version2.Sequence.class,
338 * @throws org.exolab.castor.xml.ValidationException
339 * if this object is an invalid instance according to the schema
341 public void validate() throws org.exolab.castor.xml.ValidationException
343 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
344 validator.validate(this);