merge from 2_4_Release branch
[jalview.git] / src / jalview / schemabinding / version2 / Setting.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 Setting.\r
30  * \r
31  * @version $Revision$ $Date$\r
32  */\r
33 public class Setting implements java.io.Serializable\r
34 {\r
35 \r
36   // --------------------------/\r
37   // - Class/Member Variables -/\r
38   // --------------------------/\r
39 \r
40   /**\r
41    * Field _type.\r
42    */\r
43   private java.lang.String _type;\r
44 \r
45   /**\r
46    * Field _colour.\r
47    */\r
48   private int _colour;\r
49 \r
50   /**\r
51    * keeps track of state for field: _colour\r
52    */\r
53   private boolean _has_colour;\r
54 \r
55   /**\r
56    * Field _display.\r
57    */\r
58   private boolean _display;\r
59 \r
60   /**\r
61    * keeps track of state for field: _display\r
62    */\r
63   private boolean _has_display;\r
64 \r
65   /**\r
66    * Field _order.\r
67    */\r
68   private float _order;\r
69 \r
70   /**\r
71    * keeps track of state for field: _order\r
72    */\r
73   private boolean _has_order;\r
74 \r
75   // ----------------/\r
76   // - Constructors -/\r
77   // ----------------/\r
78 \r
79   public Setting()\r
80   {\r
81     super();\r
82   }\r
83 \r
84   // -----------/\r
85   // - Methods -/\r
86   // -----------/\r
87 \r
88   /**\r
89    */\r
90   public void deleteColour()\r
91   {\r
92     this._has_colour = false;\r
93   }\r
94 \r
95   /**\r
96    */\r
97   public void deleteDisplay()\r
98   {\r
99     this._has_display = false;\r
100   }\r
101 \r
102   /**\r
103    */\r
104   public void deleteOrder()\r
105   {\r
106     this._has_order = false;\r
107   }\r
108 \r
109   /**\r
110    * Returns the value of field 'colour'.\r
111    * \r
112    * @return the value of field 'Colour'.\r
113    */\r
114   public int getColour()\r
115   {\r
116     return this._colour;\r
117   }\r
118 \r
119   /**\r
120    * Returns the value of field 'display'.\r
121    * \r
122    * @return the value of field 'Display'.\r
123    */\r
124   public boolean getDisplay()\r
125   {\r
126     return this._display;\r
127   }\r
128 \r
129   /**\r
130    * Returns the value of field 'order'.\r
131    * \r
132    * @return the value of field 'Order'.\r
133    */\r
134   public float getOrder()\r
135   {\r
136     return this._order;\r
137   }\r
138 \r
139   /**\r
140    * Returns the value of field 'type'.\r
141    * \r
142    * @return the value of field 'Type'.\r
143    */\r
144   public java.lang.String getType()\r
145   {\r
146     return this._type;\r
147   }\r
148 \r
149   /**\r
150    * Method hasColour.\r
151    * \r
152    * @return true if at least one Colour has been added\r
153    */\r
154   public boolean hasColour()\r
155   {\r
156     return this._has_colour;\r
157   }\r
158 \r
159   /**\r
160    * Method hasDisplay.\r
161    * \r
162    * @return true if at least one Display has been added\r
163    */\r
164   public boolean hasDisplay()\r
165   {\r
166     return this._has_display;\r
167   }\r
168 \r
169   /**\r
170    * Method hasOrder.\r
171    * \r
172    * @return true if at least one Order has been added\r
173    */\r
174   public boolean hasOrder()\r
175   {\r
176     return this._has_order;\r
177   }\r
178 \r
179   /**\r
180    * Returns the value of field 'display'.\r
181    * \r
182    * @return the value of field 'Display'.\r
183    */\r
184   public boolean isDisplay()\r
185   {\r
186     return this._display;\r
187   }\r
188 \r
189   /**\r
190    * Method isValid.\r
191    * \r
192    * @return true if this object is valid according to the schema\r
193    */\r
194   public boolean isValid()\r
195   {\r
196     try\r
197     {\r
198       validate();\r
199     } catch (org.exolab.castor.xml.ValidationException vex)\r
200     {\r
201       return false;\r
202     }\r
203     return true;\r
204   }\r
205 \r
206   /**\r
207    * \r
208    * \r
209    * @param out\r
210    * @throws org.exolab.castor.xml.MarshalException\r
211    *                 if object is null or if any SAXException is thrown during\r
212    *                 marshaling\r
213    * @throws org.exolab.castor.xml.ValidationException\r
214    *                 if this object is an invalid instance according to the\r
215    *                 schema\r
216    */\r
217   public void marshal(final java.io.Writer out)\r
218           throws org.exolab.castor.xml.MarshalException,\r
219           org.exolab.castor.xml.ValidationException\r
220   {\r
221     Marshaller.marshal(this, out);\r
222   }\r
223 \r
224   /**\r
225    * \r
226    * \r
227    * @param handler\r
228    * @throws java.io.IOException\r
229    *                 if an IOException occurs during marshaling\r
230    * @throws org.exolab.castor.xml.ValidationException\r
231    *                 if this object is an invalid instance according to the\r
232    *                 schema\r
233    * @throws org.exolab.castor.xml.MarshalException\r
234    *                 if object is null or if any SAXException is thrown during\r
235    *                 marshaling\r
236    */\r
237   public void marshal(final org.xml.sax.ContentHandler handler)\r
238           throws java.io.IOException,\r
239           org.exolab.castor.xml.MarshalException,\r
240           org.exolab.castor.xml.ValidationException\r
241   {\r
242     Marshaller.marshal(this, handler);\r
243   }\r
244 \r
245   /**\r
246    * Sets the value of field 'colour'.\r
247    * \r
248    * @param colour\r
249    *                the value of field 'colour'.\r
250    */\r
251   public void setColour(final int colour)\r
252   {\r
253     this._colour = colour;\r
254     this._has_colour = true;\r
255   }\r
256 \r
257   /**\r
258    * Sets the value of field 'display'.\r
259    * \r
260    * @param display\r
261    *                the value of field 'display'.\r
262    */\r
263   public void setDisplay(final boolean display)\r
264   {\r
265     this._display = display;\r
266     this._has_display = true;\r
267   }\r
268 \r
269   /**\r
270    * Sets the value of field 'order'.\r
271    * \r
272    * @param order\r
273    *                the value of field 'order'.\r
274    */\r
275   public void setOrder(final float order)\r
276   {\r
277     this._order = order;\r
278     this._has_order = true;\r
279   }\r
280 \r
281   /**\r
282    * Sets the value of field 'type'.\r
283    * \r
284    * @param type\r
285    *                the value of field 'type'.\r
286    */\r
287   public void setType(final java.lang.String type)\r
288   {\r
289     this._type = type;\r
290   }\r
291 \r
292   /**\r
293    * Method unmarshal.\r
294    * \r
295    * @param reader\r
296    * @throws org.exolab.castor.xml.MarshalException\r
297    *                 if object is null or if any SAXException is thrown during\r
298    *                 marshaling\r
299    * @throws org.exolab.castor.xml.ValidationException\r
300    *                 if this object is an invalid instance according to the\r
301    *                 schema\r
302    * @return the unmarshaled jalview.schemabinding.version2.Settin\r
303    */\r
304   public static jalview.schemabinding.version2.Setting unmarshal(\r
305           final java.io.Reader reader)\r
306           throws org.exolab.castor.xml.MarshalException,\r
307           org.exolab.castor.xml.ValidationException\r
308   {\r
309     return (jalview.schemabinding.version2.Setting) Unmarshaller.unmarshal(\r
310             jalview.schemabinding.version2.Setting.class, reader);\r
311   }\r
312 \r
313   /**\r
314    * \r
315    * \r
316    * @throws org.exolab.castor.xml.ValidationException\r
317    *                 if this object is an invalid instance according to the\r
318    *                 schema\r
319    */\r
320   public void validate() throws org.exolab.castor.xml.ValidationException\r
321   {\r
322     org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
323     validator.validate(this);\r
324   }\r
325 \r
326 }\r