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