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