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