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