2 * This class was automatically generated with
3 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
8 package jalview.binding;
10 //---------------------------------/
11 //- Imported classes and packages -/
12 //---------------------------------/
14 import org.exolab.castor.xml.Marshaller;
15 import org.exolab.castor.xml.Unmarshaller;
20 * @version $Revision$ $Date$
22 public class Annotation implements java.io.Serializable {
25 //--------------------------/
26 //- Class/Member Variables -/
27 //--------------------------/
32 private boolean _graph;
35 * keeps track of state for field: _graph
37 private boolean _has_graph;
42 private int _graphType;
45 * keeps track of state for field: _graphType
47 private boolean _has_graphType;
50 * Field _annotationElementList.
52 private java.util.Vector _annotationElementList;
57 private java.lang.String _label;
62 private java.lang.String _description;
71 this._annotationElementList = new java.util.Vector();
82 * @param vAnnotationElement
83 * @throws java.lang.IndexOutOfBoundsException if the index
84 * given is outside the bounds of the collection
86 public void addAnnotationElement(
87 final jalview.binding.AnnotationElement vAnnotationElement)
88 throws java.lang.IndexOutOfBoundsException {
89 this._annotationElementList.addElement(vAnnotationElement);
96 * @param vAnnotationElement
97 * @throws java.lang.IndexOutOfBoundsException if the index
98 * given is outside the bounds of the collection
100 public void addAnnotationElement(
102 final jalview.binding.AnnotationElement vAnnotationElement)
103 throws java.lang.IndexOutOfBoundsException {
104 this._annotationElementList.add(index, vAnnotationElement);
109 public void deleteGraph(
111 this._has_graph= false;
116 public void deleteGraphType(
118 this._has_graphType= false;
122 * Method enumerateAnnotationElement.
124 * @return an Enumeration over all
125 * jalview.binding.AnnotationElement elements
127 public java.util.Enumeration enumerateAnnotationElement(
129 return this._annotationElementList.elements();
133 * Method getAnnotationElement.
136 * @throws java.lang.IndexOutOfBoundsException if the index
137 * given is outside the bounds of the collection
138 * @return the value of the jalview.binding.AnnotationElement
141 public jalview.binding.AnnotationElement getAnnotationElement(
143 throws java.lang.IndexOutOfBoundsException {
144 // check bounds for index
145 if (index < 0 || index >= this._annotationElementList.size()) {
146 throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
149 return (jalview.binding.AnnotationElement) _annotationElementList.get(index);
153 * Method getAnnotationElement.Returns the contents of the
154 * collection in an Array. <p>Note: Just in case the
155 * collection contents are changing in another thread, we pass
156 * a 0-length Array of the correct type into the API call.
157 * This way we <i>know</i> that the Array returned is of
158 * exactly the correct length.
160 * @return this collection as an Array
162 public jalview.binding.AnnotationElement[] getAnnotationElement(
164 jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0];
165 return (jalview.binding.AnnotationElement[]) this._annotationElementList.toArray(array);
169 * Method getAnnotationElementCount.
171 * @return the size of this collection
173 public int getAnnotationElementCount(
175 return this._annotationElementList.size();
179 * Returns the value of field 'description'.
181 * @return the value of field 'Description'.
183 public java.lang.String getDescription(
185 return this._description;
189 * Returns the value of field 'graph'.
191 * @return the value of field 'Graph'.
193 public boolean getGraph(
199 * Returns the value of field 'graphType'.
201 * @return the value of field 'GraphType'.
203 public int getGraphType(
205 return this._graphType;
209 * Returns the value of field 'label'.
211 * @return the value of field 'Label'.
213 public java.lang.String getLabel(
221 * @return true if at least one Graph has been added
223 public boolean hasGraph(
225 return this._has_graph;
229 * Method hasGraphType.
231 * @return true if at least one GraphType has been added
233 public boolean hasGraphType(
235 return this._has_graphType;
239 * Returns the value of field 'graph'.
241 * @return the value of field 'Graph'.
243 public boolean isGraph(
251 * @return true if this object is valid according to the schema
253 public boolean isValid(
257 } catch (org.exolab.castor.xml.ValidationException vex) {
267 * @throws org.exolab.castor.xml.MarshalException if object is
268 * null or if any SAXException is thrown during marshaling
269 * @throws org.exolab.castor.xml.ValidationException if this
270 * object is an invalid instance according to the schema
273 final java.io.Writer out)
274 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
275 Marshaller.marshal(this, out);
282 * @throws java.io.IOException if an IOException occurs during
284 * @throws org.exolab.castor.xml.ValidationException if this
285 * object is an invalid instance according to the schema
286 * @throws org.exolab.castor.xml.MarshalException if object is
287 * null or if any SAXException is thrown during marshaling
290 final org.xml.sax.ContentHandler handler)
291 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
292 Marshaller.marshal(this, handler);
297 public void removeAllAnnotationElement(
299 this._annotationElementList.clear();
303 * Method removeAnnotationElement.
305 * @param vAnnotationElement
306 * @return true if the object was removed from the collection.
308 public boolean removeAnnotationElement(
309 final jalview.binding.AnnotationElement vAnnotationElement) {
310 boolean removed = _annotationElementList.remove(vAnnotationElement);
315 * Method removeAnnotationElementAt.
318 * @return the element removed from the collection
320 public jalview.binding.AnnotationElement removeAnnotationElementAt(
322 java.lang.Object obj = this._annotationElementList.remove(index);
323 return (jalview.binding.AnnotationElement) obj;
330 * @param vAnnotationElement
331 * @throws java.lang.IndexOutOfBoundsException if the index
332 * given is outside the bounds of the collection
334 public void setAnnotationElement(
336 final jalview.binding.AnnotationElement vAnnotationElement)
337 throws java.lang.IndexOutOfBoundsException {
338 // check bounds for index
339 if (index < 0 || index >= this._annotationElementList.size()) {
340 throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
343 this._annotationElementList.set(index, vAnnotationElement);
349 * @param vAnnotationElementArray
351 public void setAnnotationElement(
352 final jalview.binding.AnnotationElement[] vAnnotationElementArray) {
354 _annotationElementList.clear();
356 for (int i = 0; i < vAnnotationElementArray.length; i++) {
357 this._annotationElementList.add(vAnnotationElementArray[i]);
362 * Sets the value of field 'description'.
364 * @param description the value of field 'description'.
366 public void setDescription(
367 final java.lang.String description) {
368 this._description = description;
372 * Sets the value of field 'graph'.
374 * @param graph the value of field 'graph'.
376 public void setGraph(
377 final boolean graph) {
379 this._has_graph = true;
383 * Sets the value of field 'graphType'.
385 * @param graphType the value of field 'graphType'.
387 public void setGraphType(
388 final int graphType) {
389 this._graphType = graphType;
390 this._has_graphType = true;
394 * Sets the value of field 'label'.
396 * @param label the value of field 'label'.
398 public void setLabel(
399 final java.lang.String label) {
407 * @throws org.exolab.castor.xml.MarshalException if object is
408 * null or if any SAXException is thrown during marshaling
409 * @throws org.exolab.castor.xml.ValidationException if this
410 * object is an invalid instance according to the schema
411 * @return the unmarshaled jalview.binding.Annotation
413 public static jalview.binding.Annotation unmarshal(
414 final java.io.Reader reader)
415 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
416 return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);
422 * @throws org.exolab.castor.xml.ValidationException if this
423 * object is an invalid instance according to the schema
425 public void validate(
427 throws org.exolab.castor.xml.ValidationException {
428 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
429 validator.validate(this);