Saves trees
[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 _colourList\r
40      */\r
41     private java.util.Vector _colourList;\r
42 \r
43 \r
44       //----------------/\r
45      //- Constructors -/\r
46     //----------------/\r
47 \r
48     public JalviewUserColours() {\r
49         super();\r
50         _colourList = new Vector();\r
51     } //-- jalview.binding.JalviewUserColours()\r
52 \r
53 \r
54       //-----------/\r
55      //- Methods -/\r
56     //-----------/\r
57 \r
58     /**\r
59      * Method addColour\r
60      * \r
61      * \r
62      * \r
63      * @param vColour\r
64      */\r
65     public void addColour(jalview.binding.Colour vColour)\r
66         throws java.lang.IndexOutOfBoundsException\r
67     {\r
68         _colourList.addElement(vColour);\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     } //-- void addColour(int, jalview.binding.Colour) \r
84 \r
85     /**\r
86      * Method enumerateColour\r
87      * \r
88      * \r
89      * \r
90      * @return Enumeration\r
91      */\r
92     public java.util.Enumeration enumerateColour()\r
93     {\r
94         return _colourList.elements();\r
95     } //-- java.util.Enumeration enumerateColour() \r
96 \r
97     /**\r
98      * Method getColour\r
99      * \r
100      * \r
101      * \r
102      * @param index\r
103      * @return Colour\r
104      */\r
105     public jalview.binding.Colour getColour(int index)\r
106         throws java.lang.IndexOutOfBoundsException\r
107     {\r
108         //-- check bounds for index\r
109         if ((index < 0) || (index > _colourList.size())) {\r
110             throw new IndexOutOfBoundsException();\r
111         }\r
112         \r
113         return (jalview.binding.Colour) _colourList.elementAt(index);\r
114     } //-- jalview.binding.Colour getColour(int) \r
115 \r
116     /**\r
117      * Method getColour\r
118      * \r
119      * \r
120      * \r
121      * @return Colour\r
122      */\r
123     public jalview.binding.Colour[] getColour()\r
124     {\r
125         int size = _colourList.size();\r
126         jalview.binding.Colour[] mArray = new jalview.binding.Colour[size];\r
127         for (int index = 0; index < size; index++) {\r
128             mArray[index] = (jalview.binding.Colour) _colourList.elementAt(index);\r
129         }\r
130         return mArray;\r
131     } //-- jalview.binding.Colour[] getColour() \r
132 \r
133     /**\r
134      * Method getColourCount\r
135      * \r
136      * \r
137      * \r
138      * @return int\r
139      */\r
140     public int getColourCount()\r
141     {\r
142         return _colourList.size();\r
143     } //-- int getColourCount() \r
144 \r
145     /**\r
146      * Method isValid\r
147      * \r
148      * \r
149      * \r
150      * @return boolean\r
151      */\r
152     public boolean isValid()\r
153     {\r
154         try {\r
155             validate();\r
156         }\r
157         catch (org.exolab.castor.xml.ValidationException vex) {\r
158             return false;\r
159         }\r
160         return true;\r
161     } //-- boolean isValid() \r
162 \r
163     /**\r
164      * Method marshal\r
165      * \r
166      * \r
167      * \r
168      * @param out\r
169      */\r
170     public void marshal(java.io.Writer out)\r
171         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
172     {\r
173         \r
174         Marshaller.marshal(this, out);\r
175     } //-- void marshal(java.io.Writer) \r
176 \r
177     /**\r
178      * Method marshal\r
179      * \r
180      * \r
181      * \r
182      * @param handler\r
183      */\r
184     public void marshal(org.xml.sax.ContentHandler handler)\r
185         throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
186     {\r
187         \r
188         Marshaller.marshal(this, handler);\r
189     } //-- void marshal(org.xml.sax.ContentHandler) \r
190 \r
191     /**\r
192      * Method removeAllColour\r
193      * \r
194      */\r
195     public void removeAllColour()\r
196     {\r
197         _colourList.removeAllElements();\r
198     } //-- void removeAllColour() \r
199 \r
200     /**\r
201      * Method removeColour\r
202      * \r
203      * \r
204      * \r
205      * @param index\r
206      * @return Colour\r
207      */\r
208     public jalview.binding.Colour removeColour(int index)\r
209     {\r
210         java.lang.Object obj = _colourList.elementAt(index);\r
211         _colourList.removeElementAt(index);\r
212         return (jalview.binding.Colour) obj;\r
213     } //-- jalview.binding.Colour removeColour(int) \r
214 \r
215     /**\r
216      * Method setColour\r
217      * \r
218      * \r
219      * \r
220      * @param index\r
221      * @param vColour\r
222      */\r
223     public void setColour(int index, jalview.binding.Colour vColour)\r
224         throws java.lang.IndexOutOfBoundsException\r
225     {\r
226         //-- check bounds for index\r
227         if ((index < 0) || (index > _colourList.size())) {\r
228             throw new IndexOutOfBoundsException();\r
229         }\r
230         _colourList.setElementAt(vColour, index);\r
231     } //-- void setColour(int, jalview.binding.Colour) \r
232 \r
233     /**\r
234      * Method setColour\r
235      * \r
236      * \r
237      * \r
238      * @param colourArray\r
239      */\r
240     public void setColour(jalview.binding.Colour[] colourArray)\r
241     {\r
242         //-- copy array\r
243         _colourList.removeAllElements();\r
244         for (int i = 0; i < colourArray.length; i++) {\r
245             _colourList.addElement(colourArray[i]);\r
246         }\r
247     } //-- void setColour(jalview.binding.Colour) \r
248 \r
249     /**\r
250      * Method unmarshal\r
251      * \r
252      * \r
253      * \r
254      * @param reader\r
255      * @return Object\r
256      */\r
257     public static java.lang.Object unmarshal(java.io.Reader reader)\r
258         throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
259     {\r
260         return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class, reader);\r
261     } //-- java.lang.Object unmarshal(java.io.Reader) \r
262 \r
263     /**\r
264      * Method validate\r
265      * \r
266      */\r
267     public void validate()\r
268         throws org.exolab.castor.xml.ValidationException\r
269     {\r
270         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
271         validator.validate(this);\r
272     } //-- void validate() \r
273 \r
274 }\r