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;
49 public JalviewUserColours()
52 this._colourList = new java.util.Vector();
63 * @throws java.lang.IndexOutOfBoundsException
64 * if the index given is outside the bounds of the collection
66 public void addColour(final Colour vColour)
67 throws java.lang.IndexOutOfBoundsException
69 this._colourList.addElement(vColour);
77 * @throws java.lang.IndexOutOfBoundsException
78 * if the index given is outside the bounds of the collection
80 public void addColour(final int index, final Colour vColour)
81 throws java.lang.IndexOutOfBoundsException
83 this._colourList.add(index, vColour);
87 * Method enumerateColour.
89 * @return an Enumeration over all Colour elements
91 public java.util.Enumeration enumerateColour()
93 return this._colourList.elements();
100 * @throws java.lang.IndexOutOfBoundsException
101 * if the index given is outside the bounds of the collection
102 * @return the value of the Colour at the given index
104 public Colour getColour(final int index)
105 throws java.lang.IndexOutOfBoundsException
107 // check bounds for index
108 if (index < 0 || index >= this._colourList.size())
110 throw new IndexOutOfBoundsException("getColour: Index value '"
111 + index + "' not in range [0.."
112 + (this._colourList.size() - 1) + "]");
115 return (Colour) _colourList.get(index);
119 * Method getColour.Returns the contents of the collection in an Array.
121 * Note: Just in case the collection contents are changing in another thread,
122 * we pass a 0-length Array of the correct type into the API call. This way we
123 * <i>know</i> that the Array returned is of exactly the correct length.
125 * @return this collection as an Array
127 public Colour[] getColour()
129 Colour[] array = new Colour[0];
130 return (Colour[]) this._colourList.toArray(array);
134 * Method getColourCount.
136 * @return the size of this collection
138 public int getColourCount()
140 return this._colourList.size();
144 * Returns the value of field 'schemeName'.
146 * @return the value of field 'SchemeName'.
148 public java.lang.String getSchemeName()
150 return this._schemeName;
154 * Returns the value of field 'version'. The field 'version' has the following
155 * description: Jalview colour scheme document version.
158 * @return the value of field 'Version'.
160 public java.lang.String getVersion()
162 return this._version;
168 * @return true if this object is valid according to the schema
170 public boolean isValid()
175 } catch (org.exolab.castor.xml.ValidationException vex)
186 * @throws org.exolab.castor.xml.MarshalException
187 * if object is null or if any SAXException is thrown during
189 * @throws org.exolab.castor.xml.ValidationException
190 * if this object is an invalid instance according to the schema
192 public void marshal(final java.io.Writer out)
193 throws org.exolab.castor.xml.MarshalException,
194 org.exolab.castor.xml.ValidationException
196 Marshaller.marshal(this, out);
203 * @throws java.io.IOException
204 * if an IOException occurs during marshaling
205 * @throws org.exolab.castor.xml.ValidationException
206 * if this object is an invalid instance according to the schema
207 * @throws org.exolab.castor.xml.MarshalException
208 * if object is null or if any SAXException is thrown during
211 public void marshal(final org.xml.sax.ContentHandler handler)
212 throws java.io.IOException,
213 org.exolab.castor.xml.MarshalException,
214 org.exolab.castor.xml.ValidationException
216 Marshaller.marshal(this, handler);
221 public void removeAllColour()
223 this._colourList.clear();
227 * Method removeColour.
230 * @return true if the object was removed from the collection.
232 public boolean removeColour(final Colour vColour)
234 boolean removed = _colourList.remove(vColour);
239 * Method removeColourAt.
242 * @return the element removed from the collection
244 public Colour removeColourAt(final int index)
246 java.lang.Object obj = this._colourList.remove(index);
255 * @throws java.lang.IndexOutOfBoundsException
256 * if the index given is outside the bounds of the collection
258 public void setColour(final int index, final Colour vColour)
259 throws java.lang.IndexOutOfBoundsException
261 // check bounds for index
262 if (index < 0 || index >= this._colourList.size())
264 throw new IndexOutOfBoundsException("setColour: Index value '"
265 + index + "' not in range [0.."
266 + (this._colourList.size() - 1) + "]");
269 this._colourList.set(index, vColour);
275 * @param vColourArray
277 public void setColour(final Colour[] vColourArray)
282 for (int i = 0; i < vColourArray.length; i++)
284 this._colourList.add(vColourArray[i]);
289 * Sets the value of field 'schemeName'.
292 * the value of field 'schemeName'.
294 public void setSchemeName(final java.lang.String schemeName)
296 this._schemeName = schemeName;
300 * Sets the value of field 'version'. The field 'version' has the following
301 * description: Jalview colour scheme document version.
305 * the value of field 'version'.
307 public void setVersion(final java.lang.String version)
309 this._version = version;
316 * @throws org.exolab.castor.xml.MarshalException
317 * if object is null or if any SAXException is thrown during
319 * @throws org.exolab.castor.xml.ValidationException
320 * if this object is an invalid instance according to the schema
321 * @return the unmarshaled jalview.binding.JalviewUserColours
323 public static jalview.binding.JalviewUserColours unmarshal(
324 final java.io.Reader reader)
325 throws org.exolab.castor.xml.MarshalException,
326 org.exolab.castor.xml.ValidationException
328 return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(
329 jalview.binding.JalviewUserColours.class, reader);
335 * @throws org.exolab.castor.xml.ValidationException
336 * if this object is an invalid instance according to the schema
338 public void validate() throws org.exolab.castor.xml.ValidationException
340 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
341 validator.validate(this);