Jalview 2.6 source licence
[jalview.git] / src / jalview / schemabinding / version2 / ThresholdLine.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)\r
3  * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
4  * \r
5  * This file is part of Jalview.\r
6  * \r
7  * Jalview is free software: you can redistribute it and/or\r
8  * modify it under the terms of the GNU General Public License \r
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
10  * \r
11  * Jalview is distributed in the hope that it will be useful, but \r
12  * WITHOUT ANY WARRANTY; without even the implied warranty \r
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
14  * PURPOSE.  See the GNU General Public License for more details.\r
15  * \r
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
17  */\r
18 package jalview.schemabinding.version2;\r
19 \r
20 //---------------------------------/\r
21 //- Imported classes and packages -/\r
22 //---------------------------------/\r
23 \r
24 import org.exolab.castor.xml.Marshaller;\r
25 import org.exolab.castor.xml.Unmarshaller;\r
26 \r
27 /**\r
28  * Class ThresholdLine.\r
29  * \r
30  * @version $Revision$ $Date$\r
31  */\r
32 public class ThresholdLine implements java.io.Serializable\r
33 {\r
34 \r
35   // --------------------------/\r
36   // - Class/Member Variables -/\r
37   // --------------------------/\r
38 \r
39   /**\r
40    * Field _label.\r
41    */\r
42   private java.lang.String _label;\r
43 \r
44   /**\r
45    * Field _value.\r
46    */\r
47   private float _value;\r
48 \r
49   /**\r
50    * keeps track of state for field: _value\r
51    */\r
52   private boolean _has_value;\r
53 \r
54   /**\r
55    * Field _colour.\r
56    */\r
57   private int _colour;\r
58 \r
59   /**\r
60    * keeps track of state for field: _colour\r
61    */\r
62   private boolean _has_colour;\r
63 \r
64   // ----------------/\r
65   // - Constructors -/\r
66   // ----------------/\r
67 \r
68   public ThresholdLine()\r
69   {\r
70     super();\r
71   }\r
72 \r
73   // -----------/\r
74   // - Methods -/\r
75   // -----------/\r
76 \r
77   /**\r
78      */\r
79   public void deleteColour()\r
80   {\r
81     this._has_colour = false;\r
82   }\r
83 \r
84   /**\r
85      */\r
86   public void deleteValue()\r
87   {\r
88     this._has_value = false;\r
89   }\r
90 \r
91   /**\r
92    * Returns the value of field 'colour'.\r
93    * \r
94    * @return the value of field 'Colour'.\r
95    */\r
96   public int getColour()\r
97   {\r
98     return this._colour;\r
99   }\r
100 \r
101   /**\r
102    * Returns the value of field 'label'.\r
103    * \r
104    * @return the value of field 'Label'.\r
105    */\r
106   public java.lang.String getLabel()\r
107   {\r
108     return this._label;\r
109   }\r
110 \r
111   /**\r
112    * Returns the value of field 'value'.\r
113    * \r
114    * @return the value of field 'Value'.\r
115    */\r
116   public float getValue()\r
117   {\r
118     return this._value;\r
119   }\r
120 \r
121   /**\r
122    * Method hasColour.\r
123    * \r
124    * @return true if at least one Colour has been added\r
125    */\r
126   public boolean hasColour()\r
127   {\r
128     return this._has_colour;\r
129   }\r
130 \r
131   /**\r
132    * Method hasValue.\r
133    * \r
134    * @return true if at least one Value has been added\r
135    */\r
136   public boolean hasValue()\r
137   {\r
138     return this._has_value;\r
139   }\r
140 \r
141   /**\r
142    * Method isValid.\r
143    * \r
144    * @return true if this object is valid according to the schema\r
145    */\r
146   public boolean isValid()\r
147   {\r
148     try\r
149     {\r
150       validate();\r
151     } catch (org.exolab.castor.xml.ValidationException vex)\r
152     {\r
153       return false;\r
154     }\r
155     return true;\r
156   }\r
157 \r
158   /**\r
159    * \r
160    * \r
161    * @param out\r
162    * @throws org.exolab.castor.xml.MarshalException\r
163    *           if object is null or if any SAXException is thrown during\r
164    *           marshaling\r
165    * @throws org.exolab.castor.xml.ValidationException\r
166    *           if this object is an invalid instance according to the schema\r
167    */\r
168   public void marshal(final java.io.Writer out)\r
169           throws org.exolab.castor.xml.MarshalException,\r
170           org.exolab.castor.xml.ValidationException\r
171   {\r
172     Marshaller.marshal(this, out);\r
173   }\r
174 \r
175   /**\r
176    * \r
177    * \r
178    * @param handler\r
179    * @throws java.io.IOException\r
180    *           if an IOException occurs during marshaling\r
181    * @throws org.exolab.castor.xml.ValidationException\r
182    *           if this object is an invalid instance according to the schema\r
183    * @throws org.exolab.castor.xml.MarshalException\r
184    *           if object is null or if any SAXException is thrown during\r
185    *           marshaling\r
186    */\r
187   public void marshal(final org.xml.sax.ContentHandler handler)\r
188           throws java.io.IOException,\r
189           org.exolab.castor.xml.MarshalException,\r
190           org.exolab.castor.xml.ValidationException\r
191   {\r
192     Marshaller.marshal(this, handler);\r
193   }\r
194 \r
195   /**\r
196    * Sets the value of field 'colour'.\r
197    * \r
198    * @param colour\r
199    *          the value of field 'colour'.\r
200    */\r
201   public void setColour(final int colour)\r
202   {\r
203     this._colour = colour;\r
204     this._has_colour = true;\r
205   }\r
206 \r
207   /**\r
208    * Sets the value of field 'label'.\r
209    * \r
210    * @param label\r
211    *          the value of field 'label'.\r
212    */\r
213   public void setLabel(final java.lang.String label)\r
214   {\r
215     this._label = label;\r
216   }\r
217 \r
218   /**\r
219    * Sets the value of field 'value'.\r
220    * \r
221    * @param value\r
222    *          the value of field 'value'.\r
223    */\r
224   public void setValue(final float value)\r
225   {\r
226     this._value = value;\r
227     this._has_value = true;\r
228   }\r
229 \r
230   /**\r
231    * Method unmarshal.\r
232    * \r
233    * @param reader\r
234    * @throws org.exolab.castor.xml.MarshalException\r
235    *           if object is null or if any SAXException is thrown during\r
236    *           marshaling\r
237    * @throws org.exolab.castor.xml.ValidationException\r
238    *           if this object is an invalid instance according to the schema\r
239    * @return the unmarshaled jalview.schemabinding.version2.ThresholdLine\r
240    */\r
241   public static jalview.schemabinding.version2.ThresholdLine unmarshal(\r
242           final java.io.Reader reader)\r
243           throws org.exolab.castor.xml.MarshalException,\r
244           org.exolab.castor.xml.ValidationException\r
245   {\r
246     return (jalview.schemabinding.version2.ThresholdLine) Unmarshaller\r
247             .unmarshal(jalview.schemabinding.version2.ThresholdLine.class,\r
248                     reader);\r
249   }\r
250 \r
251   /**\r
252    * \r
253    * \r
254    * @throws org.exolab.castor.xml.ValidationException\r
255    *           if this object is an invalid instance according to the schema\r
256    */\r
257   public void validate() throws org.exolab.castor.xml.ValidationException\r
258   {\r
259     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
260     validator.validate(this);\r
261   }\r
262 \r
263 }\r