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 * Colour if no attribute or score value
48 private jalview.binding.types.ColourNoValueColourType _noValueColour = jalview.binding.types.ColourNoValueColourType
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;
119 jalview.binding.types.ColourNoValueColourType.valueOf("Min"));
120 this._attributeNameList = new java.util.Vector();
130 * @param vAttributeName
131 * @throws java.lang.IndexOutOfBoundsException
132 * if the index given is outside the bounds of the collection
134 public void addAttributeName(final java.lang.String vAttributeName)
135 throws java.lang.IndexOutOfBoundsException
137 // check for the maximum size
138 if (this._attributeNameList.size() >= 2)
140 throw new IndexOutOfBoundsException(
141 "addAttributeName has a maximum of 2");
144 this._attributeNameList.addElement(vAttributeName);
151 * @param vAttributeName
152 * @throws java.lang.IndexOutOfBoundsException
153 * if the index given is outside the bounds of the collection
155 public void addAttributeName(final int index,
156 final java.lang.String vAttributeName)
157 throws java.lang.IndexOutOfBoundsException
159 // check for the maximum size
160 if (this._attributeNameList.size() >= 2)
162 throw new IndexOutOfBoundsException(
163 "addAttributeName has a maximum of 2");
166 this._attributeNameList.add(index, vAttributeName);
171 public void deleteAutoScale()
173 this._has_autoScale = false;
178 public void deleteColourByLabel()
180 this._has_colourByLabel = false;
185 public void deleteMax()
187 this._has_max = false;
192 public void deleteMin()
194 this._has_min = false;
199 public void deleteThreshold()
201 this._has_threshold = false;
205 * Method enumerateAttributeName.
207 * @return an Enumeration over all java.lang.String elements
209 public java.util.Enumeration enumerateAttributeName()
211 return this._attributeNameList.elements();
215 * Method getAttributeName.
218 * @throws java.lang.IndexOutOfBoundsException
219 * if the index given is outside the bounds of the collection
220 * @return the value of the java.lang.String at the given index
222 public java.lang.String getAttributeName(final int index)
223 throws java.lang.IndexOutOfBoundsException
225 // check bounds for index
226 if (index < 0 || index >= this._attributeNameList.size())
228 throw new IndexOutOfBoundsException("getAttributeName: Index value '"
229 + index + "' not in range [0.."
230 + (this._attributeNameList.size() - 1) + "]");
233 return (java.lang.String) _attributeNameList.get(index);
237 * Method getAttributeName.Returns the contents of the collection in an Array.
239 * Note: Just in case the collection contents are changing in another thread,
240 * we pass a 0-length Array of the correct type into the API call. This way we
241 * <i>know</i> that the Array returned is of exactly the correct length.
243 * @return this collection as an Array
245 public java.lang.String[] getAttributeName()
247 java.lang.String[] array = new java.lang.String[0];
248 return (java.lang.String[]) this._attributeNameList.toArray(array);
252 * Method getAttributeNameCount.
254 * @return the size of this collection
256 public int getAttributeNameCount()
258 return this._attributeNameList.size();
262 * Returns the value of field 'autoScale'.
264 * @return the value of field 'AutoScale'.
266 public boolean getAutoScale()
268 return this._autoScale;
272 * Returns the value of field 'colourByLabel'.
274 * @return the value of field 'ColourByLabel'.
276 public boolean getColourByLabel()
278 return this._colourByLabel;
282 * Returns the value of field 'max'.
284 * @return the value of field 'Max'.
286 public float getMax()
292 * Returns the value of field 'min'.
294 * @return the value of field 'Min'.
296 public float getMin()
302 * Returns the value of field 'minRGB'.
304 * @return the value of field 'MinRGB'.
306 public java.lang.String getMinRGB()
312 * Returns the value of field 'name'. The field 'name' has the following
313 * description: Single letter residue code for an alignment colour scheme, or
314 * feature type for a feature colour scheme
316 * @return the value of field 'Name'.
318 public java.lang.String getName()
324 * Returns the value of field 'noValueColour'. The field 'noValueColour' has
325 * the following description: Colour if no attribute or score value
327 * @return the value of field 'NoValueColour'.
329 public jalview.binding.types.ColourNoValueColourType getNoValueColour()
331 return this._noValueColour;
335 * Returns the value of field 'RGB'.
337 * @return the value of field 'RGB'.
339 public java.lang.String getRGB()
345 * Returns the value of field 'threshType'.
347 * @return the value of field 'ThreshType'.
349 public jalview.binding.types.ColourThreshTypeType getThreshType()
351 return this._threshType;
355 * Returns the value of field 'threshold'.
357 * @return the value of field 'Threshold'.
359 public float getThreshold()
361 return this._threshold;
365 * Method hasAutoScale.
367 * @return true if at least one AutoScale has been added
369 public boolean hasAutoScale()
371 return this._has_autoScale;
375 * Method hasColourByLabel.
377 * @return true if at least one ColourByLabel has been added
379 public boolean hasColourByLabel()
381 return this._has_colourByLabel;
387 * @return true if at least one Max has been added
389 public boolean hasMax()
391 return this._has_max;
397 * @return true if at least one Min has been added
399 public boolean hasMin()
401 return this._has_min;
405 * Method hasThreshold.
407 * @return true if at least one Threshold has been added
409 public boolean hasThreshold()
411 return this._has_threshold;
415 * Returns the value of field 'autoScale'.
417 * @return the value of field 'AutoScale'.
419 public boolean isAutoScale()
421 return this._autoScale;
425 * Returns the value of field 'colourByLabel'.
427 * @return the value of field 'ColourByLabel'.
429 public boolean isColourByLabel()
431 return this._colourByLabel;
437 * @return true if this object is valid according to the schema
439 public boolean isValid()
444 } catch (org.exolab.castor.xml.ValidationException vex)
455 * @throws org.exolab.castor.xml.MarshalException
456 * if object is null or if any SAXException is thrown during
458 * @throws org.exolab.castor.xml.ValidationException
459 * if this object is an invalid instance according to the schema
461 public void marshal(final java.io.Writer out)
462 throws org.exolab.castor.xml.MarshalException,
463 org.exolab.castor.xml.ValidationException
465 Marshaller.marshal(this, out);
472 * @throws java.io.IOException
473 * if an IOException occurs during marshaling
474 * @throws org.exolab.castor.xml.ValidationException
475 * if this object is an invalid instance according to the schema
476 * @throws org.exolab.castor.xml.MarshalException
477 * if object is null or if any SAXException is thrown during
480 public void marshal(final org.xml.sax.ContentHandler handler)
481 throws java.io.IOException,
482 org.exolab.castor.xml.MarshalException,
483 org.exolab.castor.xml.ValidationException
485 Marshaller.marshal(this, handler);
490 public void removeAllAttributeName()
492 this._attributeNameList.clear();
496 * Method removeAttributeName.
498 * @param vAttributeName
499 * @return true if the object was removed from the collection.
501 public boolean removeAttributeName(final java.lang.String vAttributeName)
503 boolean removed = _attributeNameList.remove(vAttributeName);
508 * Method removeAttributeNameAt.
511 * @return the element removed from the collection
513 public java.lang.String removeAttributeNameAt(final int index)
515 java.lang.Object obj = this._attributeNameList.remove(index);
516 return (java.lang.String) obj;
523 * @param vAttributeName
524 * @throws java.lang.IndexOutOfBoundsException
525 * if the index given is outside the bounds of the collection
527 public void setAttributeName(final int index,
528 final java.lang.String vAttributeName)
529 throws java.lang.IndexOutOfBoundsException
531 // check bounds for index
532 if (index < 0 || index >= this._attributeNameList.size())
534 throw new IndexOutOfBoundsException("setAttributeName: Index value '"
535 + index + "' not in range [0.."
536 + (this._attributeNameList.size() - 1) + "]");
539 this._attributeNameList.set(index, vAttributeName);
545 * @param vAttributeNameArray
547 public void setAttributeName(final java.lang.String[] vAttributeNameArray)
550 _attributeNameList.clear();
552 for (int i = 0; i < vAttributeNameArray.length; i++)
554 this._attributeNameList.add(vAttributeNameArray[i]);
559 * Sets the value of field 'autoScale'.
562 * the value of field 'autoScale'.
564 public void setAutoScale(final boolean autoScale)
566 this._autoScale = autoScale;
567 this._has_autoScale = true;
571 * Sets the value of field 'colourByLabel'.
573 * @param colourByLabel
574 * the value of field 'colourByLabel'.
576 public void setColourByLabel(final boolean colourByLabel)
578 this._colourByLabel = colourByLabel;
579 this._has_colourByLabel = true;
583 * Sets the value of field 'max'.
586 * the value of field 'max'.
588 public void setMax(final float max)
591 this._has_max = true;
595 * Sets the value of field 'min'.
598 * the value of field 'min'.
600 public void setMin(final float min)
603 this._has_min = true;
607 * Sets the value of field 'minRGB'.
610 * the value of field 'minRGB'.
612 public void setMinRGB(final java.lang.String minRGB)
614 this._minRGB = minRGB;
618 * Sets the value of field 'name'. The field 'name' has the following
619 * description: Single letter residue code for an alignment colour scheme, or
620 * feature type for a feature colour scheme
623 * the value of field 'name'.
625 public void setName(final java.lang.String name)
631 * Sets the value of field 'noValueColour'. The field 'noValueColour' has the
632 * following description: Colour if no attribute or score value
634 * @param noValueColour
635 * the value of field 'noValueColour'.
637 public void setNoValueColour(
638 final jalview.binding.types.ColourNoValueColourType noValueColour)
640 this._noValueColour = noValueColour;
644 * Sets the value of field 'RGB'.
647 * the value of field 'RGB'.
649 public void setRGB(final java.lang.String RGB)
655 * Sets the value of field 'threshType'.
658 * the value of field 'threshType'.
660 public void setThreshType(
661 final jalview.binding.types.ColourThreshTypeType threshType)
663 this._threshType = threshType;
667 * Sets the value of field 'threshold'.
670 * the value of field 'threshold'.
672 public void setThreshold(final float threshold)
674 this._threshold = threshold;
675 this._has_threshold = true;
682 * @throws org.exolab.castor.xml.MarshalException
683 * if object is null or if any SAXException is thrown during
685 * @throws org.exolab.castor.xml.ValidationException
686 * if this object is an invalid instance according to the schema
687 * @return the unmarshaled jalview.binding.Colour
689 public static jalview.binding.Colour unmarshal(
690 final java.io.Reader reader)
691 throws org.exolab.castor.xml.MarshalException,
692 org.exolab.castor.xml.ValidationException
694 return (jalview.binding.Colour) Unmarshaller
695 .unmarshal(jalview.binding.Colour.class, reader);
701 * @throws org.exolab.castor.xml.ValidationException
702 * if this object is an invalid instance according to the schema
704 public void validate() throws org.exolab.castor.xml.ValidationException
706 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
707 validator.validate(this);