extended Colour element with additional optional attributes for graduated colour
[jalview.git] / src / jalview / binding / AnnotationElement.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4.1)
3  * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.binding;
20
21   //---------------------------------/
22  //- Imported classes and packages -/
23 //---------------------------------/
24
25 import org.exolab.castor.xml.Marshaller;
26 import org.exolab.castor.xml.Unmarshaller;
27
28 /**
29  * Class AnnotationElement.
30  * 
31  * @version $Revision$ $Date$
32  */
33 public class AnnotationElement implements java.io.Serializable {
34
35
36       //--------------------------/
37      //- Class/Member Variables -/
38     //--------------------------/
39
40     /**
41      * Field _position.
42      */
43     private int _position;
44
45     /**
46      * keeps track of state for field: _position
47      */
48     private boolean _has_position;
49
50     /**
51      * Field _displayCharacter.
52      */
53     private java.lang.String _displayCharacter;
54
55     /**
56      * Field _description.
57      */
58     private java.lang.String _description;
59
60     /**
61      * Field _secondaryStructure.
62      */
63     private java.lang.String _secondaryStructure;
64
65     /**
66      * Field _value.
67      */
68     private float _value;
69
70     /**
71      * keeps track of state for field: _value
72      */
73     private boolean _has_value;
74
75
76       //----------------/
77      //- Constructors -/
78     //----------------/
79
80     public AnnotationElement() {
81         super();
82     }
83
84
85       //-----------/
86      //- Methods -/
87     //-----------/
88
89     /**
90      */
91     public void deletePosition(
92     ) {
93         this._has_position= false;
94     }
95
96     /**
97      */
98     public void deleteValue(
99     ) {
100         this._has_value= false;
101     }
102
103     /**
104      * Returns the value of field 'description'.
105      * 
106      * @return the value of field 'Description'.
107      */
108     public java.lang.String getDescription(
109     ) {
110         return this._description;
111     }
112
113     /**
114      * Returns the value of field 'displayCharacter'.
115      * 
116      * @return the value of field 'DisplayCharacter'.
117      */
118     public java.lang.String getDisplayCharacter(
119     ) {
120         return this._displayCharacter;
121     }
122
123     /**
124      * Returns the value of field 'position'.
125      * 
126      * @return the value of field 'Position'.
127      */
128     public int getPosition(
129     ) {
130         return this._position;
131     }
132
133     /**
134      * Returns the value of field 'secondaryStructure'.
135      * 
136      * @return the value of field 'SecondaryStructure'.
137      */
138     public java.lang.String getSecondaryStructure(
139     ) {
140         return this._secondaryStructure;
141     }
142
143     /**
144      * Returns the value of field 'value'.
145      * 
146      * @return the value of field 'Value'.
147      */
148     public float getValue(
149     ) {
150         return this._value;
151     }
152
153     /**
154      * Method hasPosition.
155      * 
156      * @return true if at least one Position has been added
157      */
158     public boolean hasPosition(
159     ) {
160         return this._has_position;
161     }
162
163     /**
164      * Method hasValue.
165      * 
166      * @return true if at least one Value has been added
167      */
168     public boolean hasValue(
169     ) {
170         return this._has_value;
171     }
172
173     /**
174      * Method isValid.
175      * 
176      * @return true if this object is valid according to the schema
177      */
178     public boolean isValid(
179     ) {
180         try {
181             validate();
182         } catch (org.exolab.castor.xml.ValidationException vex) {
183             return false;
184         }
185         return true;
186     }
187
188     /**
189      * 
190      * 
191      * @param out
192      * @throws org.exolab.castor.xml.MarshalException if object is
193      * null or if any SAXException is thrown during marshaling
194      * @throws org.exolab.castor.xml.ValidationException if this
195      * object is an invalid instance according to the schema
196      */
197     public void marshal(
198             final java.io.Writer out)
199     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
200         Marshaller.marshal(this, out);
201     }
202
203     /**
204      * 
205      * 
206      * @param handler
207      * @throws java.io.IOException if an IOException occurs during
208      * marshaling
209      * @throws org.exolab.castor.xml.ValidationException if this
210      * object is an invalid instance according to the schema
211      * @throws org.exolab.castor.xml.MarshalException if object is
212      * null or if any SAXException is thrown during marshaling
213      */
214     public void marshal(
215             final org.xml.sax.ContentHandler handler)
216     throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
217         Marshaller.marshal(this, handler);
218     }
219
220     /**
221      * Sets the value of field 'description'.
222      * 
223      * @param description the value of field 'description'.
224      */
225     public void setDescription(
226             final java.lang.String description) {
227         this._description = description;
228     }
229
230     /**
231      * Sets the value of field 'displayCharacter'.
232      * 
233      * @param displayCharacter the value of field 'displayCharacter'
234      */
235     public void setDisplayCharacter(
236             final java.lang.String displayCharacter) {
237         this._displayCharacter = displayCharacter;
238     }
239
240     /**
241      * Sets the value of field 'position'.
242      * 
243      * @param position the value of field 'position'.
244      */
245     public void setPosition(
246             final int position) {
247         this._position = position;
248         this._has_position = true;
249     }
250
251     /**
252      * Sets the value of field 'secondaryStructure'.
253      * 
254      * @param secondaryStructure the value of field
255      * 'secondaryStructure'.
256      */
257     public void setSecondaryStructure(
258             final java.lang.String secondaryStructure) {
259         this._secondaryStructure = secondaryStructure;
260     }
261
262     /**
263      * Sets the value of field 'value'.
264      * 
265      * @param value the value of field 'value'.
266      */
267     public void setValue(
268             final float value) {
269         this._value = value;
270         this._has_value = true;
271     }
272
273     /**
274      * Method unmarshal.
275      * 
276      * @param reader
277      * @throws org.exolab.castor.xml.MarshalException if object is
278      * null or if any SAXException is thrown during marshaling
279      * @throws org.exolab.castor.xml.ValidationException if this
280      * object is an invalid instance according to the schema
281      * @return the unmarshaled jalview.binding.AnnotationElement
282      */
283     public static jalview.binding.AnnotationElement unmarshal(
284             final java.io.Reader reader)
285     throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
286         return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal(jalview.binding.AnnotationElement.class, reader);
287     }
288
289     /**
290      * 
291      * 
292      * @throws org.exolab.castor.xml.ValidationException if this
293      * object is an invalid instance according to the schema
294      */
295     public void validate(
296     )
297     throws org.exolab.castor.xml.ValidationException {
298         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
299         validator.validate(this);
300     }
301
302 }