14137d895bedfa0a66c6e4facd3cc931f52021bc
[jalview.git] / src / jalview / schemabinding / version2 / Sequence.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package jalview.schemabinding.version2;
9
10   //---------------------------------/
11  //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class Sequence.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class Sequence extends jalview.schemabinding.version2.SequenceType 
23 implements java.io.Serializable
24 {
25
26
27       //--------------------------/
28      //- Class/Member Variables -/
29     //--------------------------/
30
31     /**
32      * dataset sequence id for this sequence. Will be created as
33      * union of sequences.
34      *  
35      */
36     private java.lang.String _dsseqid;
37
38     /**
39      * Field _DBRefList.
40      */
41     private java.util.Vector _DBRefList;
42
43
44       //----------------/
45      //- Constructors -/
46     //----------------/
47
48     public Sequence() {
49         super();
50         this._DBRefList = new java.util.Vector();
51     }
52
53
54       //-----------/
55      //- Methods -/
56     //-----------/
57
58     /**
59      * 
60      * 
61      * @param vDBRef
62      * @throws java.lang.IndexOutOfBoundsException if the index
63      * given is outside the bounds of the collection
64      */
65     public void addDBRef(
66             final jalview.schemabinding.version2.DBRef vDBRef)
67     throws java.lang.IndexOutOfBoundsException {
68         this._DBRefList.addElement(vDBRef);
69     }
70
71     /**
72      * 
73      * 
74      * @param index
75      * @param vDBRef
76      * @throws java.lang.IndexOutOfBoundsException if the index
77      * given is outside the bounds of the collection
78      */
79     public void addDBRef(
80             final int index,
81             final jalview.schemabinding.version2.DBRef vDBRef)
82     throws java.lang.IndexOutOfBoundsException {
83         this._DBRefList.add(index, vDBRef);
84     }
85
86     /**
87      * Method enumerateDBRef.
88      * 
89      * @return an Enumeration over all
90      * jalview.schemabinding.version2.DBRef elements
91      */
92     public java.util.Enumeration enumerateDBRef(
93     ) {
94         return this._DBRefList.elements();
95     }
96
97     /**
98      * Method getDBRef.
99      * 
100      * @param index
101      * @throws java.lang.IndexOutOfBoundsException if the index
102      * given is outside the bounds of the collection
103      * @return the value of the
104      * jalview.schemabinding.version2.DBRef at the given index
105      */
106     public jalview.schemabinding.version2.DBRef getDBRef(
107             final int index)
108     throws java.lang.IndexOutOfBoundsException {
109         // check bounds for index
110         if (index < 0 || index >= this._DBRefList.size()) {
111             throw new IndexOutOfBoundsException("getDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
112         }
113         
114         return (jalview.schemabinding.version2.DBRef) _DBRefList.get(index);
115     }
116
117     /**
118      * Method getDBRef.Returns the contents of the collection in an
119      * Array.  <p>Note:  Just in case the collection contents are
120      * changing in another thread, we pass a 0-length Array of the
121      * correct type into the API call.  This way we <i>know</i>
122      * that the Array returned is of exactly the correct length.
123      * 
124      * @return this collection as an Array
125      */
126     public jalview.schemabinding.version2.DBRef[] getDBRef(
127     ) {
128         jalview.schemabinding.version2.DBRef[] array = new jalview.schemabinding.version2.DBRef[0];
129         return (jalview.schemabinding.version2.DBRef[]) this._DBRefList.toArray(array);
130     }
131
132     /**
133      * Method getDBRefCount.
134      * 
135      * @return the size of this collection
136      */
137     public int getDBRefCount(
138     ) {
139         return this._DBRefList.size();
140     }
141
142     /**
143      * Returns the value of field 'dsseqid'. The field 'dsseqid'
144      * has the following description: dataset sequence id for this
145      * sequence. Will be created as union of sequences.
146      *  
147      * 
148      * @return the value of field 'Dsseqid'.
149      */
150     public java.lang.String getDsseqid(
151     ) {
152         return this._dsseqid;
153     }
154
155     /**
156      * Method isValid.
157      * 
158      * @return true if this object is valid according to the schema
159      */
160     public boolean isValid(
161     ) {
162         try {
163             validate();
164         } catch (org.exolab.castor.xml.ValidationException vex) {
165             return false;
166         }
167         return true;
168     }
169
170     /**
171      * 
172      * 
173      * @param out
174      * @throws org.exolab.castor.xml.MarshalException if object is
175      * null or if any SAXException is thrown during marshaling
176      * @throws org.exolab.castor.xml.ValidationException if this
177      * object is an invalid instance according to the schema
178      */
179     public void marshal(
180             final java.io.Writer out)
181     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
182         Marshaller.marshal(this, out);
183     }
184
185     /**
186      * 
187      * 
188      * @param handler
189      * @throws java.io.IOException if an IOException occurs during
190      * marshaling
191      * @throws org.exolab.castor.xml.ValidationException if this
192      * object is an invalid instance according to the schema
193      * @throws org.exolab.castor.xml.MarshalException if object is
194      * null or if any SAXException is thrown during marshaling
195      */
196     public void marshal(
197             final org.xml.sax.ContentHandler handler)
198     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
199         Marshaller.marshal(this, handler);
200     }
201
202     /**
203      */
204     public void removeAllDBRef(
205     ) {
206         this._DBRefList.clear();
207     }
208
209     /**
210      * Method removeDBRef.
211      * 
212      * @param vDBRef
213      * @return true if the object was removed from the collection.
214      */
215     public boolean removeDBRef(
216             final jalview.schemabinding.version2.DBRef vDBRef) {
217         boolean removed = _DBRefList.remove(vDBRef);
218         return removed;
219     }
220
221     /**
222      * Method removeDBRefAt.
223      * 
224      * @param index
225      * @return the element removed from the collection
226      */
227     public jalview.schemabinding.version2.DBRef removeDBRefAt(
228             final int index) {
229         java.lang.Object obj = this._DBRefList.remove(index);
230         return (jalview.schemabinding.version2.DBRef) obj;
231     }
232
233     /**
234      * 
235      * 
236      * @param index
237      * @param vDBRef
238      * @throws java.lang.IndexOutOfBoundsException if the index
239      * given is outside the bounds of the collection
240      */
241     public void setDBRef(
242             final int index,
243             final jalview.schemabinding.version2.DBRef vDBRef)
244     throws java.lang.IndexOutOfBoundsException {
245         // check bounds for index
246         if (index < 0 || index >= this._DBRefList.size()) {
247             throw new IndexOutOfBoundsException("setDBRef: Index value '" + index + "' not in range [0.." + (this._DBRefList.size() - 1) + "]");
248         }
249         
250         this._DBRefList.set(index, vDBRef);
251     }
252
253     /**
254      * 
255      * 
256      * @param vDBRefArray
257      */
258     public void setDBRef(
259             final jalview.schemabinding.version2.DBRef[] vDBRefArray) {
260         //-- copy array
261         _DBRefList.clear();
262         
263         for (int i = 0; i < vDBRefArray.length; i++) {
264                 this._DBRefList.add(vDBRefArray[i]);
265         }
266     }
267
268     /**
269      * Sets the value of field 'dsseqid'. The field 'dsseqid' has
270      * the following description: dataset sequence id for this
271      * sequence. Will be created as union of sequences.
272      *  
273      * 
274      * @param dsseqid the value of field 'dsseqid'.
275      */
276     public void setDsseqid(
277             final java.lang.String dsseqid) {
278         this._dsseqid = dsseqid;
279     }
280
281     /**
282      * Method unmarshal.
283      * 
284      * @param reader
285      * @throws org.exolab.castor.xml.MarshalException if object is
286      * null or if any SAXException is thrown during marshaling
287      * @throws org.exolab.castor.xml.ValidationException if this
288      * object is an invalid instance according to the schema
289      * @return the unmarshaled
290      * jalview.schemabinding.version2.SequenceType
291      */
292     public static jalview.schemabinding.version2.SequenceType unmarshal(
293             final java.io.Reader reader)
294     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
295         return (jalview.schemabinding.version2.SequenceType) Unmarshaller.unmarshal(jalview.schemabinding.version2.Sequence.class, reader);
296     }
297
298     /**
299      * 
300      * 
301      * @throws org.exolab.castor.xml.ValidationException if this
302      * object is an invalid instance according to the schema
303      */
304     public void validate(
305     )
306     throws org.exolab.castor.xml.ValidationException {
307         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
308         validator.validate(this);
309     }
310
311 }