1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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.
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.
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 *******************************************************************************/
19 * This class was automatically generated with
20 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
25 package jalview.binding;
27 //---------------------------------/
28 //- Imported classes and packages -/
29 //---------------------------------/
31 import org.exolab.castor.xml.Marshaller;
32 import org.exolab.castor.xml.Unmarshaller;
37 * @version $Revision$ $Date$
39 public class Annotation implements java.io.Serializable {
42 //--------------------------/
43 //- Class/Member Variables -/
44 //--------------------------/
49 private boolean _graph;
52 * keeps track of state for field: _graph
54 private boolean _has_graph;
59 private int _graphType;
62 * keeps track of state for field: _graphType
64 private boolean _has_graphType;
67 * Field _annotationElementList.
69 private java.util.Vector _annotationElementList;
74 private java.lang.String _label;
79 private java.lang.String _description;
88 this._annotationElementList = new java.util.Vector();
99 * @param vAnnotationElement
100 * @throws java.lang.IndexOutOfBoundsException if the index
101 * given is outside the bounds of the collection
103 public void addAnnotationElement(
104 final jalview.binding.AnnotationElement vAnnotationElement)
105 throws java.lang.IndexOutOfBoundsException {
106 this._annotationElementList.addElement(vAnnotationElement);
113 * @param vAnnotationElement
114 * @throws java.lang.IndexOutOfBoundsException if the index
115 * given is outside the bounds of the collection
117 public void addAnnotationElement(
119 final jalview.binding.AnnotationElement vAnnotationElement)
120 throws java.lang.IndexOutOfBoundsException {
121 this._annotationElementList.add(index, vAnnotationElement);
126 public void deleteGraph(
128 this._has_graph= false;
133 public void deleteGraphType(
135 this._has_graphType= false;
139 * Method enumerateAnnotationElement.
141 * @return an Enumeration over all
142 * jalview.binding.AnnotationElement elements
144 public java.util.Enumeration enumerateAnnotationElement(
146 return this._annotationElementList.elements();
150 * Method getAnnotationElement.
153 * @throws java.lang.IndexOutOfBoundsException if the index
154 * given is outside the bounds of the collection
155 * @return the value of the jalview.binding.AnnotationElement
158 public jalview.binding.AnnotationElement getAnnotationElement(
160 throws java.lang.IndexOutOfBoundsException {
161 // check bounds for index
162 if (index < 0 || index >= this._annotationElementList.size()) {
163 throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
166 return (jalview.binding.AnnotationElement) _annotationElementList.get(index);
170 * Method getAnnotationElement.Returns the contents of the
171 * collection in an Array. <p>Note: Just in case the
172 * collection contents are changing in another thread, we pass
173 * a 0-length Array of the correct type into the API call.
174 * This way we <i>know</i> that the Array returned is of
175 * exactly the correct length.
177 * @return this collection as an Array
179 public jalview.binding.AnnotationElement[] getAnnotationElement(
181 jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0];
182 return (jalview.binding.AnnotationElement[]) this._annotationElementList.toArray(array);
186 * Method getAnnotationElementCount.
188 * @return the size of this collection
190 public int getAnnotationElementCount(
192 return this._annotationElementList.size();
196 * Returns the value of field 'description'.
198 * @return the value of field 'Description'.
200 public java.lang.String getDescription(
202 return this._description;
206 * Returns the value of field 'graph'.
208 * @return the value of field 'Graph'.
210 public boolean getGraph(
216 * Returns the value of field 'graphType'.
218 * @return the value of field 'GraphType'.
220 public int getGraphType(
222 return this._graphType;
226 * Returns the value of field 'label'.
228 * @return the value of field 'Label'.
230 public java.lang.String getLabel(
238 * @return true if at least one Graph has been added
240 public boolean hasGraph(
242 return this._has_graph;
246 * Method hasGraphType.
248 * @return true if at least one GraphType has been added
250 public boolean hasGraphType(
252 return this._has_graphType;
256 * Returns the value of field 'graph'.
258 * @return the value of field 'Graph'.
260 public boolean isGraph(
268 * @return true if this object is valid according to the schema
270 public boolean isValid(
274 } catch (org.exolab.castor.xml.ValidationException vex) {
284 * @throws org.exolab.castor.xml.MarshalException if object is
285 * null or if any SAXException is thrown during marshaling
286 * @throws org.exolab.castor.xml.ValidationException if this
287 * object is an invalid instance according to the schema
290 final java.io.Writer out)
291 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
292 Marshaller.marshal(this, out);
299 * @throws java.io.IOException if an IOException occurs during
301 * @throws org.exolab.castor.xml.ValidationException if this
302 * object is an invalid instance according to the schema
303 * @throws org.exolab.castor.xml.MarshalException if object is
304 * null or if any SAXException is thrown during marshaling
307 final org.xml.sax.ContentHandler handler)
308 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
309 Marshaller.marshal(this, handler);
314 public void removeAllAnnotationElement(
316 this._annotationElementList.clear();
320 * Method removeAnnotationElement.
322 * @param vAnnotationElement
323 * @return true if the object was removed from the collection.
325 public boolean removeAnnotationElement(
326 final jalview.binding.AnnotationElement vAnnotationElement) {
327 boolean removed = _annotationElementList.remove(vAnnotationElement);
332 * Method removeAnnotationElementAt.
335 * @return the element removed from the collection
337 public jalview.binding.AnnotationElement removeAnnotationElementAt(
339 java.lang.Object obj = this._annotationElementList.remove(index);
340 return (jalview.binding.AnnotationElement) obj;
347 * @param vAnnotationElement
348 * @throws java.lang.IndexOutOfBoundsException if the index
349 * given is outside the bounds of the collection
351 public void setAnnotationElement(
353 final jalview.binding.AnnotationElement vAnnotationElement)
354 throws java.lang.IndexOutOfBoundsException {
355 // check bounds for index
356 if (index < 0 || index >= this._annotationElementList.size()) {
357 throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
360 this._annotationElementList.set(index, vAnnotationElement);
366 * @param vAnnotationElementArray
368 public void setAnnotationElement(
369 final jalview.binding.AnnotationElement[] vAnnotationElementArray) {
371 _annotationElementList.clear();
373 for (int i = 0; i < vAnnotationElementArray.length; i++) {
374 this._annotationElementList.add(vAnnotationElementArray[i]);
379 * Sets the value of field 'description'.
381 * @param description the value of field 'description'.
383 public void setDescription(
384 final java.lang.String description) {
385 this._description = description;
389 * Sets the value of field 'graph'.
391 * @param graph the value of field 'graph'.
393 public void setGraph(
394 final boolean graph) {
396 this._has_graph = true;
400 * Sets the value of field 'graphType'.
402 * @param graphType the value of field 'graphType'.
404 public void setGraphType(
405 final int graphType) {
406 this._graphType = graphType;
407 this._has_graphType = true;
411 * Sets the value of field 'label'.
413 * @param label the value of field 'label'.
415 public void setLabel(
416 final java.lang.String label) {
424 * @throws org.exolab.castor.xml.MarshalException if object is
425 * null or if any SAXException is thrown during marshaling
426 * @throws org.exolab.castor.xml.ValidationException if this
427 * object is an invalid instance according to the schema
428 * @return the unmarshaled jalview.binding.Annotation
430 public static jalview.binding.Annotation unmarshal(
431 final java.io.Reader reader)
432 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
433 return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);
439 * @throws org.exolab.castor.xml.ValidationException if this
440 * object is an invalid instance according to the schema
442 public void validate(
444 throws org.exolab.castor.xml.ValidationException {
445 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
446 validator.validate(this);