2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.schemabinding.version2;
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;
50 public JalviewUserColours() {
52 this._colourList = new java.util.Vector();
64 * @throws java.lang.IndexOutOfBoundsException if the index
65 * given is outside the bounds of the collection
67 public void addColour(
69 throws java.lang.IndexOutOfBoundsException {
70 this._colourList.addElement(vColour);
78 * @throws java.lang.IndexOutOfBoundsException if the index
79 * given is outside the bounds of the collection
81 public void addColour(
84 throws java.lang.IndexOutOfBoundsException {
85 this._colourList.add(index, vColour);
89 * Method enumerateColour.
91 * @return an Enumeration over all Colour elements
93 public java.util.Enumeration enumerateColour(
95 return this._colourList.elements();
102 * @throws java.lang.IndexOutOfBoundsException if the index
103 * given is outside the bounds of the collection
104 * @return the value of the Colour at the given index
106 public Colour getColour(
108 throws java.lang.IndexOutOfBoundsException {
109 // check bounds for index
110 if (index < 0 || index >= this._colourList.size()) {
111 throw new IndexOutOfBoundsException("getColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
114 return (Colour) _colourList.get(index);
118 * Method getColour.Returns the contents of the collection in
119 * an Array. <p>Note: Just in case the collection contents
120 * are changing in another thread, we pass a 0-length Array of
121 * the correct type into the API call. This way we <i>know</i>
122 * that the Array returned is of exactly the correct length.
124 * @return this collection as an Array
126 public Colour[] getColour(
128 Colour[] array = new Colour[0];
129 return (Colour[]) this._colourList.toArray(array);
133 * Method getColourCount.
135 * @return the size of this collection
137 public int getColourCount(
139 return this._colourList.size();
143 * Returns the value of field 'schemeName'.
145 * @return the value of field 'SchemeName'.
147 public java.lang.String getSchemeName(
149 return this._schemeName;
153 * Returns the value of field 'version'. The field 'version'
154 * has the following description: Jalview colour scheme
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(
174 } catch (org.exolab.castor.xml.ValidationException vex) {
184 * @throws org.exolab.castor.xml.MarshalException if object is
185 * null or if any SAXException is thrown during marshaling
186 * @throws org.exolab.castor.xml.ValidationException if this
187 * object is an invalid instance according to the schema
190 final java.io.Writer out)
191 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
192 Marshaller.marshal(this, out);
199 * @throws java.io.IOException if an IOException occurs during
201 * @throws org.exolab.castor.xml.ValidationException if this
202 * object is an invalid instance according to the schema
203 * @throws org.exolab.castor.xml.MarshalException if object is
204 * null or if any SAXException is thrown during marshaling
207 final org.xml.sax.ContentHandler handler)
208 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
209 Marshaller.marshal(this, handler);
214 public void removeAllColour(
216 this._colourList.clear();
220 * Method removeColour.
223 * @return true if the object was removed from the collection.
225 public boolean removeColour(
226 final Colour vColour) {
227 boolean removed = _colourList.remove(vColour);
232 * Method removeColourAt.
235 * @return the element removed from the collection
237 public Colour removeColourAt(
239 java.lang.Object obj = this._colourList.remove(index);
248 * @throws java.lang.IndexOutOfBoundsException if the index
249 * given is outside the bounds of the collection
251 public void setColour(
253 final Colour vColour)
254 throws java.lang.IndexOutOfBoundsException {
255 // check bounds for index
256 if (index < 0 || index >= this._colourList.size()) {
257 throw new IndexOutOfBoundsException("setColour: Index value '" + index + "' not in range [0.." + (this._colourList.size() - 1) + "]");
260 this._colourList.set(index, vColour);
266 * @param vColourArray
268 public void setColour(
269 final Colour[] vColourArray) {
273 for (int i = 0; i < vColourArray.length; i++) {
274 this._colourList.add(vColourArray[i]);
279 * Sets the value of field 'schemeName'.
281 * @param schemeName the value of field 'schemeName'.
283 public void setSchemeName(
284 final java.lang.String schemeName) {
285 this._schemeName = schemeName;
289 * Sets the value of field 'version'. The field 'version' has
290 * the following description: Jalview colour scheme document
294 * @param version the value of field 'version'.
296 public void setVersion(
297 final java.lang.String version) {
298 this._version = version;
305 * @throws org.exolab.castor.xml.MarshalException if object is
306 * null or if any SAXException is thrown during marshaling
307 * @throws org.exolab.castor.xml.ValidationException if this
308 * object is an invalid instance according to the schema
309 * @return the unmarshaled
310 * jalview.schemabinding.version2.JalviewUserColours
312 public static jalview.schemabinding.version2.JalviewUserColours unmarshal(
313 final java.io.Reader reader)
314 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
315 return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewUserColours.class, reader);
321 * @throws org.exolab.castor.xml.ValidationException if this
322 * object is an invalid instance according to the schema
324 public void validate(
326 throws org.exolab.castor.xml.ValidationException {
327 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
328 validator.validate(this);