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;
20 * @version $Revision$ $Date$
22 public class Colour implements java.io.Serializable
25 // --------------------------/
26 // - Class/Member Variables -/
27 // --------------------------/
30 * Single letter residue code for an alignment colour scheme, or feature type
31 * for a feature colour scheme
33 private java.lang.String _name;
38 private java.lang.String _RGB;
43 private java.lang.String _minRGB;
46 * Field _noValueColour.
48 private jalview.binding.types.NoValueColour _noValueColour = jalview.binding.types.NoValueColour
54 private jalview.binding.types.ColourThreshTypeType _threshType;
59 private float _threshold;
62 * keeps track of state for field: _threshold
64 private boolean _has_threshold;
72 * keeps track of state for field: _max
74 private boolean _has_max;
82 * keeps track of state for field: _min
84 private boolean _has_min;
87 * Field _colourByLabel.
89 private boolean _colourByLabel;
92 * keeps track of state for field: _colourByLabel
94 private boolean _has_colourByLabel;
99 private boolean _autoScale;
102 * keeps track of state for field: _autoScale
104 private boolean _has_autoScale;
107 * name of feature attribute to colour by, or attribute and sub-attribute
109 private java.util.Vector _attributeNameList;
118 setNoValueColour(jalview.binding.types.NoValueColour.valueOf("Min"));
119 this._attributeNameList = new java.util.Vector();
129 * @param vAttributeName
130 * @throws java.lang.IndexOutOfBoundsException
131 * if the index given is outside the bounds of the collection
133 public void addAttributeName(final java.lang.String vAttributeName)
134 throws java.lang.IndexOutOfBoundsException
136 // check for the maximum size
137 if (this._attributeNameList.size() >= 2)
139 throw new IndexOutOfBoundsException(
140 "addAttributeName has a maximum of 2");
143 this._attributeNameList.addElement(vAttributeName);
150 * @param vAttributeName
151 * @throws java.lang.IndexOutOfBoundsException
152 * if the index given is outside the bounds of the collection
154 public void addAttributeName(final int index,
155 final java.lang.String vAttributeName)
156 throws java.lang.IndexOutOfBoundsException
158 // check for the maximum size
159 if (this._attributeNameList.size() >= 2)
161 throw new IndexOutOfBoundsException(
162 "addAttributeName has a maximum of 2");
165 this._attributeNameList.add(index, vAttributeName);
170 public void deleteAutoScale()
172 this._has_autoScale = false;
177 public void deleteColourByLabel()
179 this._has_colourByLabel = false;
184 public void deleteMax()
186 this._has_max = false;
191 public void deleteMin()
193 this._has_min = false;
198 public void deleteThreshold()
200 this._has_threshold = false;
204 * Method enumerateAttributeName.
206 * @return an Enumeration over all java.lang.String elements
208 public java.util.Enumeration enumerateAttributeName()
210 return this._attributeNameList.elements();
214 * Method getAttributeName.
217 * @throws java.lang.IndexOutOfBoundsException
218 * if the index given is outside the bounds of the collection
219 * @return the value of the java.lang.String at the given index
221 public java.lang.String getAttributeName(final int index)
222 throws java.lang.IndexOutOfBoundsException
224 // check bounds for index
225 if (index < 0 || index >= this._attributeNameList.size())
227 throw new IndexOutOfBoundsException("getAttributeName: Index value '"
228 + index + "' not in range [0.."
229 + (this._attributeNameList.size() - 1) + "]");
232 return (java.lang.String) _attributeNameList.get(index);
236 * Method getAttributeName.Returns the contents of the collection in an Array.
238 * Note: Just in case the collection contents are changing in another thread,
239 * we pass a 0-length Array of the correct type into the API call. This way we
240 * <i>know</i> that the Array returned is of exactly the correct length.
242 * @return this collection as an Array
244 public java.lang.String[] getAttributeName()
246 java.lang.String[] array = new java.lang.String[0];
247 return (java.lang.String[]) this._attributeNameList.toArray(array);
251 * Method getAttributeNameCount.
253 * @return the size of this collection
255 public int getAttributeNameCount()
257 return this._attributeNameList.size();
261 * Returns the value of field 'autoScale'.
263 * @return the value of field 'AutoScale'.
265 public boolean getAutoScale()
267 return this._autoScale;
271 * Returns the value of field 'colourByLabel'.
273 * @return the value of field 'ColourByLabel'.
275 public boolean getColourByLabel()
277 return this._colourByLabel;
281 * Returns the value of field 'max'.
283 * @return the value of field 'Max'.
285 public float getMax()
291 * Returns the value of field 'min'.
293 * @return the value of field 'Min'.
295 public float getMin()
301 * Returns the value of field 'minRGB'.
303 * @return the value of field 'MinRGB'.
305 public java.lang.String getMinRGB()
311 * Returns the value of field 'name'. The field 'name' has the following
312 * description: Single letter residue code for an alignment colour scheme, or
313 * feature type for a feature colour scheme
315 * @return the value of field 'Name'.
317 public java.lang.String getName()
323 * Returns the value of field 'noValueColour'.
325 * @return the value of field 'NoValueColour'.
327 public jalview.binding.types.NoValueColour getNoValueColour()
329 return this._noValueColour;
333 * Returns the value of field 'RGB'.
335 * @return the value of field 'RGB'.
337 public java.lang.String getRGB()
343 * Returns the value of field 'threshType'.
345 * @return the value of field 'ThreshType'.
347 public jalview.binding.types.ColourThreshTypeType getThreshType()
349 return this._threshType;
353 * Returns the value of field 'threshold'.
355 * @return the value of field 'Threshold'.
357 public float getThreshold()
359 return this._threshold;
363 * Method hasAutoScale.
365 * @return true if at least one AutoScale has been added
367 public boolean hasAutoScale()
369 return this._has_autoScale;
373 * Method hasColourByLabel.
375 * @return true if at least one ColourByLabel has been added
377 public boolean hasColourByLabel()
379 return this._has_colourByLabel;
385 * @return true if at least one Max has been added
387 public boolean hasMax()
389 return this._has_max;
395 * @return true if at least one Min has been added
397 public boolean hasMin()
399 return this._has_min;
403 * Method hasThreshold.
405 * @return true if at least one Threshold has been added
407 public boolean hasThreshold()
409 return this._has_threshold;
413 * Returns the value of field 'autoScale'.
415 * @return the value of field 'AutoScale'.
417 public boolean isAutoScale()
419 return this._autoScale;
423 * Returns the value of field 'colourByLabel'.
425 * @return the value of field 'ColourByLabel'.
427 public boolean isColourByLabel()
429 return this._colourByLabel;
435 * @return true if this object is valid according to the schema
437 public boolean isValid()
442 } catch (org.exolab.castor.xml.ValidationException vex)
453 * @throws org.exolab.castor.xml.MarshalException
454 * if object is null or if any SAXException is thrown during
456 * @throws org.exolab.castor.xml.ValidationException
457 * if this object is an invalid instance according to the schema
459 public void marshal(final java.io.Writer out)
460 throws org.exolab.castor.xml.MarshalException,
461 org.exolab.castor.xml.ValidationException
463 Marshaller.marshal(this, out);
470 * @throws java.io.IOException
471 * if an IOException occurs during marshaling
472 * @throws org.exolab.castor.xml.ValidationException
473 * if this object is an invalid instance according to the schema
474 * @throws org.exolab.castor.xml.MarshalException
475 * if object is null or if any SAXException is thrown during
478 public void marshal(final org.xml.sax.ContentHandler handler)
479 throws java.io.IOException,
480 org.exolab.castor.xml.MarshalException,
481 org.exolab.castor.xml.ValidationException
483 Marshaller.marshal(this, handler);
488 public void removeAllAttributeName()
490 this._attributeNameList.clear();
494 * Method removeAttributeName.
496 * @param vAttributeName
497 * @return true if the object was removed from the collection.
499 public boolean removeAttributeName(final java.lang.String vAttributeName)
501 boolean removed = _attributeNameList.remove(vAttributeName);
506 * Method removeAttributeNameAt.
509 * @return the element removed from the collection
511 public java.lang.String removeAttributeNameAt(final int index)
513 java.lang.Object obj = this._attributeNameList.remove(index);
514 return (java.lang.String) obj;
521 * @param vAttributeName
522 * @throws java.lang.IndexOutOfBoundsException
523 * if the index given is outside the bounds of the collection
525 public void setAttributeName(final int index,
526 final java.lang.String vAttributeName)
527 throws java.lang.IndexOutOfBoundsException
529 // check bounds for index
530 if (index < 0 || index >= this._attributeNameList.size())
532 throw new IndexOutOfBoundsException("setAttributeName: Index value '"
533 + index + "' not in range [0.."
534 + (this._attributeNameList.size() - 1) + "]");
537 this._attributeNameList.set(index, vAttributeName);
543 * @param vAttributeNameArray
545 public void setAttributeName(final java.lang.String[] vAttributeNameArray)
548 _attributeNameList.clear();
550 for (int i = 0; i < vAttributeNameArray.length; i++)
552 this._attributeNameList.add(vAttributeNameArray[i]);
557 * Sets the value of field 'autoScale'.
560 * the value of field 'autoScale'.
562 public void setAutoScale(final boolean autoScale)
564 this._autoScale = autoScale;
565 this._has_autoScale = true;
569 * Sets the value of field 'colourByLabel'.
571 * @param colourByLabel
572 * the value of field 'colourByLabel'.
574 public void setColourByLabel(final boolean colourByLabel)
576 this._colourByLabel = colourByLabel;
577 this._has_colourByLabel = true;
581 * Sets the value of field 'max'.
584 * the value of field 'max'.
586 public void setMax(final float max)
589 this._has_max = true;
593 * Sets the value of field 'min'.
596 * the value of field 'min'.
598 public void setMin(final float min)
601 this._has_min = true;
605 * Sets the value of field 'minRGB'.
608 * the value of field 'minRGB'.
610 public void setMinRGB(final java.lang.String minRGB)
612 this._minRGB = minRGB;
616 * Sets the value of field 'name'. The field 'name' has the following
617 * description: Single letter residue code for an alignment colour scheme, or
618 * feature type for a feature colour scheme
621 * the value of field 'name'.
623 public void setName(final java.lang.String name)
629 * Sets the value of field 'noValueColour'.
631 * @param noValueColour
632 * the value of field 'noValueColour'.
634 public void setNoValueColour(
635 final jalview.binding.types.NoValueColour noValueColour)
637 this._noValueColour = noValueColour;
641 * Sets the value of field 'RGB'.
644 * the value of field 'RGB'.
646 public void setRGB(final java.lang.String RGB)
652 * Sets the value of field 'threshType'.
655 * the value of field 'threshType'.
657 public void setThreshType(
658 final jalview.binding.types.ColourThreshTypeType threshType)
660 this._threshType = threshType;
664 * Sets the value of field 'threshold'.
667 * the value of field 'threshold'.
669 public void setThreshold(final float threshold)
671 this._threshold = threshold;
672 this._has_threshold = true;
679 * @throws org.exolab.castor.xml.MarshalException
680 * if object is null or if any SAXException is thrown during
682 * @throws org.exolab.castor.xml.ValidationException
683 * if this object is an invalid instance according to the schema
684 * @return the unmarshaled jalview.binding.Colour
686 public static jalview.binding.Colour unmarshal(
687 final java.io.Reader reader)
688 throws org.exolab.castor.xml.MarshalException,
689 org.exolab.castor.xml.ValidationException
691 return (jalview.binding.Colour) Unmarshaller
692 .unmarshal(jalview.binding.Colour.class, reader);
698 * @throws org.exolab.castor.xml.ValidationException
699 * if this object is an invalid instance according to the schema
701 public void validate() throws org.exolab.castor.xml.ValidationException
703 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
704 validator.validate(this);