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