09e13ae312870ee288f4d8507af9abd80fd60fda
[jalview.git] / src / jalview / binding / Colour.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3
10  * of the License, or (at your option) any later version.
11  *  
12  * Jalview is distributed in the hope that it will be useful, but 
13  * WITHOUT ANY WARRANTY; without even the implied warranty 
14  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15  * PURPOSE.  See the GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
19  * The Jalview Authors are detailed in the 'AUTHORS' file.
20  */
21 package jalview.binding;
22
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
26
27 import org.exolab.castor.xml.Marshaller;
28 import org.exolab.castor.xml.Unmarshaller;
29
30 /**
31  * Class Colour.
32  * 
33  * @version $Revision$ $Date$
34  */
35 public class Colour implements java.io.Serializable
36 {
37
38   // --------------------------/
39   // - Class/Member Variables -/
40   // --------------------------/
41
42   /**
43    * Field _name.
44    */
45   private java.lang.String _name;
46
47   /**
48    * Field _RGB.
49    */
50   private java.lang.String _RGB;
51
52   /**
53    * Field _minRGB.
54    */
55   private java.lang.String _minRGB;
56
57   /**
58    * loosely specified enumeration: NONE,ABOVE, or BELOW
59    */
60   private java.lang.String _threshType;
61
62   /**
63    * Field _threshold.
64    */
65   private float _threshold;
66
67   /**
68    * keeps track of state for field: _threshold
69    */
70   private boolean _has_threshold;
71
72   /**
73    * Field _max.
74    */
75   private float _max;
76
77   /**
78    * keeps track of state for field: _max
79    */
80   private boolean _has_max;
81
82   /**
83    * Field _min.
84    */
85   private float _min;
86
87   /**
88    * keeps track of state for field: _min
89    */
90   private boolean _has_min;
91
92   /**
93    * Field _colourByLabel.
94    */
95   private boolean _colourByLabel;
96
97   /**
98    * keeps track of state for field: _colourByLabel
99    */
100   private boolean _has_colourByLabel;
101
102   /**
103    * Field _autoScale.
104    */
105   private boolean _autoScale;
106
107   /**
108    * keeps track of state for field: _autoScale
109    */
110   private boolean _has_autoScale;
111
112   // ----------------/
113   // - Constructors -/
114   // ----------------/
115
116   public Colour()
117   {
118     super();
119   }
120
121   // -----------/
122   // - Methods -/
123   // -----------/
124
125   /**
126      */
127   public void deleteAutoScale()
128   {
129     this._has_autoScale = false;
130   }
131
132   /**
133      */
134   public void deleteColourByLabel()
135   {
136     this._has_colourByLabel = false;
137   }
138
139   /**
140      */
141   public void deleteMax()
142   {
143     this._has_max = false;
144   }
145
146   /**
147      */
148   public void deleteMin()
149   {
150     this._has_min = false;
151   }
152
153   /**
154      */
155   public void deleteThreshold()
156   {
157     this._has_threshold = false;
158   }
159
160   /**
161    * Returns the value of field 'autoScale'.
162    * 
163    * @return the value of field 'AutoScale'.
164    */
165   public boolean getAutoScale()
166   {
167     return this._autoScale;
168   }
169
170   /**
171    * Returns the value of field 'colourByLabel'.
172    * 
173    * @return the value of field 'ColourByLabel'.
174    */
175   public boolean getColourByLabel()
176   {
177     return this._colourByLabel;
178   }
179
180   /**
181    * Returns the value of field 'max'.
182    * 
183    * @return the value of field 'Max'.
184    */
185   public float getMax()
186   {
187     return this._max;
188   }
189
190   /**
191    * Returns the value of field 'min'.
192    * 
193    * @return the value of field 'Min'.
194    */
195   public float getMin()
196   {
197     return this._min;
198   }
199
200   /**
201    * Returns the value of field 'minRGB'.
202    * 
203    * @return the value of field 'MinRGB'.
204    */
205   public java.lang.String getMinRGB()
206   {
207     return this._minRGB;
208   }
209
210   /**
211    * Returns the value of field 'name'.
212    * 
213    * @return the value of field 'Name'.
214    */
215   public java.lang.String getName()
216   {
217     return this._name;
218   }
219
220   /**
221    * Returns the value of field 'RGB'.
222    * 
223    * @return the value of field 'RGB'.
224    */
225   public java.lang.String getRGB()
226   {
227     return this._RGB;
228   }
229
230   /**
231    * Returns the value of field 'threshType'. The field 'threshType' has the
232    * following description: loosely 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     {
330       validate();
331     } catch (org.exolab.castor.xml.ValidationException vex)
332     {
333       return false;
334     }
335     return true;
336   }
337
338   /**
339    * 
340    * 
341    * @param out
342    * @throws org.exolab.castor.xml.MarshalException
343    *           if object is null or if any SAXException is thrown during
344    *           marshaling
345    * @throws org.exolab.castor.xml.ValidationException
346    *           if this object is an invalid instance according to the schema
347    */
348   public void marshal(final java.io.Writer out)
349           throws org.exolab.castor.xml.MarshalException,
350           org.exolab.castor.xml.ValidationException
351   {
352     Marshaller.marshal(this, out);
353   }
354
355   /**
356    * 
357    * 
358    * @param handler
359    * @throws java.io.IOException
360    *           if an IOException occurs during marshaling
361    * @throws org.exolab.castor.xml.ValidationException
362    *           if this object is an invalid instance according to the schema
363    * @throws org.exolab.castor.xml.MarshalException
364    *           if object is null or if any SAXException is thrown during
365    *           marshaling
366    */
367   public void marshal(final org.xml.sax.ContentHandler handler)
368           throws java.io.IOException,
369           org.exolab.castor.xml.MarshalException,
370           org.exolab.castor.xml.ValidationException
371   {
372     Marshaller.marshal(this, handler);
373   }
374
375   /**
376    * Sets the value of field 'autoScale'.
377    * 
378    * @param autoScale
379    *          the value of field 'autoScale'.
380    */
381   public void setAutoScale(final boolean autoScale)
382   {
383     this._autoScale = autoScale;
384     this._has_autoScale = true;
385   }
386
387   /**
388    * Sets the value of field 'colourByLabel'.
389    * 
390    * @param colourByLabel
391    *          the value of field 'colourByLabel'.
392    */
393   public void setColourByLabel(final boolean colourByLabel)
394   {
395     this._colourByLabel = colourByLabel;
396     this._has_colourByLabel = true;
397   }
398
399   /**
400    * Sets the value of field 'max'.
401    * 
402    * @param max
403    *          the value of field 'max'.
404    */
405   public void setMax(final float max)
406   {
407     this._max = max;
408     this._has_max = true;
409   }
410
411   /**
412    * Sets the value of field 'min'.
413    * 
414    * @param min
415    *          the value of field 'min'.
416    */
417   public void setMin(final float min)
418   {
419     this._min = min;
420     this._has_min = true;
421   }
422
423   /**
424    * Sets the value of field 'minRGB'.
425    * 
426    * @param minRGB
427    *          the value of field 'minRGB'.
428    */
429   public void setMinRGB(final java.lang.String minRGB)
430   {
431     this._minRGB = minRGB;
432   }
433
434   /**
435    * Sets the value of field 'name'.
436    * 
437    * @param name
438    *          the value of field 'name'.
439    */
440   public void setName(final java.lang.String name)
441   {
442     this._name = name;
443   }
444
445   /**
446    * Sets the value of field 'RGB'.
447    * 
448    * @param RGB
449    *          the value of field 'RGB'.
450    */
451   public void setRGB(final java.lang.String RGB)
452   {
453     this._RGB = RGB;
454   }
455
456   /**
457    * Sets the value of field 'threshType'. The field 'threshType' has the
458    * following description: loosely specified enumeration: NONE,ABOVE, or BELOW
459    * 
460    * @param threshType
461    *          the value of field 'threshType'.
462    */
463   public void setThreshType(final java.lang.String threshType)
464   {
465     this._threshType = threshType;
466   }
467
468   /**
469    * Sets the value of field 'threshold'.
470    * 
471    * @param threshold
472    *          the value of field 'threshold'.
473    */
474   public void setThreshold(final float threshold)
475   {
476     this._threshold = threshold;
477     this._has_threshold = true;
478   }
479
480   /**
481    * Method unmarshal.
482    * 
483    * @param reader
484    * @throws org.exolab.castor.xml.MarshalException
485    *           if object is null or if any SAXException is thrown during
486    *           marshaling
487    * @throws org.exolab.castor.xml.ValidationException
488    *           if this object is an invalid instance according to the schema
489    * @return the unmarshaled jalview.binding.Colour
490    */
491   public static jalview.binding.Colour unmarshal(final java.io.Reader reader)
492           throws org.exolab.castor.xml.MarshalException,
493           org.exolab.castor.xml.ValidationException
494   {
495     return (jalview.binding.Colour) Unmarshaller.unmarshal(
496             jalview.binding.Colour.class, reader);
497   }
498
499   /**
500    * 
501    * 
502    * @throws org.exolab.castor.xml.ValidationException
503    *           if this object is an invalid instance according to the schema
504    */
505   public void validate() throws org.exolab.castor.xml.ValidationException
506   {
507     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
508     validator.validate(this);
509   }
510
511 }