update author list in license for (JAL-826)
[jalview.git] / src / jalview / schemabinding / version2 / Sequence.java
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
4  *
5  * This file is part of Jalview.
6  *
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.
10  *
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.
15  *
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  *******************************************************************************/
18 /*
19  * This class was automatically generated with 
20  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
21  * Schema.
22  * $Id$
23  */
24
25 package jalview.schemabinding.version2;
26
27   //---------------------------------/
28  //- Imported classes and packages -/
29 //---------------------------------/
30
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
33
34 /**
35  * Class Sequence.
36  * 
37  * @version $Revision$ $Date$
38  */
39 public class Sequence extends jalview.schemabinding.version2.SequenceType 
40 implements java.io.Serializable
41 {
42
43
44       //--------------------------/
45      //- Class/Member Variables -/
46     //--------------------------/
47
48     /**
49      * dataset sequence id for this sequence. Will be created as
50      * union of sequences.
51      *  
52      */
53     private java.lang.String _dsseqid;
54
55     /**
56      * Field _DBRefList.
57      */
58     private java.util.Vector _DBRefList;
59
60
61       //----------------/
62      //- Constructors -/
63     //----------------/
64
65     public Sequence() {
66         super();
67         this._DBRefList = new java.util.Vector();
68     }
69
70
71       //-----------/
72      //- Methods -/
73     //-----------/
74
75     /**
76      * 
77      * 
78      * @param vDBRef
79      * @throws java.lang.IndexOutOfBoundsException if the index
80      * given is outside the bounds of the collection
81      */
82     public void addDBRef(
83             final jalview.schemabinding.version2.DBRef vDBRef)
84     throws java.lang.IndexOutOfBoundsException {
85         this._DBRefList.addElement(vDBRef);
86     }
87
88     /**
89      * 
90      * 
91      * @param index
92      * @param vDBRef
93      * @throws java.lang.IndexOutOfBoundsException if the index
94      * given is outside the bounds of the collection
95      */
96     public void addDBRef(
97             final int index,
98             final jalview.schemabinding.version2.DBRef vDBRef)
99     throws java.lang.IndexOutOfBoundsException {
100         this._DBRefList.add(index, vDBRef);
101     }
102
103     /**
104      * Method enumerateDBRef.
105      * 
106      * @return an Enumeration over all
107      * jalview.schemabinding.version2.DBRef elements
108      */
109     public java.util.Enumeration enumerateDBRef(
110     ) {
111         return this._DBRefList.elements();
112     }
113
114     /**
115      * Method getDBRef.
116      * 
117      * @param index
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
122      */
123     public jalview.schemabinding.version2.DBRef getDBRef(
124             final int index)
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) + "]");
129         }
130         
131         return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
132     }
133
134     /**
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.
140      * 
141      * @return this collection as an Array
142      */
143     public jalview.schemabinding.version2.DBRef[] getDBRef(
144     ) {
145         jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
146         return (jalview.schemabinding.version2.DBRef[]) this._DBRefList.toArray(array);
147     }
148
149     /**
150      * Method getDBRefCount.
151      * 
152      * @return the size of this collection
153      */
154     public int getDBRefCount(
155     ) {
156         return this._DBRefList.size();
157     }
158
159     /**
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.
163      *  
164      * 
165      * @return the value of field 'Dsseqid'.
166      */
167     public java.lang.String getDsseqid(
168     ) {
169         return this._dsseqid;
170     }
171
172     /**
173      * Method isValid.
174      * 
175      * @return true if this object is valid according to the schema
176      */
177     public boolean isValid(
178     ) {
179         try {
180             validate();
181         } catch (org.exolab.castor.xml.ValidationException vex) {
182             return false;
183         }
184         return true;
185     }
186
187     /**
188      * 
189      * 
190      * @param out
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
195      */
196     public void marshal(
197             final java.io.Writer out)
198     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
199         Marshaller.marshal(this, out);
200     }
201
202     /**
203      * 
204      * 
205      * @param handler
206      * @throws java.io.IOException if an IOException occurs during
207      * marshaling
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
212      */
213     public void marshal(
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);
217     }
218
219     /**
220      */
221     public void removeAllDBRef(
222     ) {
223         this._DBRefList.clear();
224     }
225
226     /**
227      * Method removeDBRef.
228      * 
229      * @param vDBRef
230      * @return true if the object was removed from the collection.
231      */
232     public boolean removeDBRef(
233             final jalview.schemabinding.version2.DBRef vDBRef) {
234         boolean removed = _DBRefList.remove(vDBRef);
235         return removed;
236     }
237
238     /**
239      * Method removeDBRefAt.
240      * 
241      * @param index
242      * @return the element removed from the collection
243      */
244     public jalview.schemabinding.version2.DBRef removeDBRefAt(
245             final int index) {
246         java.lang.Object obj = this._DBRefList.remove(index);
247         return (jalview.schemabinding.version2.DBRef) obj;
248     }
249
250     /**
251      * 
252      * 
253      * @param index
254      * @param vDBRef
255      * @throws java.lang.IndexOutOfBoundsException if the index
256      * given is outside the bounds of the collection
257      */
258     public void setDBRef(
259             final int index,
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) + "]");
265         }
266         
267         this._DBRefList.set(index, vDBRef);
268     }
269
270     /**
271      * 
272      * 
273      * @param vDBRefArray
274      */
275     public void setDBRef(
276             final jalview.schemabinding.version2.DBRef[] vDBRefArray) {
277         //-- copy array
278         _DBRefList.clear();
279         
280         for (int i = 0; i < vDBRefArray.length; i++) {
281                 this._DBRefList.add(vDBRefArray[i]);
282         }
283     }
284
285     /**
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.
289      *  
290      * 
291      * @param dsseqid the value of field 'dsseqid'.
292      */
293     public void setDsseqid(
294             final java.lang.String dsseqid) {
295         this._dsseqid = dsseqid;
296     }
297
298     /**
299      * Method unmarshal.
300      * 
301      * @param reader
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
308      */
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);
313     }
314
315     /**
316      * 
317      * 
318      * @throws org.exolab.castor.xml.ValidationException if this
319      * object is an invalid instance according to the schema
320      */
321     public void validate(
322     )
323     throws org.exolab.castor.xml.ValidationException {
324         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
325         validator.validate(this);
326     }
327
328 }