1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.schemabinding.version2;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
37 * @version $Revision$ $Date$
39 public class Sequence extends jalview.schemabinding.version2.SequenceType
40 implements java.io.Serializable
44 //--------------------------/
45 //- Class/Member Variables -/
46 //--------------------------/
49 * dataset sequence id for this sequence. Will be created as
53 private java.lang.String _dsseqid;
58 private java.util.Vector _DBRefList;
67 this._DBRefList = new java.util.Vector();
79 * @throws java.lang.IndexOutOfBoundsException if the index
80 * given is outside the bounds of the collection
83 final jalview.schemabinding.version2.DBRef vDBRef)
84 throws java.lang.IndexOutOfBoundsException {
85 this._DBRefList.addElement(vDBRef);
93 * @throws java.lang.IndexOutOfBoundsException if the index
94 * given is outside the bounds of the collection
98 final jalview.schemabinding.version2.DBRef vDBRef)
99 throws java.lang.IndexOutOfBoundsException {
100 this._DBRefList.add(index, vDBRef);
104 * Method enumerateDBRef.
106 * @return an Enumeration over all
107 * jalview.schemabinding.version2.DBRef elements
109 public java.util.Enumeration enumerateDBRef(
111 return this._DBRefList.elements();
118 * @throws java.lang.IndexOutOfBoundsException if the index
119 * given is outside the bounds of the collection
120 * @return the value of the
121 * jalview.schemabinding.version2.DBRef at the given index
123 public jalview.schemabinding.version2.DBRef getDBRef(
125 throws java.lang.IndexOutOfBoundsException {
126 // check bounds for index
127 if (index < 0 || index >= this._DBRefList.size()) {
128 throw new IndexOutOfBoundsException("getDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
131 return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
135 * Method getDBRef.Returns the contents of the collection in an
136 * Array. <p>Note: Just in case the collection contents are
137 * changing in another thread, we pass a 0-length Array of the
138 * correct type into the API call. This way we <i>know</i>
139 * that the Array returned is of exactly the correct length.
141 * @return this collection as an Array
143 public jalview.schemabinding.version2.DBRef[] getDBRef(
145 jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
146 return (jalview.schemabinding.version2.DBRef[]) this._DBRefList.toArray(array);
150 * Method getDBRefCount.
152 * @return the size of this collection
154 public int getDBRefCount(
156 return this._DBRefList.size();
160 * Returns the value of field 'dsseqid'. The field 'dsseqid'
161 * has the following description: dataset sequence id for this
162 * sequence. Will be created as union of sequences.
165 * @return the value of field 'Dsseqid'.
167 public java.lang.String getDsseqid(
169 return this._dsseqid;
175 * @return true if this object is valid according to the schema
177 public boolean isValid(
181 } catch (org.exolab.castor.xml.ValidationException vex) {
191 * @throws org.exolab.castor.xml.MarshalException if object is
192 * null or if any SAXException is thrown during marshaling
193 * @throws org.exolab.castor.xml.ValidationException if this
194 * object is an invalid instance according to the schema
197 final java.io.Writer out)
198 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
199 Marshaller.marshal(this, out);
206 * @throws java.io.IOException if an IOException occurs during
208 * @throws org.exolab.castor.xml.ValidationException if this
209 * object is an invalid instance according to the schema
210 * @throws org.exolab.castor.xml.MarshalException if object is
211 * null or if any SAXException is thrown during marshaling
214 final org.xml.sax.ContentHandler handler)
215 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
216 Marshaller.marshal(this, handler);
221 public void removeAllDBRef(
223 this._DBRefList.clear();
227 * Method removeDBRef.
230 * @return true if the object was removed from the collection.
232 public boolean removeDBRef(
233 final jalview.schemabinding.version2.DBRef vDBRef) {
234 boolean removed = _DBRefList.remove(vDBRef);
239 * Method removeDBRefAt.
242 * @return the element removed from the collection
244 public jalview.schemabinding.version2.DBRef removeDBRefAt(
246 java.lang.Object obj = this._DBRefList.remove(index);
247 return (jalview.schemabinding.version2.DBRef) obj;
255 * @throws java.lang.IndexOutOfBoundsException if the index
256 * given is outside the bounds of the collection
258 public void setDBRef(
260 final jalview.schemabinding.version2.DBRef vDBRef)
261 throws java.lang.IndexOutOfBoundsException {
262 // check bounds for index
263 if (index < 0 || index >= this._DBRefList.size()) {
264 throw new IndexOutOfBoundsException("setDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
267 this._DBRefList.set(index, vDBRef);
275 public void setDBRef(
276 final jalview.schemabinding.version2.DBRef[] vDBRefArray) {
280 for (int i = 0; i < vDBRefArray.length; i++) {
281 this._DBRefList.add(vDBRefArray[i]);
286 * Sets the value of field 'dsseqid'. The field 'dsseqid' has
287 * the following description: dataset sequence id for this
288 * sequence. Will be created as union of sequences.
291 * @param dsseqid the value of field 'dsseqid'.
293 public void setDsseqid(
294 final java.lang.String dsseqid) {
295 this._dsseqid = dsseqid;
302 * @throws org.exolab.castor.xml.MarshalException if object is
303 * null or if any SAXException is thrown during marshaling
304 * @throws org.exolab.castor.xml.ValidationException if this
305 * object is an invalid instance according to the schema
306 * @return the unmarshaled
307 * jalview.schemabinding.version2.SequenceType
309 public static jalview.schemabinding.version2.SequenceType unmarshal(
310 final java.io.Reader reader)
311 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
312 return (jalview.schemabinding.version2.SequenceType) Unmarshaller.unmarshal(jalview.schemabinding.version2.Sequence.class, reader);
318 * @throws org.exolab.castor.xml.ValidationException if this
319 * object is an invalid instance according to the schema
321 public void validate(
323 throws org.exolab.castor.xml.ValidationException {
324 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
325 validator.validate(this);