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 Sequence extends jalview.schemabinding.version2.SequenceType
\r
34 implements java.io.Serializable
\r
38 //--------------------------/
\r
39 //- Class/Member Variables -/
\r
40 //--------------------------/
\r
43 * dataset sequence id for this sequence. Will be created as
\r
44 * union of sequences.
\r
47 private java.lang.String _dsseqid;
\r
52 private java.util.Vector _DBRefList;
\r
61 this._DBRefList = new java.util.Vector();
\r
73 * @throws java.lang.IndexOutOfBoundsException if the index
\r
74 * given is outside the bounds of the collection
\r
76 public void addDBRef(
\r
77 final jalview.schemabinding.version2.DBRef vDBRef)
\r
78 throws java.lang.IndexOutOfBoundsException {
\r
79 this._DBRefList.addElement(vDBRef);
\r
87 * @throws java.lang.IndexOutOfBoundsException if the index
\r
88 * given is outside the bounds of the collection
\r
90 public void addDBRef(
\r
92 final jalview.schemabinding.version2.DBRef vDBRef)
\r
93 throws java.lang.IndexOutOfBoundsException {
\r
94 this._DBRefList.add(index, vDBRef);
\r
98 * Method enumerateDBRef.
\r
100 * @return an Enumeration over all
\r
101 * jalview.schemabinding.version2.DBRef elements
\r
103 public java.util.Enumeration enumerateDBRef(
\r
105 return this._DBRefList.elements();
\r
112 * @throws java.lang.IndexOutOfBoundsException if the index
\r
113 * given is outside the bounds of the collection
\r
114 * @return the value of the
\r
115 * jalview.schemabinding.version2.DBRef at the given index
\r
117 public jalview.schemabinding.version2.DBRef getDBRef(
\r
119 throws java.lang.IndexOutOfBoundsException {
\r
120 // check bounds for index
\r
121 if (index < 0 || index >= this._DBRefList.size()) {
\r
122 throw new IndexOutOfBoundsException("getDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
\r
125 return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
\r
129 * Method getDBRef.Returns the contents of the collection in an
\r
130 * Array. <p>Note: Just in case the collection contents are
\r
131 * changing in another thread, we pass a 0-length Array of the
\r
132 * correct type into the API call. This way we <i>know</i>
\r
133 * that the Array returned is of exactly the correct length.
\r
135 * @return this collection as an Array
\r
137 public jalview.schemabinding.version2.DBRef[] getDBRef(
\r
139 jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
\r
140 return (jalview.schemabinding.version2.DBRef[]) this._DBRefList.toArray(array);
\r
144 * Method getDBRefCount.
\r
146 * @return the size of this collection
\r
148 public int getDBRefCount(
\r
150 return this._DBRefList.size();
\r
154 * Returns the value of field 'dsseqid'. The field 'dsseqid'
\r
155 * has the following description: dataset sequence id for this
\r
156 * sequence. Will be created as union of sequences.
\r
159 * @return the value of field 'Dsseqid'.
\r
161 public java.lang.String getDsseqid(
\r
163 return this._dsseqid;
\r
169 * @return true if this object is valid according to the schema
\r
171 public boolean isValid(
\r
175 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
185 * @throws org.exolab.castor.xml.MarshalException if object is
\r
186 * null or if any SAXException is thrown during marshaling
\r
187 * @throws org.exolab.castor.xml.ValidationException if this
\r
188 * object is an invalid instance according to the schema
\r
190 public void marshal(
\r
191 final java.io.Writer out)
\r
192 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
193 Marshaller.marshal(this, out);
\r
200 * @throws java.io.IOException if an IOException occurs during
\r
202 * @throws org.exolab.castor.xml.ValidationException if this
\r
203 * object is an invalid instance according to the schema
\r
204 * @throws org.exolab.castor.xml.MarshalException if object is
\r
205 * null or if any SAXException is thrown during marshaling
\r
207 public void marshal(
\r
208 final org.xml.sax.ContentHandler handler)
\r
209 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
210 Marshaller.marshal(this, handler);
\r
215 public void removeAllDBRef(
\r
217 this._DBRefList.clear();
\r
221 * Method removeDBRef.
\r
224 * @return true if the object was removed from the collection.
\r
226 public boolean removeDBRef(
\r
227 final jalview.schemabinding.version2.DBRef vDBRef) {
\r
228 boolean removed = _DBRefList.remove(vDBRef);
\r
233 * Method removeDBRefAt.
\r
236 * @return the element removed from the collection
\r
238 public jalview.schemabinding.version2.DBRef removeDBRefAt(
\r
240 java.lang.Object obj = this._DBRefList.remove(index);
\r
241 return (jalview.schemabinding.version2.DBRef) obj;
\r
249 * @throws java.lang.IndexOutOfBoundsException if the index
\r
250 * given is outside the bounds of the collection
\r
252 public void setDBRef(
\r
254 final jalview.schemabinding.version2.DBRef vDBRef)
\r
255 throws java.lang.IndexOutOfBoundsException {
\r
256 // check bounds for index
\r
257 if (index < 0 || index >= this._DBRefList.size()) {
\r
258 throw new IndexOutOfBoundsException("setDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
\r
261 this._DBRefList.set(index, vDBRef);
\r
267 * @param vDBRefArray
\r
269 public void setDBRef(
\r
270 final jalview.schemabinding.version2.DBRef[] vDBRefArray) {
\r
272 _DBRefList.clear();
\r
274 for (int i = 0; i < vDBRefArray.length; i++) {
\r
275 this._DBRefList.add(vDBRefArray[i]);
\r
280 * Sets the value of field 'dsseqid'. The field 'dsseqid' has
\r
281 * the following description: dataset sequence id for this
\r
282 * sequence. Will be created as union of sequences.
\r
285 * @param dsseqid the value of field 'dsseqid'.
\r
287 public void setDsseqid(
\r
288 final java.lang.String dsseqid) {
\r
289 this._dsseqid = dsseqid;
\r
293 * Method unmarshal.
\r
296 * @throws org.exolab.castor.xml.MarshalException if object is
\r
297 * null or if any SAXException is thrown during marshaling
\r
298 * @throws org.exolab.castor.xml.ValidationException if this
\r
299 * object is an invalid instance according to the schema
\r
300 * @return the unmarshaled
\r
301 * jalview.schemabinding.version2.SequenceType
\r
303 public static jalview.schemabinding.version2.SequenceType unmarshal(
\r
304 final java.io.Reader reader)
\r
305 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
306 return (jalview.schemabinding.version2.SequenceType) Unmarshaller.unmarshal(jalview.schemabinding.version2.Sequence.class, reader);
\r
312 * @throws org.exolab.castor.xml.ValidationException if this
\r
313 * object is an invalid instance according to the schema
\r
315 public void validate(
\r
317 throws org.exolab.castor.xml.ValidationException {
\r
318 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
319 validator.validate(this);
\r