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