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