805e70c9d37afef60471c66e52be047c026f42a2
[jalview.git] / src / jalview / schemabinding / version2 / AnnotationColours.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3  * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.schemabinding.version2;
19
20 //---------------------------------/
21 //- Imported classes and packages -/
22 //---------------------------------/
23
24 import org.exolab.castor.xml.Marshaller;
25 import org.exolab.castor.xml.Unmarshaller;
26
27 /**
28  * Class AnnotationColours.
29  * 
30  * @version $Revision$ $Date$
31  */
32 public class AnnotationColours implements java.io.Serializable
33 {
34
35   // --------------------------/
36   // - Class/Member Variables -/
37   // --------------------------/
38
39   /**
40    * Field _aboveThreshold.
41    */
42   private int _aboveThreshold;
43
44   /**
45    * keeps track of state for field: _aboveThreshold
46    */
47   private boolean _has_aboveThreshold;
48
49   /**
50    * Field _annotation.
51    */
52   private java.lang.String _annotation;
53
54   /**
55    * Field _minColour.
56    */
57   private int _minColour;
58
59   /**
60    * keeps track of state for field: _minColour
61    */
62   private boolean _has_minColour;
63
64   /**
65    * Field _maxColour.
66    */
67   private int _maxColour;
68
69   /**
70    * keeps track of state for field: _maxColour
71    */
72   private boolean _has_maxColour;
73
74   /**
75    * Field _colourScheme.
76    */
77   private java.lang.String _colourScheme;
78
79   /**
80    * Field _threshold.
81    */
82   private float _threshold;
83
84   /**
85    * keeps track of state for field: _threshold
86    */
87   private boolean _has_threshold;
88
89   // ----------------/
90   // - Constructors -/
91   // ----------------/
92
93   public AnnotationColours()
94   {
95     super();
96   }
97
98   // -----------/
99   // - Methods -/
100   // -----------/
101
102   /**
103      */
104   public void deleteAboveThreshold()
105   {
106     this._has_aboveThreshold = false;
107   }
108
109   /**
110      */
111   public void deleteMaxColour()
112   {
113     this._has_maxColour = false;
114   }
115
116   /**
117      */
118   public void deleteMinColour()
119   {
120     this._has_minColour = false;
121   }
122
123   /**
124      */
125   public void deleteThreshold()
126   {
127     this._has_threshold = false;
128   }
129
130   /**
131    * Returns the value of field 'aboveThreshold'.
132    * 
133    * @return the value of field 'AboveThreshold'.
134    */
135   public int getAboveThreshold()
136   {
137     return this._aboveThreshold;
138   }
139
140   /**
141    * Returns the value of field 'annotation'.
142    * 
143    * @return the value of field 'Annotation'.
144    */
145   public java.lang.String getAnnotation()
146   {
147     return this._annotation;
148   }
149
150   /**
151    * Returns the value of field 'colourScheme'.
152    * 
153    * @return the value of field 'ColourScheme'.
154    */
155   public java.lang.String getColourScheme()
156   {
157     return this._colourScheme;
158   }
159
160   /**
161    * Returns the value of field 'maxColour'.
162    * 
163    * @return the value of field 'MaxColour'.
164    */
165   public int getMaxColour()
166   {
167     return this._maxColour;
168   }
169
170   /**
171    * Returns the value of field 'minColour'.
172    * 
173    * @return the value of field 'MinColour'.
174    */
175   public int getMinColour()
176   {
177     return this._minColour;
178   }
179
180   /**
181    * Returns the value of field 'threshold'.
182    * 
183    * @return the value of field 'Threshold'.
184    */
185   public float getThreshold()
186   {
187     return this._threshold;
188   }
189
190   /**
191    * Method hasAboveThreshold.
192    * 
193    * @return true if at least one AboveThreshold has been added
194    */
195   public boolean hasAboveThreshold()
196   {
197     return this._has_aboveThreshold;
198   }
199
200   /**
201    * Method hasMaxColour.
202    * 
203    * @return true if at least one MaxColour has been added
204    */
205   public boolean hasMaxColour()
206   {
207     return this._has_maxColour;
208   }
209
210   /**
211    * Method hasMinColour.
212    * 
213    * @return true if at least one MinColour has been added
214    */
215   public boolean hasMinColour()
216   {
217     return this._has_minColour;
218   }
219
220   /**
221    * Method hasThreshold.
222    * 
223    * @return true if at least one Threshold has been added
224    */
225   public boolean hasThreshold()
226   {
227     return this._has_threshold;
228   }
229
230   /**
231    * Method isValid.
232    * 
233    * @return true if this object is valid according to the schema
234    */
235   public boolean isValid()
236   {
237     try
238     {
239       validate();
240     } catch (org.exolab.castor.xml.ValidationException vex)
241     {
242       return false;
243     }
244     return true;
245   }
246
247   /**
248    * 
249    * 
250    * @param out
251    * @throws org.exolab.castor.xml.MarshalException
252    *           if object is null or if any SAXException is thrown during
253    *           marshaling
254    * @throws org.exolab.castor.xml.ValidationException
255    *           if this object is an invalid instance according to the schema
256    */
257   public void marshal(final java.io.Writer out)
258           throws org.exolab.castor.xml.MarshalException,
259           org.exolab.castor.xml.ValidationException
260   {
261     Marshaller.marshal(this, out);
262   }
263
264   /**
265    * 
266    * 
267    * @param handler
268    * @throws java.io.IOException
269    *           if an IOException occurs during marshaling
270    * @throws org.exolab.castor.xml.ValidationException
271    *           if this object is an invalid instance according to the schema
272    * @throws org.exolab.castor.xml.MarshalException
273    *           if object is null or if any SAXException is thrown during
274    *           marshaling
275    */
276   public void marshal(final org.xml.sax.ContentHandler handler)
277           throws java.io.IOException,
278           org.exolab.castor.xml.MarshalException,
279           org.exolab.castor.xml.ValidationException
280   {
281     Marshaller.marshal(this, handler);
282   }
283
284   /**
285    * Sets the value of field 'aboveThreshold'.
286    * 
287    * @param aboveThreshold
288    *          the value of field 'aboveThreshold'.
289    */
290   public void setAboveThreshold(final int aboveThreshold)
291   {
292     this._aboveThreshold = aboveThreshold;
293     this._has_aboveThreshold = true;
294   }
295
296   /**
297    * Sets the value of field 'annotation'.
298    * 
299    * @param annotation
300    *          the value of field 'annotation'.
301    */
302   public void setAnnotation(final java.lang.String annotation)
303   {
304     this._annotation = annotation;
305   }
306
307   /**
308    * Sets the value of field 'colourScheme'.
309    * 
310    * @param colourScheme
311    *          the value of field 'colourScheme'.
312    */
313   public void setColourScheme(final java.lang.String colourScheme)
314   {
315     this._colourScheme = colourScheme;
316   }
317
318   /**
319    * Sets the value of field 'maxColour'.
320    * 
321    * @param maxColour
322    *          the value of field 'maxColour'.
323    */
324   public void setMaxColour(final int maxColour)
325   {
326     this._maxColour = maxColour;
327     this._has_maxColour = true;
328   }
329
330   /**
331    * Sets the value of field 'minColour'.
332    * 
333    * @param minColour
334    *          the value of field 'minColour'.
335    */
336   public void setMinColour(final int minColour)
337   {
338     this._minColour = minColour;
339     this._has_minColour = true;
340   }
341
342   /**
343    * Sets the value of field 'threshold'.
344    * 
345    * @param threshold
346    *          the value of field 'threshold'.
347    */
348   public void setThreshold(final float threshold)
349   {
350     this._threshold = threshold;
351     this._has_threshold = true;
352   }
353
354   /**
355    * Method unmarshal.
356    * 
357    * @param reader
358    * @throws org.exolab.castor.xml.MarshalException
359    *           if object is null or if any SAXException is thrown during
360    *           marshaling
361    * @throws org.exolab.castor.xml.ValidationException
362    *           if this object is an invalid instance according to the schema
363    * @return the unmarshaled jalview.schemabinding.version2.AnnotationColours
364    */
365   public static jalview.schemabinding.version2.AnnotationColours unmarshal(
366           final java.io.Reader reader)
367           throws org.exolab.castor.xml.MarshalException,
368           org.exolab.castor.xml.ValidationException
369   {
370     return (jalview.schemabinding.version2.AnnotationColours) Unmarshaller
371             .unmarshal(
372                     jalview.schemabinding.version2.AnnotationColours.class,
373                     reader);
374   }
375
376   /**
377    * 
378    * 
379    * @throws org.exolab.castor.xml.ValidationException
380    *           if this object is an invalid instance according to the schema
381    */
382   public void validate() throws org.exolab.castor.xml.ValidationException
383   {
384     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
385     validator.validate(this);
386   }
387
388 }