1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $(date) 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.
20 *******************************************************************************/
22 * This class was automatically generated with
23 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
28 package jalview.schemabinding.version2;
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
40 * @version $Revision$ $Date$
42 public class Sequence extends jalview.schemabinding.version2.SequenceType
43 implements java.io.Serializable
46 // --------------------------/
47 // - Class/Member Variables -/
48 // --------------------------/
51 * dataset sequence id for this sequence. Will be created as union of
55 private java.lang.String _dsseqid;
60 private java.util.Vector _DBRefList;
69 this._DBRefList = new java.util.Vector();
80 * @throws java.lang.IndexOutOfBoundsException
81 * if the index given is outside the bounds of the collection
83 public void addDBRef(final jalview.schemabinding.version2.DBRef vDBRef)
84 throws java.lang.IndexOutOfBoundsException
86 this._DBRefList.addElement(vDBRef);
94 * @throws java.lang.IndexOutOfBoundsException
95 * if the index given is outside the bounds of the collection
97 public void addDBRef(final int index,
98 final jalview.schemabinding.version2.DBRef vDBRef)
99 throws java.lang.IndexOutOfBoundsException
101 this._DBRefList.add(index, vDBRef);
105 * Method enumerateDBRef.
107 * @return an Enumeration over all jalview.schemabinding.version2.DBRef
110 public java.util.Enumeration enumerateDBRef()
112 return this._DBRefList.elements();
119 * @throws java.lang.IndexOutOfBoundsException
120 * if the index given is outside the bounds of the collection
121 * @return the value of the jalview.schemabinding.version2.DBRef at the given
124 public jalview.schemabinding.version2.DBRef getDBRef(final int index)
125 throws java.lang.IndexOutOfBoundsException
127 // check bounds for index
128 if (index < 0 || index >= this._DBRefList.size())
130 throw new IndexOutOfBoundsException("getDBRef: Index value '" + index
131 + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
134 return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
138 * Method getDBRef.Returns the contents of the collection in an Array.
140 * Note: Just in case the collection contents are changing in another thread,
141 * we pass a 0-length Array of the correct type into the API call. This way we
142 * <i>know</i> that the Array returned is of exactly the correct length.
144 * @return this collection as an Array
146 public jalview.schemabinding.version2.DBRef[] getDBRef()
148 jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
149 return (jalview.schemabinding.version2.DBRef[]) this._DBRefList
154 * Method getDBRefCount.
156 * @return the size of this collection
158 public int getDBRefCount()
160 return this._DBRefList.size();
164 * Returns the value of field 'dsseqid'. The field 'dsseqid' has the following
165 * description: dataset sequence id for this sequence. Will be created as
166 * union of sequences.
169 * @return the value of field 'Dsseqid'.
171 public java.lang.String getDsseqid()
173 return this._dsseqid;
179 * @return true if this object is valid according to the schema
181 public boolean isValid()
186 } catch (org.exolab.castor.xml.ValidationException vex)
197 * @throws org.exolab.castor.xml.MarshalException
198 * if object is null or if any SAXException is thrown during
200 * @throws org.exolab.castor.xml.ValidationException
201 * if this object is an invalid instance according to the schema
203 public void marshal(final java.io.Writer out)
204 throws org.exolab.castor.xml.MarshalException,
205 org.exolab.castor.xml.ValidationException
207 Marshaller.marshal(this, out);
214 * @throws java.io.IOException
215 * if an IOException occurs during marshaling
216 * @throws org.exolab.castor.xml.ValidationException
217 * if this object is an invalid instance according to the schema
218 * @throws org.exolab.castor.xml.MarshalException
219 * if object is null or if any SAXException is thrown during
222 public void marshal(final org.xml.sax.ContentHandler handler)
223 throws java.io.IOException,
224 org.exolab.castor.xml.MarshalException,
225 org.exolab.castor.xml.ValidationException
227 Marshaller.marshal(this, handler);
232 public void removeAllDBRef()
234 this._DBRefList.clear();
238 * Method removeDBRef.
241 * @return true if the object was removed from the collection.
243 public boolean removeDBRef(
244 final jalview.schemabinding.version2.DBRef vDBRef)
246 boolean removed = _DBRefList.remove(vDBRef);
251 * Method removeDBRefAt.
254 * @return the element removed from the collection
256 public jalview.schemabinding.version2.DBRef removeDBRefAt(final int index)
258 java.lang.Object obj = this._DBRefList.remove(index);
259 return (jalview.schemabinding.version2.DBRef) obj;
267 * @throws java.lang.IndexOutOfBoundsException
268 * if the index given is outside the bounds of the collection
270 public void setDBRef(final int index,
271 final jalview.schemabinding.version2.DBRef vDBRef)
272 throws java.lang.IndexOutOfBoundsException
274 // check bounds for index
275 if (index < 0 || index >= this._DBRefList.size())
277 throw new IndexOutOfBoundsException("setDBRef: Index value '" + index
278 + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
281 this._DBRefList.set(index, vDBRef);
289 public void setDBRef(
290 final jalview.schemabinding.version2.DBRef[] vDBRefArray)
295 for (int i = 0; i < vDBRefArray.length; i++)
297 this._DBRefList.add(vDBRefArray[i]);
302 * Sets the value of field 'dsseqid'. The field 'dsseqid' has the following
303 * description: dataset sequence id for this sequence. Will be created as
304 * union of sequences.
308 * the value of field 'dsseqid'.
310 public void setDsseqid(final java.lang.String dsseqid)
312 this._dsseqid = dsseqid;
319 * @throws org.exolab.castor.xml.MarshalException
320 * if object is null or if any SAXException is thrown during
322 * @throws org.exolab.castor.xml.ValidationException
323 * if this object is an invalid instance according to the schema
324 * @return the unmarshaled jalview.schemabinding.version2.SequenceType
326 public static jalview.schemabinding.version2.SequenceType unmarshal(
327 final java.io.Reader reader)
328 throws org.exolab.castor.xml.MarshalException,
329 org.exolab.castor.xml.ValidationException
331 return (jalview.schemabinding.version2.SequenceType) Unmarshaller
332 .unmarshal(jalview.schemabinding.version2.Sequence.class,
339 * @throws org.exolab.castor.xml.ValidationException
340 * if this object is an invalid instance according to the schema
342 public void validate() throws org.exolab.castor.xml.ValidationException
344 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
345 validator.validate(this);