Merge branch 'feature/JAL-3063JAXB' into feature/JAL-3063jaxbNoCastor
[jalview.git] / src / jalview / schemabinding / version2 / JalviewUserColours.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package jalview.schemabinding.version2;
9
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class JalviewUserColours.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class JalviewUserColours implements java.io.Serializable
23 {
24
25   // --------------------------/
26   // - Class/Member Variables -/
27   // --------------------------/
28
29   /**
30    * Field _schemeName.
31    */
32   private java.lang.String _schemeName;
33
34   /**
35    * Jalview colour scheme document version.
36    * 
37    */
38   private java.lang.String _version;
39
40   /**
41    * Field _colourList.
42    */
43   private java.util.Vector _colourList;
44
45   /**
46    * Field _filterList.
47    */
48   private java.util.Vector _filterList;
49
50   // ----------------/
51   // - Constructors -/
52   // ----------------/
53
54   public JalviewUserColours()
55   {
56     super();
57     this._colourList = new java.util.Vector();
58     this._filterList = new java.util.Vector();
59   }
60
61   // -----------/
62   // - Methods -/
63   // -----------/
64
65   /**
66    * 
67    * 
68    * @param vColour
69    * @throws java.lang.IndexOutOfBoundsException
70    *           if the index given is outside the bounds of the collection
71    */
72   public void addColour(final Colour vColour)
73           throws java.lang.IndexOutOfBoundsException
74   {
75     this._colourList.addElement(vColour);
76   }
77
78   /**
79    * 
80    * 
81    * @param index
82    * @param vColour
83    * @throws java.lang.IndexOutOfBoundsException
84    *           if the index given is outside the bounds of the collection
85    */
86   public void addColour(final int index, final Colour vColour)
87           throws java.lang.IndexOutOfBoundsException
88   {
89     this._colourList.add(index, vColour);
90   }
91
92   /**
93    * 
94    * 
95    * @param vFilter
96    * @throws java.lang.IndexOutOfBoundsException
97    *           if the index given is outside the bounds of the collection
98    */
99   public void addFilter(final Filter vFilter)
100           throws java.lang.IndexOutOfBoundsException
101   {
102     this._filterList.addElement(vFilter);
103   }
104
105   /**
106    * 
107    * 
108    * @param index
109    * @param vFilter
110    * @throws java.lang.IndexOutOfBoundsException
111    *           if the index given is outside the bounds of the collection
112    */
113   public void addFilter(final int index, final Filter vFilter)
114           throws java.lang.IndexOutOfBoundsException
115   {
116     this._filterList.add(index, vFilter);
117   }
118
119   /**
120    * Method enumerateColour.
121    * 
122    * @return an Enumeration over all Colour elements
123    */
124   public java.util.Enumeration enumerateColour()
125   {
126     return this._colourList.elements();
127   }
128
129   /**
130    * Method enumerateFilter.
131    * 
132    * @return an Enumeration over all Filter elements
133    */
134   public java.util.Enumeration enumerateFilter()
135   {
136     return this._filterList.elements();
137   }
138
139   /**
140    * Method getColour.
141    * 
142    * @param index
143    * @throws java.lang.IndexOutOfBoundsException
144    *           if the index given is outside the bounds of the collection
145    * @return the value of the Colour at the given index
146    */
147   public Colour getColour(final int index)
148           throws java.lang.IndexOutOfBoundsException
149   {
150     // check bounds for index
151     if (index < 0 || index >= this._colourList.size())
152     {
153       throw new IndexOutOfBoundsException(
154               "getColour: Index value '" + index + "' not in range [0.."
155                       + (this._colourList.size() - 1) + "]");
156     }
157
158     return (Colour) _colourList.get(index);
159   }
160
161   /**
162    * Method getColour.Returns the contents of the collection in an Array.
163    * <p>
164    * Note: Just in case the collection contents are changing in another thread,
165    * we pass a 0-length Array of the correct type into the API call. This way we
166    * <i>know</i> that the Array returned is of exactly the correct length.
167    * 
168    * @return this collection as an Array
169    */
170   public Colour[] getColour()
171   {
172     Colour[] array = new Colour[0];
173     return (Colour[]) this._colourList.toArray(array);
174   }
175
176   /**
177    * Method getColourCount.
178    * 
179    * @return the size of this collection
180    */
181   public int getColourCount()
182   {
183     return this._colourList.size();
184   }
185
186   /**
187    * Method getFilter.
188    * 
189    * @param index
190    * @throws java.lang.IndexOutOfBoundsException
191    *           if the index given is outside the bounds of the collection
192    * @return the value of the Filter at the given index
193    */
194   public Filter getFilter(final int index)
195           throws java.lang.IndexOutOfBoundsException
196   {
197     // check bounds for index
198     if (index < 0 || index >= this._filterList.size())
199     {
200       throw new IndexOutOfBoundsException(
201               "getFilter: Index value '" + index + "' not in range [0.."
202                       + (this._filterList.size() - 1) + "]");
203     }
204
205     return (Filter) _filterList.get(index);
206   }
207
208   /**
209    * Method getFilter.Returns the contents of the collection in an Array.
210    * <p>
211    * Note: Just in case the collection contents are changing in another thread,
212    * we pass a 0-length Array of the correct type into the API call. This way we
213    * <i>know</i> that the Array returned is of exactly the correct length.
214    * 
215    * @return this collection as an Array
216    */
217   public Filter[] getFilter()
218   {
219     Filter[] array = new Filter[0];
220     return (Filter[]) this._filterList.toArray(array);
221   }
222
223   /**
224    * Method getFilterCount.
225    * 
226    * @return the size of this collection
227    */
228   public int getFilterCount()
229   {
230     return this._filterList.size();
231   }
232
233   /**
234    * Returns the value of field 'schemeName'.
235    * 
236    * @return the value of field 'SchemeName'.
237    */
238   public java.lang.String getSchemeName()
239   {
240     return this._schemeName;
241   }
242
243   /**
244    * Returns the value of field 'version'. The field 'version' has the following
245    * description: Jalview colour scheme document version.
246    * 
247    * 
248    * @return the value of field 'Version'.
249    */
250   public java.lang.String getVersion()
251   {
252     return this._version;
253   }
254
255   /**
256    * Method isValid.
257    * 
258    * @return true if this object is valid according to the schema
259    */
260   public boolean isValid()
261   {
262     try
263     {
264       validate();
265     } catch (org.exolab.castor.xml.ValidationException vex)
266     {
267       return false;
268     }
269     return true;
270   }
271
272   /**
273    * 
274    * 
275    * @param out
276    * @throws org.exolab.castor.xml.MarshalException
277    *           if object is null or if any SAXException is thrown during
278    *           marshaling
279    * @throws org.exolab.castor.xml.ValidationException
280    *           if this object is an invalid instance according to the schema
281    */
282   public void marshal(final java.io.Writer out)
283           throws org.exolab.castor.xml.MarshalException,
284           org.exolab.castor.xml.ValidationException
285   {
286     Marshaller.marshal(this, out);
287   }
288
289   /**
290    * 
291    * 
292    * @param handler
293    * @throws java.io.IOException
294    *           if an IOException occurs during marshaling
295    * @throws org.exolab.castor.xml.ValidationException
296    *           if this object is an invalid instance according to the schema
297    * @throws org.exolab.castor.xml.MarshalException
298    *           if object is null or if any SAXException is thrown during
299    *           marshaling
300    */
301   public void marshal(final org.xml.sax.ContentHandler handler)
302           throws java.io.IOException,
303           org.exolab.castor.xml.MarshalException,
304           org.exolab.castor.xml.ValidationException
305   {
306     Marshaller.marshal(this, handler);
307   }
308
309   /**
310    */
311   public void removeAllColour()
312   {
313     this._colourList.clear();
314   }
315
316   /**
317    */
318   public void removeAllFilter()
319   {
320     this._filterList.clear();
321   }
322
323   /**
324    * Method removeColour.
325    * 
326    * @param vColour
327    * @return true if the object was removed from the collection.
328    */
329   public boolean removeColour(final Colour vColour)
330   {
331     boolean removed = _colourList.remove(vColour);
332     return removed;
333   }
334
335   /**
336    * Method removeColourAt.
337    * 
338    * @param index
339    * @return the element removed from the collection
340    */
341   public Colour removeColourAt(final int index)
342   {
343     java.lang.Object obj = this._colourList.remove(index);
344     return (Colour) obj;
345   }
346
347   /**
348    * Method removeFilter.
349    * 
350    * @param vFilter
351    * @return true if the object was removed from the collection.
352    */
353   public boolean removeFilter(final Filter vFilter)
354   {
355     boolean removed = _filterList.remove(vFilter);
356     return removed;
357   }
358
359   /**
360    * Method removeFilterAt.
361    * 
362    * @param index
363    * @return the element removed from the collection
364    */
365   public Filter removeFilterAt(final int index)
366   {
367     java.lang.Object obj = this._filterList.remove(index);
368     return (Filter) obj;
369   }
370
371   /**
372    * 
373    * 
374    * @param index
375    * @param vColour
376    * @throws java.lang.IndexOutOfBoundsException
377    *           if the index given is outside the bounds of the collection
378    */
379   public void setColour(final int index, final Colour vColour)
380           throws java.lang.IndexOutOfBoundsException
381   {
382     // check bounds for index
383     if (index < 0 || index >= this._colourList.size())
384     {
385       throw new IndexOutOfBoundsException(
386               "setColour: Index value '" + index + "' not in range [0.."
387                       + (this._colourList.size() - 1) + "]");
388     }
389
390     this._colourList.set(index, vColour);
391   }
392
393   /**
394    * 
395    * 
396    * @param vColourArray
397    */
398   public void setColour(final Colour[] vColourArray)
399   {
400     // -- copy array
401     _colourList.clear();
402
403     for (int i = 0; i < vColourArray.length; i++)
404     {
405       this._colourList.add(vColourArray[i]);
406     }
407   }
408
409   /**
410    * 
411    * 
412    * @param index
413    * @param vFilter
414    * @throws java.lang.IndexOutOfBoundsException
415    *           if the index given is outside the bounds of the collection
416    */
417   public void setFilter(final int index, final Filter vFilter)
418           throws java.lang.IndexOutOfBoundsException
419   {
420     // check bounds for index
421     if (index < 0 || index >= this._filterList.size())
422     {
423       throw new IndexOutOfBoundsException(
424               "setFilter: Index value '" + index + "' not in range [0.."
425                       + (this._filterList.size() - 1) + "]");
426     }
427
428     this._filterList.set(index, vFilter);
429   }
430
431   /**
432    * 
433    * 
434    * @param vFilterArray
435    */
436   public void setFilter(final Filter[] vFilterArray)
437   {
438     // -- copy array
439     _filterList.clear();
440
441     for (int i = 0; i < vFilterArray.length; i++)
442     {
443       this._filterList.add(vFilterArray[i]);
444     }
445   }
446
447   /**
448    * Sets the value of field 'schemeName'.
449    * 
450    * @param schemeName
451    *          the value of field 'schemeName'.
452    */
453   public void setSchemeName(final java.lang.String schemeName)
454   {
455     this._schemeName = schemeName;
456   }
457
458   /**
459    * Sets the value of field 'version'. The field 'version' has the following
460    * description: Jalview colour scheme document version.
461    * 
462    * 
463    * @param version
464    *          the value of field 'version'.
465    */
466   public void setVersion(final java.lang.String version)
467   {
468     this._version = version;
469   }
470
471   /**
472    * Method unmarshal.
473    * 
474    * @param reader
475    * @throws org.exolab.castor.xml.MarshalException
476    *           if object is null or if any SAXException is thrown during
477    *           marshaling
478    * @throws org.exolab.castor.xml.ValidationException
479    *           if this object is an invalid instance according to the schema
480    * @return the unmarshaled jalview.schemabinding.version2.JalviewUserColours
481    */
482   public static jalview.schemabinding.version2.JalviewUserColours unmarshal(
483           final java.io.Reader reader)
484           throws org.exolab.castor.xml.MarshalException,
485           org.exolab.castor.xml.ValidationException
486   {
487     return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller
488             .unmarshal(
489                     jalview.schemabinding.version2.JalviewUserColours.class,
490                     reader);
491   }
492
493   /**
494    * 
495    * 
496    * @throws org.exolab.castor.xml.ValidationException
497    *           if this object is an invalid instance according to the schema
498    */
499   public void validate() throws org.exolab.castor.xml.ValidationException
500   {
501     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
502     validator.validate(this);
503   }
504
505 }