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