8f709d792d03ad656db713c8dcc2ed4d090812e5
[jalview.git] / src / jalview / schemabinding / version2 / Colour.java
1 /*
2  * This class was automatically generated with 
3  * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
4  * Schema.
5  * $Id$
6  */
7
8 package jalview.schemabinding.version2;
9
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
13
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
16
17 /**
18  * Class Colour.
19  * 
20  * @version $Revision$ $Date$
21  */
22 public class Colour implements java.io.Serializable
23 {
24
25   // --------------------------/
26   // - Class/Member Variables -/
27   // --------------------------/
28
29   /**
30    * Single letter residue code for an alignment colour scheme, or feature type
31    * for a feature colour scheme
32    */
33   private java.lang.String _name;
34
35   /**
36    * Field _RGB.
37    */
38   private java.lang.String _RGB;
39
40   /**
41    * Field _minRGB.
42    */
43   private java.lang.String _minRGB;
44
45   /**
46    * Colour if no attribute or score value
47    */
48   private jalview.schemabinding.version2.types.ColourNoValueColourType _noValueColour = jalview.schemabinding.version2.types.ColourNoValueColourType
49           .valueOf("Min");
50
51   /**
52    * Field _threshType.
53    */
54   private jalview.schemabinding.version2.types.ColourThreshTypeType _threshType;
55
56   /**
57    * Field _threshold.
58    */
59   private float _threshold;
60
61   /**
62    * keeps track of state for field: _threshold
63    */
64   private boolean _has_threshold;
65
66   /**
67    * Field _max.
68    */
69   private float _max;
70
71   /**
72    * keeps track of state for field: _max
73    */
74   private boolean _has_max;
75
76   /**
77    * Field _min.
78    */
79   private float _min;
80
81   /**
82    * keeps track of state for field: _min
83    */
84   private boolean _has_min;
85
86   /**
87    * Field _colourByLabel.
88    */
89   private boolean _colourByLabel;
90
91   /**
92    * keeps track of state for field: _colourByLabel
93    */
94   private boolean _has_colourByLabel;
95
96   /**
97    * Field _autoScale.
98    */
99   private boolean _autoScale;
100
101   /**
102    * keeps track of state for field: _autoScale
103    */
104   private boolean _has_autoScale;
105
106   /**
107    * name of feature attribute to colour by, or attribute and sub-attribute
108    */
109   private java.util.Vector _attributeNameList;
110
111   // ----------------/
112   // - Constructors -/
113   // ----------------/
114
115   public Colour()
116   {
117     super();
118     setNoValueColour(
119             jalview.schemabinding.version2.types.ColourNoValueColourType
120                     .valueOf("Min"));
121     this._attributeNameList = new java.util.Vector();
122   }
123
124   // -----------/
125   // - Methods -/
126   // -----------/
127
128   /**
129    * 
130    * 
131    * @param vAttributeName
132    * @throws java.lang.IndexOutOfBoundsException
133    *           if the index given is outside the bounds of the collection
134    */
135   public void addAttributeName(final java.lang.String vAttributeName)
136           throws java.lang.IndexOutOfBoundsException
137   {
138     // check for the maximum size
139     if (this._attributeNameList.size() >= 2)
140     {
141       throw new IndexOutOfBoundsException(
142               "addAttributeName has a maximum of 2");
143     }
144
145     this._attributeNameList.addElement(vAttributeName);
146   }
147
148   /**
149    * 
150    * 
151    * @param index
152    * @param vAttributeName
153    * @throws java.lang.IndexOutOfBoundsException
154    *           if the index given is outside the bounds of the collection
155    */
156   public void addAttributeName(final int index,
157           final java.lang.String vAttributeName)
158           throws java.lang.IndexOutOfBoundsException
159   {
160     // check for the maximum size
161     if (this._attributeNameList.size() >= 2)
162     {
163       throw new IndexOutOfBoundsException(
164               "addAttributeName has a maximum of 2");
165     }
166
167     this._attributeNameList.add(index, vAttributeName);
168   }
169
170   /**
171    */
172   public void deleteAutoScale()
173   {
174     this._has_autoScale = false;
175   }
176
177   /**
178    */
179   public void deleteColourByLabel()
180   {
181     this._has_colourByLabel = false;
182   }
183
184   /**
185    */
186   public void deleteMax()
187   {
188     this._has_max = false;
189   }
190
191   /**
192    */
193   public void deleteMin()
194   {
195     this._has_min = false;
196   }
197
198   /**
199    */
200   public void deleteThreshold()
201   {
202     this._has_threshold = false;
203   }
204
205   /**
206    * Method enumerateAttributeName.
207    * 
208    * @return an Enumeration over all java.lang.String elements
209    */
210   public java.util.Enumeration enumerateAttributeName()
211   {
212     return this._attributeNameList.elements();
213   }
214
215   /**
216    * Method getAttributeName.
217    * 
218    * @param index
219    * @throws java.lang.IndexOutOfBoundsException
220    *           if the index given is outside the bounds of the collection
221    * @return the value of the java.lang.String at the given index
222    */
223   public java.lang.String getAttributeName(final int index)
224           throws java.lang.IndexOutOfBoundsException
225   {
226     // check bounds for index
227     if (index < 0 || index >= this._attributeNameList.size())
228     {
229       throw new IndexOutOfBoundsException("getAttributeName: Index value '"
230               + index + "' not in range [0.."
231               + (this._attributeNameList.size() - 1) + "]");
232     }
233
234     return (java.lang.String) _attributeNameList.get(index);
235   }
236
237   /**
238    * Method getAttributeName.Returns the contents of the collection in an Array.
239    * <p>
240    * Note: Just in case the collection contents are changing in another thread,
241    * we pass a 0-length Array of the correct type into the API call. This way we
242    * <i>know</i> that the Array returned is of exactly the correct length.
243    * 
244    * @return this collection as an Array
245    */
246   public java.lang.String[] getAttributeName()
247   {
248     java.lang.String[] array = new java.lang.String[0];
249     return (java.lang.String[]) this._attributeNameList.toArray(array);
250   }
251
252   /**
253    * Method getAttributeNameCount.
254    * 
255    * @return the size of this collection
256    */
257   public int getAttributeNameCount()
258   {
259     return this._attributeNameList.size();
260   }
261
262   /**
263    * Returns the value of field 'autoScale'.
264    * 
265    * @return the value of field 'AutoScale'.
266    */
267   public boolean getAutoScale()
268   {
269     return this._autoScale;
270   }
271
272   /**
273    * Returns the value of field 'colourByLabel'.
274    * 
275    * @return the value of field 'ColourByLabel'.
276    */
277   public boolean getColourByLabel()
278   {
279     return this._colourByLabel;
280   }
281
282   /**
283    * Returns the value of field 'max'.
284    * 
285    * @return the value of field 'Max'.
286    */
287   public float getMax()
288   {
289     return this._max;
290   }
291
292   /**
293    * Returns the value of field 'min'.
294    * 
295    * @return the value of field 'Min'.
296    */
297   public float getMin()
298   {
299     return this._min;
300   }
301
302   /**
303    * Returns the value of field 'minRGB'.
304    * 
305    * @return the value of field 'MinRGB'.
306    */
307   public java.lang.String getMinRGB()
308   {
309     return this._minRGB;
310   }
311
312   /**
313    * Returns the value of field 'name'. The field 'name' has the following
314    * description: Single letter residue code for an alignment colour scheme, or
315    * feature type for a feature colour scheme
316    * 
317    * @return the value of field 'Name'.
318    */
319   public java.lang.String getName()
320   {
321     return this._name;
322   }
323
324   /**
325    * Returns the value of field 'noValueColour'. The field 'noValueColour' has
326    * the following description: Colour if no attribute or score value
327    * 
328    * @return the value of field 'NoValueColour'.
329    */
330   public jalview.schemabinding.version2.types.ColourNoValueColourType getNoValueColour()
331   {
332     return this._noValueColour;
333   }
334
335   /**
336    * Returns the value of field 'RGB'.
337    * 
338    * @return the value of field 'RGB'.
339    */
340   public java.lang.String getRGB()
341   {
342     return this._RGB;
343   }
344
345   /**
346    * Returns the value of field 'threshType'.
347    * 
348    * @return the value of field 'ThreshType'.
349    */
350   public jalview.schemabinding.version2.types.ColourThreshTypeType getThreshType()
351   {
352     return this._threshType;
353   }
354
355   /**
356    * Returns the value of field 'threshold'.
357    * 
358    * @return the value of field 'Threshold'.
359    */
360   public float getThreshold()
361   {
362     return this._threshold;
363   }
364
365   /**
366    * Method hasAutoScale.
367    * 
368    * @return true if at least one AutoScale has been added
369    */
370   public boolean hasAutoScale()
371   {
372     return this._has_autoScale;
373   }
374
375   /**
376    * Method hasColourByLabel.
377    * 
378    * @return true if at least one ColourByLabel has been added
379    */
380   public boolean hasColourByLabel()
381   {
382     return this._has_colourByLabel;
383   }
384
385   /**
386    * Method hasMax.
387    * 
388    * @return true if at least one Max has been added
389    */
390   public boolean hasMax()
391   {
392     return this._has_max;
393   }
394
395   /**
396    * Method hasMin.
397    * 
398    * @return true if at least one Min has been added
399    */
400   public boolean hasMin()
401   {
402     return this._has_min;
403   }
404
405   /**
406    * Method hasThreshold.
407    * 
408    * @return true if at least one Threshold has been added
409    */
410   public boolean hasThreshold()
411   {
412     return this._has_threshold;
413   }
414
415   /**
416    * Returns the value of field 'autoScale'.
417    * 
418    * @return the value of field 'AutoScale'.
419    */
420   public boolean isAutoScale()
421   {
422     return this._autoScale;
423   }
424
425   /**
426    * Returns the value of field 'colourByLabel'.
427    * 
428    * @return the value of field 'ColourByLabel'.
429    */
430   public boolean isColourByLabel()
431   {
432     return this._colourByLabel;
433   }
434
435   /**
436    * Method isValid.
437    * 
438    * @return true if this object is valid according to the schema
439    */
440   public boolean isValid()
441   {
442     try
443     {
444       validate();
445     } catch (org.exolab.castor.xml.ValidationException vex)
446     {
447       return false;
448     }
449     return true;
450   }
451
452   /**
453    * 
454    * 
455    * @param out
456    * @throws org.exolab.castor.xml.MarshalException
457    *           if object is null or if any SAXException is thrown during
458    *           marshaling
459    * @throws org.exolab.castor.xml.ValidationException
460    *           if this object is an invalid instance according to the schema
461    */
462   public void marshal(final java.io.Writer out)
463           throws org.exolab.castor.xml.MarshalException,
464           org.exolab.castor.xml.ValidationException
465   {
466     Marshaller.marshal(this, out);
467   }
468
469   /**
470    * 
471    * 
472    * @param handler
473    * @throws java.io.IOException
474    *           if an IOException occurs during marshaling
475    * @throws org.exolab.castor.xml.ValidationException
476    *           if this object is an invalid instance according to the schema
477    * @throws org.exolab.castor.xml.MarshalException
478    *           if object is null or if any SAXException is thrown during
479    *           marshaling
480    */
481   public void marshal(final org.xml.sax.ContentHandler handler)
482           throws java.io.IOException,
483           org.exolab.castor.xml.MarshalException,
484           org.exolab.castor.xml.ValidationException
485   {
486     Marshaller.marshal(this, handler);
487   }
488
489   /**
490    */
491   public void removeAllAttributeName()
492   {
493     this._attributeNameList.clear();
494   }
495
496   /**
497    * Method removeAttributeName.
498    * 
499    * @param vAttributeName
500    * @return true if the object was removed from the collection.
501    */
502   public boolean removeAttributeName(final java.lang.String vAttributeName)
503   {
504     boolean removed = _attributeNameList.remove(vAttributeName);
505     return removed;
506   }
507
508   /**
509    * Method removeAttributeNameAt.
510    * 
511    * @param index
512    * @return the element removed from the collection
513    */
514   public java.lang.String removeAttributeNameAt(final int index)
515   {
516     java.lang.Object obj = this._attributeNameList.remove(index);
517     return (java.lang.String) obj;
518   }
519
520   /**
521    * 
522    * 
523    * @param index
524    * @param vAttributeName
525    * @throws java.lang.IndexOutOfBoundsException
526    *           if the index given is outside the bounds of the collection
527    */
528   public void setAttributeName(final int index,
529           final java.lang.String vAttributeName)
530           throws java.lang.IndexOutOfBoundsException
531   {
532     // check bounds for index
533     if (index < 0 || index >= this._attributeNameList.size())
534     {
535       throw new IndexOutOfBoundsException("setAttributeName: Index value '"
536               + index + "' not in range [0.."
537               + (this._attributeNameList.size() - 1) + "]");
538     }
539
540     this._attributeNameList.set(index, vAttributeName);
541   }
542
543   /**
544    * 
545    * 
546    * @param vAttributeNameArray
547    */
548   public void setAttributeName(final java.lang.String[] vAttributeNameArray)
549   {
550     // -- copy array
551     _attributeNameList.clear();
552
553     for (int i = 0; i < vAttributeNameArray.length; i++)
554     {
555       this._attributeNameList.add(vAttributeNameArray[i]);
556     }
557   }
558
559   /**
560    * Sets the value of field 'autoScale'.
561    * 
562    * @param autoScale
563    *          the value of field 'autoScale'.
564    */
565   public void setAutoScale(final boolean autoScale)
566   {
567     this._autoScale = autoScale;
568     this._has_autoScale = true;
569   }
570
571   /**
572    * Sets the value of field 'colourByLabel'.
573    * 
574    * @param colourByLabel
575    *          the value of field 'colourByLabel'.
576    */
577   public void setColourByLabel(final boolean colourByLabel)
578   {
579     this._colourByLabel = colourByLabel;
580     this._has_colourByLabel = true;
581   }
582
583   /**
584    * Sets the value of field 'max'.
585    * 
586    * @param max
587    *          the value of field 'max'.
588    */
589   public void setMax(final float max)
590   {
591     this._max = max;
592     this._has_max = true;
593   }
594
595   /**
596    * Sets the value of field 'min'.
597    * 
598    * @param min
599    *          the value of field 'min'.
600    */
601   public void setMin(final float min)
602   {
603     this._min = min;
604     this._has_min = true;
605   }
606
607   /**
608    * Sets the value of field 'minRGB'.
609    * 
610    * @param minRGB
611    *          the value of field 'minRGB'.
612    */
613   public void setMinRGB(final java.lang.String minRGB)
614   {
615     this._minRGB = minRGB;
616   }
617
618   /**
619    * Sets the value of field 'name'. The field 'name' has the following
620    * description: Single letter residue code for an alignment colour scheme, or
621    * feature type for a feature colour scheme
622    * 
623    * @param name
624    *          the value of field 'name'.
625    */
626   public void setName(final java.lang.String name)
627   {
628     this._name = name;
629   }
630
631   /**
632    * Sets the value of field 'noValueColour'. The field 'noValueColour' has the
633    * following description: Colour if no attribute or score value
634    * 
635    * @param noValueColour
636    *          the value of field 'noValueColour'.
637    */
638   public void setNoValueColour(
639           final jalview.schemabinding.version2.types.ColourNoValueColourType noValueColour)
640   {
641     this._noValueColour = noValueColour;
642   }
643
644   /**
645    * Sets the value of field 'RGB'.
646    * 
647    * @param RGB
648    *          the value of field 'RGB'.
649    */
650   public void setRGB(final java.lang.String RGB)
651   {
652     this._RGB = RGB;
653   }
654
655   /**
656    * Sets the value of field 'threshType'.
657    * 
658    * @param threshType
659    *          the value of field 'threshType'.
660    */
661   public void setThreshType(
662           final jalview.schemabinding.version2.types.ColourThreshTypeType threshType)
663   {
664     this._threshType = threshType;
665   }
666
667   /**
668    * Sets the value of field 'threshold'.
669    * 
670    * @param threshold
671    *          the value of field 'threshold'.
672    */
673   public void setThreshold(final float threshold)
674   {
675     this._threshold = threshold;
676     this._has_threshold = true;
677   }
678
679   /**
680    * Method unmarshal.
681    * 
682    * @param reader
683    * @throws org.exolab.castor.xml.MarshalException
684    *           if object is null or if any SAXException is thrown during
685    *           marshaling
686    * @throws org.exolab.castor.xml.ValidationException
687    *           if this object is an invalid instance according to the schema
688    * @return the unmarshaled jalview.schemabinding.version2.Colour
689    */
690   public static jalview.schemabinding.version2.Colour unmarshal(
691           final java.io.Reader reader)
692           throws org.exolab.castor.xml.MarshalException,
693           org.exolab.castor.xml.ValidationException
694   {
695     return (jalview.schemabinding.version2.Colour) Unmarshaller
696             .unmarshal(jalview.schemabinding.version2.Colour.class, reader);
697   }
698
699   /**
700    * 
701    * 
702    * @throws org.exolab.castor.xml.ValidationException
703    *           if this object is an invalid instance according to the schema
704    */
705   public void validate() throws org.exolab.castor.xml.ValidationException
706   {
707     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
708     validator.validate(this);
709   }
710
711 }