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;
37 private java.util.Vector _colourList;
44 public JalviewUserColours() {
46 this._colourList = new java.util.Vector();
58 * @throws java.lang.IndexOutOfBoundsException if the index
59 * given is outside the bounds of the collection
61 public void addColour(
63 throws java.lang.IndexOutOfBoundsException {
64 this._colourList.addElement(vColour);
72 * @throws java.lang.IndexOutOfBoundsException if the index
73 * given is outside the bounds of the collection
75 public void addColour(
78 throws java.lang.IndexOutOfBoundsException {
79 this._colourList.add(index, vColour);
83 * Method enumerateColour.
85 * @return an Enumeration over all Colour elements
87 public java.util.Enumeration enumerateColour(
89 return this._colourList.elements();
96 * @throws java.lang.IndexOutOfBoundsException if the index
97 * given is outside the bounds of the collection
98 * @return the value of the Colour at the given index
100 public Colour getColour(
102 throws java.lang.IndexOutOfBoundsException {
103 // check bounds for index
104 if (index < 0 || index >= this._colourList.size()) {
105 throw new IndexOutOfBoundsException("getColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
108 return (Colour) _colourList.get(index);
112 * Method getColour.Returns the contents of the collection in
113 * an Array. <p>Note: Just in case the collection contents
114 * are changing in another thread, we pass a 0-length Array of
115 * the correct type into the API call. This way we <i>know</i>
116 * that the Array returned is of exactly the correct length.
118 * @return this collection as an Array
120 public Colour[] getColour(
122 Colour[] array = new Colour[0];
123 return (Colour[]) this._colourList.toArray(array);
127 * Method getColourCount.
129 * @return the size of this collection
131 public int getColourCount(
133 return this._colourList.size();
137 * Returns the value of field 'schemeName'.
139 * @return the value of field 'SchemeName'.
141 public java.lang.String getSchemeName(
143 return this._schemeName;
149 * @return true if this object is valid according to the schema
151 public boolean isValid(
155 } catch (org.exolab.castor.xml.ValidationException vex) {
165 * @throws org.exolab.castor.xml.MarshalException if object is
166 * null or if any SAXException is thrown during marshaling
167 * @throws org.exolab.castor.xml.ValidationException if this
168 * object is an invalid instance according to the schema
171 final java.io.Writer out)
172 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
173 Marshaller.marshal(this, out);
180 * @throws java.io.IOException if an IOException occurs during
182 * @throws org.exolab.castor.xml.ValidationException if this
183 * object is an invalid instance according to the schema
184 * @throws org.exolab.castor.xml.MarshalException if object is
185 * null or if any SAXException is thrown during marshaling
188 final org.xml.sax.ContentHandler handler)
189 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
190 Marshaller.marshal(this, handler);
195 public void removeAllColour(
197 this._colourList.clear();
201 * Method removeColour.
204 * @return true if the object was removed from the collection.
206 public boolean removeColour(
207 final Colour vColour) {
208 boolean removed = _colourList.remove(vColour);
213 * Method removeColourAt.
216 * @return the element removed from the collection
218 public Colour removeColourAt(
220 java.lang.Object obj = this._colourList.remove(index);
229 * @throws java.lang.IndexOutOfBoundsException if the index
230 * given is outside the bounds of the collection
232 public void setColour(
234 final Colour vColour)
235 throws java.lang.IndexOutOfBoundsException {
236 // check bounds for index
237 if (index < 0 || index >= this._colourList.size()) {
238 throw new IndexOutOfBoundsException("setColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
241 this._colourList.set(index, vColour);
247 * @param vColourArray
249 public void setColour(
250 final Colour[] vColourArray) {
254 for (int i = 0; i < vColourArray.length; i++) {
255 this._colourList.add(vColourArray[i]);
260 * Sets the value of field 'schemeName'.
262 * @param schemeName the value of field 'schemeName'.
264 public void setSchemeName(
265 final java.lang.String schemeName) {
266 this._schemeName = schemeName;
273 * @throws org.exolab.castor.xml.MarshalException if object is
274 * null or if any SAXException is thrown during marshaling
275 * @throws org.exolab.castor.xml.ValidationException if this
276 * object is an invalid instance according to the schema
277 * @return the unmarshaled jalview.binding.JalviewUserColours
279 public static jalview.binding.JalviewUserColours unmarshal(
280 final java.io.Reader reader)
281 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
282 return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class, reader);
288 * @throws org.exolab.castor.xml.ValidationException if this
289 * object is an invalid instance according to the schema
291 public void validate(
293 throws org.exolab.castor.xml.ValidationException {
294 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
295 validator.validate(this);