extended Colour element with additional optional attributes for graduated colour
[jalview.git] / src / jalview / binding / Colour.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.1)
3  * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.binding;
20
21   //---------------------------------/
22  //- Imported classes and packages -/
23 //---------------------------------/
24
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
27
28 /**
29  * Class Colour.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class Colour implements java.io.Serializable {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _name.
42      */
43     private java.lang.String _name;
44
45     /**
46      * Field _RGB.
47      */
48     private java.lang.String _RGB;
49
50     /**
51      * Field _minRGB.
52      */
53     private java.lang.String _minRGB;
54
55     /**
56      * loosely specified enumeration: NONE,ABOVE, or BELOW
57      */
58     private java.lang.String _threshType;
59
60     /**
61      * Field _threshold.
62      */
63     private float _threshold;
64
65     /**
66      * keeps track of state for field: _threshold
67      */
68     private boolean _has_threshold;
69
70     /**
71      * Field _max.
72      */
73     private float _max;
74
75     /**
76      * keeps track of state for field: _max
77      */
78     private boolean _has_max;
79
80     /**
81      * Field _min.
82      */
83     private float _min;
84
85     /**
86      * keeps track of state for field: _min
87      */
88     private boolean _has_min;
89
90     /**
91      * Field _colourByLabel.
92      */
93     private boolean _colourByLabel;
94
95     /**
96      * keeps track of state for field: _colourByLabel
97      */
98     private boolean _has_colourByLabel;
99
100     /**
101      * Field _autoScale.
102      */
103     private boolean _autoScale;
104
105     /**
106      * keeps track of state for field: _autoScale
107      */
108     private boolean _has_autoScale;
109
110
111       //----------------/
112      //- Constructors -/
113     //----------------/
114
115     public Colour() {
116         super();
117     }
118
119
120       //-----------/
121      //- Methods -/
122     //-----------/
123
124     /**
125      */
126     public void deleteAutoScale(
127     ) {
128         this._has_autoScale= false;
129     }
130
131     /**
132      */
133     public void deleteColourByLabel(
134     ) {
135         this._has_colourByLabel= false;
136     }
137
138     /**
139      */
140     public void deleteMax(
141     ) {
142         this._has_max= false;
143     }
144
145     /**
146      */
147     public void deleteMin(
148     ) {
149         this._has_min= false;
150     }
151
152     /**
153      */
154     public void deleteThreshold(
155     ) {
156         this._has_threshold= false;
157     }
158
159     /**
160      * Returns the value of field 'autoScale'.
161      * 
162      * @return the value of field 'AutoScale'.
163      */
164     public boolean getAutoScale(
165     ) {
166         return this._autoScale;
167     }
168
169     /**
170      * Returns the value of field 'colourByLabel'.
171      * 
172      * @return the value of field 'ColourByLabel'.
173      */
174     public boolean getColourByLabel(
175     ) {
176         return this._colourByLabel;
177     }
178
179     /**
180      * Returns the value of field 'max'.
181      * 
182      * @return the value of field 'Max'.
183      */
184     public float getMax(
185     ) {
186         return this._max;
187     }
188
189     /**
190      * Returns the value of field 'min'.
191      * 
192      * @return the value of field 'Min'.
193      */
194     public float getMin(
195     ) {
196         return this._min;
197     }
198
199     /**
200      * Returns the value of field 'minRGB'.
201      * 
202      * @return the value of field 'MinRGB'.
203      */
204     public java.lang.String getMinRGB(
205     ) {
206         return this._minRGB;
207     }
208
209     /**
210      * Returns the value of field 'name'.
211      * 
212      * @return the value of field 'Name'.
213      */
214     public java.lang.String getName(
215     ) {
216         return this._name;
217     }
218
219     /**
220      * Returns the value of field 'RGB'.
221      * 
222      * @return the value of field 'RGB'.
223      */
224     public java.lang.String getRGB(
225     ) {
226         return this._RGB;
227     }
228
229     /**
230      * Returns the value of field 'threshType'. The field
231      * 'threshType' has the following description: loosely
232      * specified enumeration: NONE,ABOVE, or BELOW
233      * 
234      * @return the value of field 'ThreshType'.
235      */
236     public java.lang.String getThreshType(
237     ) {
238         return this._threshType;
239     }
240
241     /**
242      * Returns the value of field 'threshold'.
243      * 
244      * @return the value of field 'Threshold'.
245      */
246     public float getThreshold(
247     ) {
248         return this._threshold;
249     }
250
251     /**
252      * Method hasAutoScale.
253      * 
254      * @return true if at least one AutoScale has been added
255      */
256     public boolean hasAutoScale(
257     ) {
258         return this._has_autoScale;
259     }
260
261     /**
262      * Method hasColourByLabel.
263      * 
264      * @return true if at least one ColourByLabel has been added
265      */
266     public boolean hasColourByLabel(
267     ) {
268         return this._has_colourByLabel;
269     }
270
271     /**
272      * Method hasMax.
273      * 
274      * @return true if at least one Max has been added
275      */
276     public boolean hasMax(
277     ) {
278         return this._has_max;
279     }
280
281     /**
282      * Method hasMin.
283      * 
284      * @return true if at least one Min has been added
285      */
286     public boolean hasMin(
287     ) {
288         return this._has_min;
289     }
290
291     /**
292      * Method hasThreshold.
293      * 
294      * @return true if at least one Threshold has been added
295      */
296     public boolean hasThreshold(
297     ) {
298         return this._has_threshold;
299     }
300
301     /**
302      * Returns the value of field 'autoScale'.
303      * 
304      * @return the value of field 'AutoScale'.
305      */
306     public boolean isAutoScale(
307     ) {
308         return this._autoScale;
309     }
310
311     /**
312      * Returns the value of field 'colourByLabel'.
313      * 
314      * @return the value of field 'ColourByLabel'.
315      */
316     public boolean isColourByLabel(
317     ) {
318         return this._colourByLabel;
319     }
320
321     /**
322      * Method isValid.
323      * 
324      * @return true if this object is valid according to the schema
325      */
326     public boolean isValid(
327     ) {
328         try {
329             validate();
330         } catch (org.exolab.castor.xml.ValidationException vex) {
331             return false;
332         }
333         return true;
334     }
335
336     /**
337      * 
338      * 
339      * @param out
340      * @throws org.exolab.castor.xml.MarshalException if object is
341      * null or if any SAXException is thrown during marshaling
342      * @throws org.exolab.castor.xml.ValidationException if this
343      * object is an invalid instance according to the schema
344      */
345     public void marshal(
346             final java.io.Writer out)
347     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
348         Marshaller.marshal(this, out);
349     }
350
351     /**
352      * 
353      * 
354      * @param handler
355      * @throws java.io.IOException if an IOException occurs during
356      * marshaling
357      * @throws org.exolab.castor.xml.ValidationException if this
358      * object is an invalid instance according to the schema
359      * @throws org.exolab.castor.xml.MarshalException if object is
360      * null or if any SAXException is thrown during marshaling
361      */
362     public void marshal(
363             final org.xml.sax.ContentHandler handler)
364     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
365         Marshaller.marshal(this, handler);
366     }
367
368     /**
369      * Sets the value of field 'autoScale'.
370      * 
371      * @param autoScale the value of field 'autoScale'.
372      */
373     public void setAutoScale(
374             final boolean autoScale) {
375         this._autoScale = autoScale;
376         this._has_autoScale = true;
377     }
378
379     /**
380      * Sets the value of field 'colourByLabel'.
381      * 
382      * @param colourByLabel the value of field 'colourByLabel'.
383      */
384     public void setColourByLabel(
385             final boolean colourByLabel) {
386         this._colourByLabel = colourByLabel;
387         this._has_colourByLabel = true;
388     }
389
390     /**
391      * Sets the value of field 'max'.
392      * 
393      * @param max the value of field 'max'.
394      */
395     public void setMax(
396             final float max) {
397         this._max = max;
398         this._has_max = true;
399     }
400
401     /**
402      * Sets the value of field 'min'.
403      * 
404      * @param min the value of field 'min'.
405      */
406     public void setMin(
407             final float min) {
408         this._min = min;
409         this._has_min = true;
410     }
411
412     /**
413      * Sets the value of field 'minRGB'.
414      * 
415      * @param minRGB the value of field 'minRGB'.
416      */
417     public void setMinRGB(
418             final java.lang.String minRGB) {
419         this._minRGB = minRGB;
420     }
421
422     /**
423      * Sets the value of field 'name'.
424      * 
425      * @param name the value of field 'name'.
426      */
427     public void setName(
428             final java.lang.String name) {
429         this._name = name;
430     }
431
432     /**
433      * Sets the value of field 'RGB'.
434      * 
435      * @param RGB the value of field 'RGB'.
436      */
437     public void setRGB(
438             final java.lang.String RGB) {
439         this._RGB = RGB;
440     }
441
442     /**
443      * Sets the value of field 'threshType'. The field 'threshType'
444      * has the following description: loosely specified
445      * enumeration: NONE,ABOVE, or BELOW
446      * 
447      * @param threshType the value of field 'threshType'.
448      */
449     public void setThreshType(
450             final java.lang.String threshType) {
451         this._threshType = threshType;
452     }
453
454     /**
455      * Sets the value of field 'threshold'.
456      * 
457      * @param threshold the value of field 'threshold'.
458      */
459     public void setThreshold(
460             final float threshold) {
461         this._threshold = threshold;
462         this._has_threshold = true;
463     }
464
465     /**
466      * Method unmarshal.
467      * 
468      * @param reader
469      * @throws org.exolab.castor.xml.MarshalException if object is
470      * null or if any SAXException is thrown during marshaling
471      * @throws org.exolab.castor.xml.ValidationException if this
472      * object is an invalid instance according to the schema
473      * @return the unmarshaled jalview.binding.Colour
474      */
475     public static jalview.binding.Colour unmarshal(
476             final java.io.Reader reader)
477     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
478         return (jalview.binding.Colour) Unmarshaller.unmarshal(jalview.binding.Colour.class, reader);
479     }
480
481     /**
482      * 
483      * 
484      * @throws org.exolab.castor.xml.ValidationException if this
485      * object is an invalid instance according to the schema
486      */
487     public void validate(
488     )
489     throws org.exolab.castor.xml.ValidationException {
490         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
491         validator.validate(this);
492     }
493
494 }