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