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