2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.binding;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
18 * Class JalviewUserColours.
20 * @version $Revision$ $Date$
22 public class JalviewUserColours implements java.io.Serializable
25 // --------------------------/
26 // - Class/Member Variables -/
27 // --------------------------/
32 private java.lang.String _schemeName;
35 * Jalview colour scheme document version.
38 private java.lang.String _version;
43 private java.util.Vector _colourList;
48 private java.util.Vector _filterList;
54 public JalviewUserColours()
57 this._colourList = new java.util.Vector();
58 this._filterList = new java.util.Vector();
69 * @throws java.lang.IndexOutOfBoundsException
70 * if the index given is outside the bounds of the collection
72 public void addColour(final Colour vColour)
73 throws java.lang.IndexOutOfBoundsException
75 this._colourList.addElement(vColour);
83 * @throws java.lang.IndexOutOfBoundsException
84 * if the index given is outside the bounds of the collection
86 public void addColour(final int index, final Colour vColour)
87 throws java.lang.IndexOutOfBoundsException
89 this._colourList.add(index, vColour);
96 * @throws java.lang.IndexOutOfBoundsException
97 * if the index given is outside the bounds of the collection
99 public void addFilter(final Filter vFilter)
100 throws java.lang.IndexOutOfBoundsException
102 this._filterList.addElement(vFilter);
110 * @throws java.lang.IndexOutOfBoundsException
111 * if the index given is outside the bounds of the collection
113 public void addFilter(final int index, final Filter vFilter)
114 throws java.lang.IndexOutOfBoundsException
116 this._filterList.add(index, vFilter);
120 * Method enumerateColour.
122 * @return an Enumeration over all Colour elements
124 public java.util.Enumeration enumerateColour()
126 return this._colourList.elements();
130 * Method enumerateFilter.
132 * @return an Enumeration over all Filter elements
134 public java.util.Enumeration enumerateFilter()
136 return this._filterList.elements();
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
147 public Colour getColour(final int index)
148 throws java.lang.IndexOutOfBoundsException
150 // check bounds for index
151 if (index < 0 || index >= this._colourList.size())
153 throw new IndexOutOfBoundsException(
154 "getColour: Index value '" + index + "' not in range [0.."
155 + (this._colourList.size() - 1) + "]");
158 return (Colour) _colourList.get(index);
162 * Method getColour.Returns the contents of the collection in an Array.
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.
168 * @return this collection as an Array
170 public Colour[] getColour()
172 Colour[] array = new Colour[0];
173 return (Colour[]) this._colourList.toArray(array);
177 * Method getColourCount.
179 * @return the size of this collection
181 public int getColourCount()
183 return this._colourList.size();
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
194 public Filter getFilter(final int index)
195 throws java.lang.IndexOutOfBoundsException
197 // check bounds for index
198 if (index < 0 || index >= this._filterList.size())
200 throw new IndexOutOfBoundsException(
201 "getFilter: Index value '" + index + "' not in range [0.."
202 + (this._filterList.size() - 1) + "]");
205 return (Filter) _filterList.get(index);
209 * Method getFilter.Returns the contents of the collection in an Array.
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.
215 * @return this collection as an Array
217 public Filter[] getFilter()
219 Filter[] array = new Filter[0];
220 return (Filter[]) this._filterList.toArray(array);
224 * Method getFilterCount.
226 * @return the size of this collection
228 public int getFilterCount()
230 return this._filterList.size();
234 * Returns the value of field 'schemeName'.
236 * @return the value of field 'SchemeName'.
238 public java.lang.String getSchemeName()
240 return this._schemeName;
244 * Returns the value of field 'version'. The field 'version' has the following
245 * description: Jalview colour scheme document version.
248 * @return the value of field 'Version'.
250 public java.lang.String getVersion()
252 return this._version;
258 * @return true if this object is valid according to the schema
260 public boolean isValid()
265 } catch (org.exolab.castor.xml.ValidationException vex)
276 * @throws org.exolab.castor.xml.MarshalException
277 * if object is null or if any SAXException is thrown during
279 * @throws org.exolab.castor.xml.ValidationException
280 * if this object is an invalid instance according to the schema
282 public void marshal(final java.io.Writer out)
283 throws org.exolab.castor.xml.MarshalException,
284 org.exolab.castor.xml.ValidationException
286 Marshaller.marshal(this, out);
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
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
306 Marshaller.marshal(this, handler);
311 public void removeAllColour()
313 this._colourList.clear();
318 public void removeAllFilter()
320 this._filterList.clear();
324 * Method removeColour.
327 * @return true if the object was removed from the collection.
329 public boolean removeColour(final Colour vColour)
331 boolean removed = _colourList.remove(vColour);
336 * Method removeColourAt.
339 * @return the element removed from the collection
341 public Colour removeColourAt(final int index)
343 java.lang.Object obj = this._colourList.remove(index);
348 * Method removeFilter.
351 * @return true if the object was removed from the collection.
353 public boolean removeFilter(final Filter vFilter)
355 boolean removed = _filterList.remove(vFilter);
360 * Method removeFilterAt.
363 * @return the element removed from the collection
365 public Filter removeFilterAt(final int index)
367 java.lang.Object obj = this._filterList.remove(index);
376 * @throws java.lang.IndexOutOfBoundsException
377 * if the index given is outside the bounds of the collection
379 public void setColour(final int index, final Colour vColour)
380 throws java.lang.IndexOutOfBoundsException
382 // check bounds for index
383 if (index < 0 || index >= this._colourList.size())
385 throw new IndexOutOfBoundsException(
386 "setColour: Index value '" + index + "' not in range [0.."
387 + (this._colourList.size() - 1) + "]");
390 this._colourList.set(index, vColour);
396 * @param vColourArray
398 public void setColour(final Colour[] vColourArray)
403 for (int i = 0; i < vColourArray.length; i++)
405 this._colourList.add(vColourArray[i]);
414 * @throws java.lang.IndexOutOfBoundsException
415 * if the index given is outside the bounds of the collection
417 public void setFilter(final int index, final Filter vFilter)
418 throws java.lang.IndexOutOfBoundsException
420 // check bounds for index
421 if (index < 0 || index >= this._filterList.size())
423 throw new IndexOutOfBoundsException(
424 "setFilter: Index value '" + index + "' not in range [0.."
425 + (this._filterList.size() - 1) + "]");
428 this._filterList.set(index, vFilter);
434 * @param vFilterArray
436 public void setFilter(final Filter[] vFilterArray)
441 for (int i = 0; i < vFilterArray.length; i++)
443 this._filterList.add(vFilterArray[i]);
448 * Sets the value of field 'schemeName'.
451 * the value of field 'schemeName'.
453 public void setSchemeName(final java.lang.String schemeName)
455 this._schemeName = schemeName;
459 * Sets the value of field 'version'. The field 'version' has the following
460 * description: Jalview colour scheme document version.
464 * the value of field 'version'.
466 public void setVersion(final java.lang.String version)
468 this._version = version;
475 * @throws org.exolab.castor.xml.MarshalException
476 * if object is null or if any SAXException is thrown during
478 * @throws org.exolab.castor.xml.ValidationException
479 * if this object is an invalid instance according to the schema
480 * @return the unmarshaled jalview.binding.JalviewUserColours
482 public static jalview.binding.JalviewUserColours unmarshal(
483 final java.io.Reader reader)
484 throws org.exolab.castor.xml.MarshalException,
485 org.exolab.castor.xml.ValidationException
487 return (jalview.binding.JalviewUserColours) Unmarshaller
488 .unmarshal(jalview.binding.JalviewUserColours.class, reader);
494 * @throws org.exolab.castor.xml.ValidationException
495 * if this object is an invalid instance according to the schema
497 public void validate() throws org.exolab.castor.xml.ValidationException
499 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
500 validator.validate(this);