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