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();
81 * @param vAnnotationElement
82 * @throws java.lang.IndexOutOfBoundsException
83 * if the index given is outside the bounds of the collection
85 public void addAnnotationElement(
86 final jalview.binding.AnnotationElement vAnnotationElement)
87 throws java.lang.IndexOutOfBoundsException
89 this._annotationElementList.addElement(vAnnotationElement);
96 * @param vAnnotationElement
97 * @throws java.lang.IndexOutOfBoundsException
98 * if the index given is outside the bounds of the collection
100 public void addAnnotationElement(final int index,
101 final jalview.binding.AnnotationElement vAnnotationElement)
102 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 jalview.binding.AnnotationElement elements
126 public java.util.Enumeration enumerateAnnotationElement()
128 return this._annotationElementList.elements();
132 * Method getAnnotationElement.
135 * @throws java.lang.IndexOutOfBoundsException
136 * if the index given is outside the bounds of the collection
137 * @return the value of the jalview.binding.AnnotationElement at the given
140 public jalview.binding.AnnotationElement getAnnotationElement(
141 final int index) throws java.lang.IndexOutOfBoundsException
143 // check bounds for index
144 if (index < 0 || index >= this._annotationElementList.size())
146 throw new IndexOutOfBoundsException(
147 "getAnnotationElement: Index value '" + index
148 + "' not in range [0.."
149 + (this._annotationElementList.size() - 1) + "]");
152 return (jalview.binding.AnnotationElement) _annotationElementList
157 * Method getAnnotationElement.Returns the contents of the collection in an
160 * Note: Just in case the collection contents are changing in another thread,
161 * we pass a 0-length Array of the correct type into the API call. This way we
162 * <i>know</i> that the Array returned is of exactly the correct length.
164 * @return this collection as an Array
166 public jalview.binding.AnnotationElement[] getAnnotationElement()
168 jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0];
169 return (jalview.binding.AnnotationElement[]) this._annotationElementList
174 * Method getAnnotationElementCount.
176 * @return the size of this collection
178 public int getAnnotationElementCount()
180 return this._annotationElementList.size();
184 * Returns the value of field 'description'.
186 * @return the value of field 'Description'.
188 public java.lang.String getDescription()
190 return this._description;
194 * Returns the value of field 'graph'.
196 * @return the value of field 'Graph'.
198 public boolean getGraph()
204 * Returns the value of field 'graphType'.
206 * @return the value of field 'GraphType'.
208 public int getGraphType()
210 return this._graphType;
214 * Returns the value of field 'label'.
216 * @return the value of field 'Label'.
218 public java.lang.String getLabel()
226 * @return true if at least one Graph has been added
228 public boolean hasGraph()
230 return this._has_graph;
234 * Method hasGraphType.
236 * @return true if at least one GraphType has been added
238 public boolean hasGraphType()
240 return this._has_graphType;
244 * Returns the value of field 'graph'.
246 * @return the value of field 'Graph'.
248 public boolean isGraph()
256 * @return true if this object is valid according to the schema
258 public boolean isValid()
263 } catch (org.exolab.castor.xml.ValidationException vex)
274 * @throws org.exolab.castor.xml.MarshalException
275 * if object is null or if any SAXException is thrown during
277 * @throws org.exolab.castor.xml.ValidationException
278 * if this object is an invalid instance according to the schema
280 public void marshal(final java.io.Writer out)
281 throws org.exolab.castor.xml.MarshalException,
282 org.exolab.castor.xml.ValidationException
284 Marshaller.marshal(this, out);
291 * @throws java.io.IOException
292 * if an IOException occurs during marshaling
293 * @throws org.exolab.castor.xml.ValidationException
294 * if this object is an invalid instance according to the schema
295 * @throws org.exolab.castor.xml.MarshalException
296 * if object is null or if any SAXException is thrown during
299 public void marshal(final org.xml.sax.ContentHandler handler)
300 throws java.io.IOException,
301 org.exolab.castor.xml.MarshalException,
302 org.exolab.castor.xml.ValidationException
304 Marshaller.marshal(this, handler);
309 public void removeAllAnnotationElement()
311 this._annotationElementList.clear();
315 * Method removeAnnotationElement.
317 * @param vAnnotationElement
318 * @return true if the object was removed from the collection.
320 public boolean removeAnnotationElement(
321 final jalview.binding.AnnotationElement vAnnotationElement)
323 boolean removed = _annotationElementList.remove(vAnnotationElement);
328 * Method removeAnnotationElementAt.
331 * @return the element removed from the collection
333 public jalview.binding.AnnotationElement removeAnnotationElementAt(
336 java.lang.Object obj = this._annotationElementList.remove(index);
337 return (jalview.binding.AnnotationElement) obj;
344 * @param vAnnotationElement
345 * @throws java.lang.IndexOutOfBoundsException
346 * if the index given is outside the bounds of the collection
348 public void setAnnotationElement(final int index,
349 final jalview.binding.AnnotationElement vAnnotationElement)
350 throws java.lang.IndexOutOfBoundsException
352 // check bounds for index
353 if (index < 0 || index >= this._annotationElementList.size())
355 throw new IndexOutOfBoundsException(
356 "setAnnotationElement: Index value '" + index
357 + "' not in range [0.."
358 + (this._annotationElementList.size() - 1) + "]");
361 this._annotationElementList.set(index, vAnnotationElement);
367 * @param vAnnotationElementArray
369 public void setAnnotationElement(
370 final jalview.binding.AnnotationElement[] vAnnotationElementArray)
373 _annotationElementList.clear();
375 for (int i = 0; i < vAnnotationElementArray.length; i++)
377 this._annotationElementList.add(vAnnotationElementArray[i]);
382 * Sets the value of field 'description'.
385 * the value of field 'description'.
387 public void setDescription(final java.lang.String description)
389 this._description = description;
393 * Sets the value of field 'graph'.
396 * the value of field 'graph'.
398 public void setGraph(final boolean graph)
401 this._has_graph = true;
405 * Sets the value of field 'graphType'.
408 * the value of field 'graphType'.
410 public void setGraphType(final int graphType)
412 this._graphType = graphType;
413 this._has_graphType = true;
417 * Sets the value of field 'label'.
420 * the value of field 'label'.
422 public void setLabel(final java.lang.String label)
431 * @throws org.exolab.castor.xml.MarshalException
432 * if object is null or if any SAXException is thrown during
434 * @throws org.exolab.castor.xml.ValidationException
435 * if this object is an invalid instance according to the schema
436 * @return the unmarshaled jalview.binding.Annotation
438 public static jalview.binding.Annotation unmarshal(
439 final java.io.Reader reader)
440 throws org.exolab.castor.xml.MarshalException,
441 org.exolab.castor.xml.ValidationException
443 return (jalview.binding.Annotation) Unmarshaller.unmarshal(
444 jalview.binding.Annotation.class, reader);
450 * @throws org.exolab.castor.xml.ValidationException
451 * if this object is an invalid instance according to the schema
453 public void validate() throws org.exolab.castor.xml.ValidationException
455 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
456 validator.validate(this);