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