Formatting changes
[jalview.git] / src / jalview / binding / JalviewUserColours.java
1 /*\r
2  * This class was automatically generated with\r
3  * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
4  * Schema.\r
5  * $Id$\r
6  */\r
7 package jalview.binding;\r
8 \r
9 import org.exolab.castor.xml.MarshalException;\r
10 import org.exolab.castor.xml.Marshaller;\r
11 import org.exolab.castor.xml.Unmarshaller;\r
12 import org.exolab.castor.xml.ValidationException;\r
13 \r
14 import org.xml.sax.ContentHandler;\r
15 \r
16 //---------------------------------/\r
17 //- Imported classes and packages -/\r
18 //---------------------------------/\r
19 import java.io.IOException;\r
20 import java.io.Reader;\r
21 import java.io.Serializable;\r
22 import java.io.Writer;\r
23 \r
24 import java.util.Enumeration;\r
25 import java.util.Vector;\r
26 \r
27 \r
28 /**\r
29  * Class JalviewUserColours.\r
30  *\r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class JalviewUserColours implements java.io.Serializable\r
34 {\r
35     //--------------------------/\r
36     //- Class/Member Variables -/\r
37     //--------------------------/\r
38 \r
39     /**\r
40      * Field _colourList\r
41      */\r
42     private java.util.Vector _colourList;\r
43 \r
44     //----------------/\r
45     //- Constructors -/\r
46     //----------------/\r
47     public JalviewUserColours()\r
48     {\r
49         super();\r
50         _colourList = new Vector();\r
51     }\r
52 \r
53     //-- jalview.binding.JalviewUserColours()\r
54     //-----------/\r
55 \r
56     /**\r
57      * DOCUMENT ME!\r
58      *\r
59      * @param vColour DOCUMENT ME!\r
60      *\r
61      * @throws java.lang.IndexOutOfBoundsException DOCUMENT ME!\r
62      */\r
63     public void addColour(jalview.binding.Colour vColour)\r
64         throws java.lang.IndexOutOfBoundsException\r
65     {\r
66         _colourList.addElement(vColour);\r
67     }\r
68 \r
69     //-- void addColour(jalview.binding.Colour) \r
70 \r
71     /**\r
72      * Method addColour\r
73      *\r
74      *\r
75      *\r
76      * @param index\r
77      * @param vColour\r
78      */\r
79     public void addColour(int index, jalview.binding.Colour vColour)\r
80         throws java.lang.IndexOutOfBoundsException\r
81     {\r
82         _colourList.insertElementAt(vColour, index);\r
83     }\r
84 \r
85     //-- void addColour(int, jalview.binding.Colour) \r
86 \r
87     /**\r
88      * Method enumerateColour\r
89      *\r
90      *\r
91      *\r
92      * @return Enumeration\r
93      */\r
94     public java.util.Enumeration enumerateColour()\r
95     {\r
96         return _colourList.elements();\r
97     }\r
98 \r
99     //-- java.util.Enumeration enumerateColour() \r
100 \r
101     /**\r
102      * Method getColour\r
103      *\r
104      *\r
105      *\r
106      * @param index\r
107      * @return Colour\r
108      */\r
109     public jalview.binding.Colour getColour(int index)\r
110         throws java.lang.IndexOutOfBoundsException\r
111     {\r
112         //-- check bounds for index\r
113         if ((index < 0) || (index > _colourList.size()))\r
114         {\r
115             throw new IndexOutOfBoundsException();\r
116         }\r
117 \r
118         return (jalview.binding.Colour) _colourList.elementAt(index);\r
119     }\r
120 \r
121     //-- jalview.binding.Colour getColour(int) \r
122 \r
123     /**\r
124      * Method getColour\r
125      *\r
126      *\r
127      *\r
128      * @return Colour\r
129      */\r
130     public jalview.binding.Colour[] getColour()\r
131     {\r
132         int size = _colourList.size();\r
133         jalview.binding.Colour[] mArray = new jalview.binding.Colour[size];\r
134 \r
135         for (int index = 0; index < size; index++)\r
136         {\r
137             mArray[index] = (jalview.binding.Colour) _colourList.elementAt(index);\r
138         }\r
139 \r
140         return mArray;\r
141     }\r
142 \r
143     //-- jalview.binding.Colour[] getColour() \r
144 \r
145     /**\r
146      * Method getColourCount\r
147      *\r
148      *\r
149      *\r
150      * @return int\r
151      */\r
152     public int getColourCount()\r
153     {\r
154         return _colourList.size();\r
155     }\r
156 \r
157     //-- int getColourCount() \r
158 \r
159     /**\r
160      * Method isValid\r
161      *\r
162      *\r
163      *\r
164      * @return boolean\r
165      */\r
166     public boolean isValid()\r
167     {\r
168         try\r
169         {\r
170             validate();\r
171         }\r
172         catch (org.exolab.castor.xml.ValidationException vex)\r
173         {\r
174             return false;\r
175         }\r
176 \r
177         return true;\r
178     }\r
179 \r
180     //-- boolean isValid() \r
181 \r
182     /**\r
183      * Method marshal\r
184      *\r
185      *\r
186      *\r
187      * @param out\r
188      */\r
189     public void marshal(java.io.Writer out)\r
190         throws org.exolab.castor.xml.MarshalException, \r
191             org.exolab.castor.xml.ValidationException\r
192     {\r
193         Marshaller.marshal(this, out);\r
194     }\r
195 \r
196     //-- void marshal(java.io.Writer) \r
197 \r
198     /**\r
199      * Method marshal\r
200      *\r
201      *\r
202      *\r
203      * @param handler\r
204      */\r
205     public void marshal(org.xml.sax.ContentHandler handler)\r
206         throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
207             org.exolab.castor.xml.ValidationException\r
208     {\r
209         Marshaller.marshal(this, handler);\r
210     }\r
211 \r
212     //-- void marshal(org.xml.sax.ContentHandler) \r
213 \r
214     /**\r
215      * Method removeAllColour\r
216      *\r
217      */\r
218     public void removeAllColour()\r
219     {\r
220         _colourList.removeAllElements();\r
221     }\r
222 \r
223     //-- void removeAllColour() \r
224 \r
225     /**\r
226      * Method removeColour\r
227      *\r
228      *\r
229      *\r
230      * @param index\r
231      * @return Colour\r
232      */\r
233     public jalview.binding.Colour removeColour(int index)\r
234     {\r
235         java.lang.Object obj = _colourList.elementAt(index);\r
236         _colourList.removeElementAt(index);\r
237 \r
238         return (jalview.binding.Colour) obj;\r
239     }\r
240 \r
241     //-- jalview.binding.Colour removeColour(int) \r
242 \r
243     /**\r
244      * Method setColour\r
245      *\r
246      *\r
247      *\r
248      * @param index\r
249      * @param vColour\r
250      */\r
251     public void setColour(int index, jalview.binding.Colour vColour)\r
252         throws java.lang.IndexOutOfBoundsException\r
253     {\r
254         //-- check bounds for index\r
255         if ((index < 0) || (index > _colourList.size()))\r
256         {\r
257             throw new IndexOutOfBoundsException();\r
258         }\r
259 \r
260         _colourList.setElementAt(vColour, index);\r
261     }\r
262 \r
263     //-- void setColour(int, jalview.binding.Colour) \r
264 \r
265     /**\r
266      * Method setColour\r
267      *\r
268      *\r
269      *\r
270      * @param colourArray\r
271      */\r
272     public void setColour(jalview.binding.Colour[] colourArray)\r
273     {\r
274         //-- copy array\r
275         _colourList.removeAllElements();\r
276 \r
277         for (int i = 0; i < colourArray.length; i++)\r
278         {\r
279             _colourList.addElement(colourArray[i]);\r
280         }\r
281     }\r
282 \r
283     //-- void setColour(jalview.binding.Colour) \r
284 \r
285     /**\r
286      * Method unmarshal\r
287      *\r
288      *\r
289      *\r
290      * @param reader\r
291      * @return Object\r
292      */\r
293     public static java.lang.Object unmarshal(java.io.Reader reader)\r
294         throws org.exolab.castor.xml.MarshalException, \r
295             org.exolab.castor.xml.ValidationException\r
296     {\r
297         return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class,\r
298             reader);\r
299     }\r
300 \r
301     //-- java.lang.Object unmarshal(java.io.Reader) \r
302 \r
303     /**\r
304      * Method validate\r
305      *\r
306      */\r
307     public void validate() throws org.exolab.castor.xml.ValidationException\r
308     {\r
309         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
310         validator.validate(this);\r
311     }\r
312 \r
313     //-- void validate() \r
314 }\r