91bdfc6e8e99681387c526faecd424eae9a7bec0
[jalview.git] / src / jalview / schemabinding / version2 / ThresholdLine.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 ThresholdLine.\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class ThresholdLine implements java.io.Serializable\r
34 {\r
35 \r
36   // --------------------------/\r
37   // - Class/Member Variables -/\r
38   // --------------------------/\r
39 \r
40   /**\r
41    * Field _label.\r
42    */\r
43   private java.lang.String _label;\r
44 \r
45   /**\r
46    * Field _value.\r
47    */\r
48   private float _value;\r
49 \r
50   /**\r
51    * keeps track of state for field: _value\r
52    */\r
53   private boolean _has_value;\r
54 \r
55   /**\r
56    * Field _colour.\r
57    */\r
58   private int _colour;\r
59 \r
60   /**\r
61    * keeps track of state for field: _colour\r
62    */\r
63   private boolean _has_colour;\r
64 \r
65   // ----------------/\r
66   // - Constructors -/\r
67   // ----------------/\r
68 \r
69   public ThresholdLine()\r
70   {\r
71     super();\r
72   }\r
73 \r
74   // -----------/\r
75   // - Methods -/\r
76   // -----------/\r
77 \r
78   /**\r
79    */\r
80   public void deleteColour()\r
81   {\r
82     this._has_colour = false;\r
83   }\r
84 \r
85   /**\r
86    */\r
87   public void deleteValue()\r
88   {\r
89     this._has_value = false;\r
90   }\r
91 \r
92   /**\r
93    * Returns the value of field 'colour'.\r
94    * \r
95    * @return the value of field 'Colour'.\r
96    */\r
97   public int getColour()\r
98   {\r
99     return this._colour;\r
100   }\r
101 \r
102   /**\r
103    * Returns the value of field 'label'.\r
104    * \r
105    * @return the value of field 'Label'.\r
106    */\r
107   public java.lang.String getLabel()\r
108   {\r
109     return this._label;\r
110   }\r
111 \r
112   /**\r
113    * Returns the value of field 'value'.\r
114    * \r
115    * @return the value of field 'Value'.\r
116    */\r
117   public float getValue()\r
118   {\r
119     return this._value;\r
120   }\r
121 \r
122   /**\r
123    * Method hasColour.\r
124    * \r
125    * @return true if at least one Colour has been added\r
126    */\r
127   public boolean hasColour()\r
128   {\r
129     return this._has_colour;\r
130   }\r
131 \r
132   /**\r
133    * Method hasValue.\r
134    * \r
135    * @return true if at least one Value has been added\r
136    */\r
137   public boolean hasValue()\r
138   {\r
139     return this._has_value;\r
140   }\r
141 \r
142   /**\r
143    * Method isValid.\r
144    * \r
145    * @return true if this object is valid according to the schema\r
146    */\r
147   public boolean isValid()\r
148   {\r
149     try\r
150     {\r
151       validate();\r
152     } catch (org.exolab.castor.xml.ValidationException vex)\r
153     {\r
154       return false;\r
155     }\r
156     return true;\r
157   }\r
158 \r
159   /**\r
160    * \r
161    * \r
162    * @param out\r
163    * @throws org.exolab.castor.xml.MarshalException\r
164    *                 if object is null or if any SAXException is thrown during\r
165    *                 marshaling\r
166    * @throws org.exolab.castor.xml.ValidationException\r
167    *                 if this object is an invalid instance according to the\r
168    *                 schema\r
169    */\r
170   public void marshal(final java.io.Writer out)\r
171           throws org.exolab.castor.xml.MarshalException,\r
172           org.exolab.castor.xml.ValidationException\r
173   {\r
174     Marshaller.marshal(this, out);\r
175   }\r
176 \r
177   /**\r
178    * \r
179    * \r
180    * @param handler\r
181    * @throws java.io.IOException\r
182    *                 if an IOException occurs during marshaling\r
183    * @throws org.exolab.castor.xml.ValidationException\r
184    *                 if this object is an invalid instance according to the\r
185    *                 schema\r
186    * @throws org.exolab.castor.xml.MarshalException\r
187    *                 if object is null or if any SAXException is thrown during\r
188    *                 marshaling\r
189    */\r
190   public void marshal(final org.xml.sax.ContentHandler handler)\r
191           throws java.io.IOException,\r
192           org.exolab.castor.xml.MarshalException,\r
193           org.exolab.castor.xml.ValidationException\r
194   {\r
195     Marshaller.marshal(this, handler);\r
196   }\r
197 \r
198   /**\r
199    * Sets the value of field 'colour'.\r
200    * \r
201    * @param colour\r
202    *                the value of field 'colour'.\r
203    */\r
204   public void setColour(final int colour)\r
205   {\r
206     this._colour = colour;\r
207     this._has_colour = true;\r
208   }\r
209 \r
210   /**\r
211    * Sets the value of field 'label'.\r
212    * \r
213    * @param label\r
214    *                the value of field 'label'.\r
215    */\r
216   public void setLabel(final java.lang.String label)\r
217   {\r
218     this._label = label;\r
219   }\r
220 \r
221   /**\r
222    * Sets the value of field 'value'.\r
223    * \r
224    * @param value\r
225    *                the value of field 'value'.\r
226    */\r
227   public void setValue(final float value)\r
228   {\r
229     this._value = value;\r
230     this._has_value = true;\r
231   }\r
232 \r
233   /**\r
234    * Method unmarshal.\r
235    * \r
236    * @param reader\r
237    * @throws org.exolab.castor.xml.MarshalException\r
238    *                 if object is null or if any SAXException is thrown during\r
239    *                 marshaling\r
240    * @throws org.exolab.castor.xml.ValidationException\r
241    *                 if this object is an invalid instance according to the\r
242    *                 schema\r
243    * @return the unmarshaled jalview.schemabinding.version2.ThresholdLine\r
244    */\r
245   public static jalview.schemabinding.version2.ThresholdLine unmarshal(\r
246           final java.io.Reader reader)\r
247           throws org.exolab.castor.xml.MarshalException,\r
248           org.exolab.castor.xml.ValidationException\r
249   {\r
250     return (jalview.schemabinding.version2.ThresholdLine) Unmarshaller\r
251             .unmarshal(jalview.schemabinding.version2.ThresholdLine.class,\r
252                     reader);\r
253   }\r
254 \r
255   /**\r
256    * \r
257    * \r
258    * @throws org.exolab.castor.xml.ValidationException\r
259    *                 if this object is an invalid instance according to the\r
260    *                 schema\r
261    */\r
262   public void validate() throws org.exolab.castor.xml.ValidationException\r
263   {\r
264     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
265     validator.validate(this);\r
266   }\r
267 \r
268 }\r