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