26df33977818046799f32848435f43cf26323979
[jalview.git] / src / jalview / schemabinding / version2 / ThresholdLine.java
1 /*\r
2  * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)\r
3  * Copyright (C) 2009 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       //----------------/\r
67      //- Constructors -/\r
68     //----------------/\r
69 \r
70     public ThresholdLine() {\r
71         super();\r
72     }\r
73 \r
74 \r
75       //-----------/\r
76      //- Methods -/\r
77     //-----------/\r
78 \r
79     /**\r
80      */\r
81     public void deleteColour(\r
82     ) {\r
83         this._has_colour= false;\r
84     }\r
85 \r
86     /**\r
87      */\r
88     public void deleteValue(\r
89     ) {\r
90         this._has_value= false;\r
91     }\r
92 \r
93     /**\r
94      * Returns the value of field 'colour'.\r
95      * \r
96      * @return the value of field 'Colour'.\r
97      */\r
98     public int getColour(\r
99     ) {\r
100         return this._colour;\r
101     }\r
102 \r
103     /**\r
104      * Returns the value of field 'label'.\r
105      * \r
106      * @return the value of field 'Label'.\r
107      */\r
108     public java.lang.String getLabel(\r
109     ) {\r
110         return this._label;\r
111     }\r
112 \r
113     /**\r
114      * Returns the value of field 'value'.\r
115      * \r
116      * @return the value of field 'Value'.\r
117      */\r
118     public float getValue(\r
119     ) {\r
120         return this._value;\r
121     }\r
122 \r
123     /**\r
124      * Method hasColour.\r
125      * \r
126      * @return true if at least one Colour has been added\r
127      */\r
128     public boolean hasColour(\r
129     ) {\r
130         return this._has_colour;\r
131     }\r
132 \r
133     /**\r
134      * Method hasValue.\r
135      * \r
136      * @return true if at least one Value has been added\r
137      */\r
138     public boolean hasValue(\r
139     ) {\r
140         return this._has_value;\r
141     }\r
142 \r
143     /**\r
144      * Method isValid.\r
145      * \r
146      * @return true if this object is valid according to the schema\r
147      */\r
148     public boolean isValid(\r
149     ) {\r
150         try {\r
151             validate();\r
152         } catch (org.exolab.castor.xml.ValidationException vex) {\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 if object is\r
163      * null or if any SAXException is thrown during marshaling\r
164      * @throws org.exolab.castor.xml.ValidationException if this\r
165      * object is an invalid instance according to the schema\r
166      */\r
167     public void marshal(\r
168             final java.io.Writer out)\r
169     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
170         Marshaller.marshal(this, out);\r
171     }\r
172 \r
173     /**\r
174      * \r
175      * \r
176      * @param handler\r
177      * @throws java.io.IOException if an IOException occurs during\r
178      * marshaling\r
179      * @throws org.exolab.castor.xml.ValidationException if this\r
180      * object is an invalid instance according to the schema\r
181      * @throws org.exolab.castor.xml.MarshalException if object is\r
182      * null or if any SAXException is thrown during marshaling\r
183      */\r
184     public void marshal(\r
185             final org.xml.sax.ContentHandler handler)\r
186     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
187         Marshaller.marshal(this, handler);\r
188     }\r
189 \r
190     /**\r
191      * Sets the value of field 'colour'.\r
192      * \r
193      * @param colour the value of field 'colour'.\r
194      */\r
195     public void setColour(\r
196             final int colour) {\r
197         this._colour = colour;\r
198         this._has_colour = true;\r
199     }\r
200 \r
201     /**\r
202      * Sets the value of field 'label'.\r
203      * \r
204      * @param label the value of field 'label'.\r
205      */\r
206     public void setLabel(\r
207             final java.lang.String label) {\r
208         this._label = label;\r
209     }\r
210 \r
211     /**\r
212      * Sets the value of field 'value'.\r
213      * \r
214      * @param value the value of field 'value'.\r
215      */\r
216     public void setValue(\r
217             final float value) {\r
218         this._value = value;\r
219         this._has_value = true;\r
220     }\r
221 \r
222     /**\r
223      * Method unmarshal.\r
224      * \r
225      * @param reader\r
226      * @throws org.exolab.castor.xml.MarshalException if object is\r
227      * null or if any SAXException is thrown during marshaling\r
228      * @throws org.exolab.castor.xml.ValidationException if this\r
229      * object is an invalid instance according to the schema\r
230      * @return the unmarshaled\r
231      * jalview.schemabinding.version2.ThresholdLine\r
232      */\r
233     public static jalview.schemabinding.version2.ThresholdLine unmarshal(\r
234             final java.io.Reader reader)\r
235     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {\r
236         return (jalview.schemabinding.version2.ThresholdLine) Unmarshaller.unmarshal(jalview.schemabinding.version2.ThresholdLine.class, reader);\r
237     }\r
238 \r
239     /**\r
240      * \r
241      * \r
242      * @throws org.exolab.castor.xml.ValidationException if this\r
243      * object is an invalid instance according to the schema\r
244      */\r
245     public void validate(\r
246     )\r
247     throws org.exolab.castor.xml.ValidationException {\r
248         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
249         validator.validate(this);\r
250     }\r
251 \r
252 }\r