2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
\r
3 * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\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
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
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
19 package jalview.schemabinding.version2;
\r
21 // ---------------------------------/
\r
22 // - Imported classes and packages -/
\r
23 // ---------------------------------/
\r
25 import org.exolab.castor.xml.Marshaller;
\r
26 import org.exolab.castor.xml.Unmarshaller;
\r
29 * Class AnnotationElement.
\r
31 * @version $Revision$ $Date$
\r
33 public class AnnotationElement implements java.io.Serializable
\r
36 // --------------------------/
\r
37 // - Class/Member Variables -/
\r
38 // --------------------------/
\r
43 private int _position;
\r
46 * keeps track of state for field: _position
\r
48 private boolean _has_position;
\r
53 private int _colour;
\r
56 * keeps track of state for field: _colour
\r
58 private boolean _has_colour;
\r
61 * Field _displayCharacter.
\r
63 private java.lang.String _displayCharacter;
\r
66 * Field _description.
\r
68 private java.lang.String _description;
\r
71 * Field _secondaryStructure.
\r
73 private java.lang.String _secondaryStructure;
\r
78 private float _value;
\r
81 * keeps track of state for field: _value
\r
83 private boolean _has_value;
\r
85 // ----------------/
\r
86 // - Constructors -/
\r
87 // ----------------/
\r
89 public AnnotationElement()
\r
100 public void deleteColour()
\r
102 this._has_colour = false;
\r
107 public void deletePosition()
\r
109 this._has_position = false;
\r
114 public void deleteValue()
\r
116 this._has_value = false;
\r
120 * Returns the value of field 'colour'.
\r
122 * @return the value of field 'Colour'.
\r
124 public int getColour()
\r
126 return this._colour;
\r
130 * Returns the value of field 'description'.
\r
132 * @return the value of field 'Description'.
\r
134 public java.lang.String getDescription()
\r
136 return this._description;
\r
140 * Returns the value of field 'displayCharacter'.
\r
142 * @return the value of field 'DisplayCharacter'.
\r
144 public java.lang.String getDisplayCharacter()
\r
146 return this._displayCharacter;
\r
150 * Returns the value of field 'position'.
\r
152 * @return the value of field 'Position'.
\r
154 public int getPosition()
\r
156 return this._position;
\r
160 * Returns the value of field 'secondaryStructure'.
\r
162 * @return the value of field 'SecondaryStructure'.
\r
164 public java.lang.String getSecondaryStructure()
\r
166 return this._secondaryStructure;
\r
170 * Returns the value of field 'value'.
\r
172 * @return the value of field 'Value'.
\r
174 public float getValue()
\r
176 return this._value;
\r
180 * Method hasColour.
\r
182 * @return true if at least one Colour has been added
\r
184 public boolean hasColour()
\r
186 return this._has_colour;
\r
190 * Method hasPosition.
\r
192 * @return true if at least one Position has been added
\r
194 public boolean hasPosition()
\r
196 return this._has_position;
\r
202 * @return true if at least one Value has been added
\r
204 public boolean hasValue()
\r
206 return this._has_value;
\r
212 * @return true if this object is valid according to the schema
\r
214 public boolean isValid()
\r
219 } catch (org.exolab.castor.xml.ValidationException vex)
\r
230 * @throws org.exolab.castor.xml.MarshalException
\r
231 * if object is null or if any SAXException is thrown during
\r
233 * @throws org.exolab.castor.xml.ValidationException
\r
234 * if this object is an invalid instance according to the
\r
237 public void marshal(final java.io.Writer out)
\r
238 throws org.exolab.castor.xml.MarshalException,
\r
239 org.exolab.castor.xml.ValidationException
\r
241 Marshaller.marshal(this, out);
\r
248 * @throws java.io.IOException
\r
249 * if an IOException occurs during marshaling
\r
250 * @throws org.exolab.castor.xml.ValidationException
\r
251 * if this object is an invalid instance according to the
\r
253 * @throws org.exolab.castor.xml.MarshalException
\r
254 * if object is null or if any SAXException is thrown during
\r
257 public void marshal(final org.xml.sax.ContentHandler handler)
\r
258 throws java.io.IOException,
\r
259 org.exolab.castor.xml.MarshalException,
\r
260 org.exolab.castor.xml.ValidationException
\r
262 Marshaller.marshal(this, handler);
\r
266 * Sets the value of field 'colour'.
\r
269 * the value of field 'colour'.
\r
271 public void setColour(final int colour)
\r
273 this._colour = colour;
\r
274 this._has_colour = true;
\r
278 * Sets the value of field 'description'.
\r
280 * @param description
\r
281 * the value of field 'description'.
\r
283 public void setDescription(final java.lang.String description)
\r
285 this._description = description;
\r
289 * Sets the value of field 'displayCharacter'.
\r
291 * @param displayCharacter
\r
292 * the value of field 'displayCharacter'
\r
294 public void setDisplayCharacter(final java.lang.String displayCharacter)
\r
296 this._displayCharacter = displayCharacter;
\r
300 * Sets the value of field 'position'.
\r
303 * the value of field 'position'.
\r
305 public void setPosition(final int position)
\r
307 this._position = position;
\r
308 this._has_position = true;
\r
312 * Sets the value of field 'secondaryStructure'.
\r
314 * @param secondaryStructure
\r
315 * the value of field 'secondaryStructure'.
\r
317 public void setSecondaryStructure(
\r
318 final java.lang.String secondaryStructure)
\r
320 this._secondaryStructure = secondaryStructure;
\r
324 * Sets the value of field 'value'.
\r
327 * the value of field 'value'.
\r
329 public void setValue(final float value)
\r
331 this._value = value;
\r
332 this._has_value = true;
\r
336 * Method unmarshal.
\r
339 * @throws org.exolab.castor.xml.MarshalException
\r
340 * if object is null or if any SAXException is thrown during
\r
342 * @throws org.exolab.castor.xml.ValidationException
\r
343 * if this object is an invalid instance according to the
\r
345 * @return the unmarshaled jalview.schemabinding.version2.AnnotationElement
\r
347 public static jalview.schemabinding.version2.AnnotationElement unmarshal(
\r
348 final java.io.Reader reader)
\r
349 throws org.exolab.castor.xml.MarshalException,
\r
350 org.exolab.castor.xml.ValidationException
\r
352 return (jalview.schemabinding.version2.AnnotationElement) Unmarshaller
\r
354 jalview.schemabinding.version2.AnnotationElement.class,
\r
361 * @throws org.exolab.castor.xml.ValidationException
\r
362 * if this object is an invalid instance according to the
\r
365 public void validate() throws org.exolab.castor.xml.ValidationException
\r
367 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
368 validator.validate(this);
\r