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