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