1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $(date) The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
20 *******************************************************************************/
22 * This class was automatically generated with
23 * <a href="http://www.castor.org">Castor 1.1</a>, using an XML
28 package jalview.binding;
30 //---------------------------------/
31 //- Imported classes and packages -/
32 //---------------------------------/
34 import org.exolab.castor.xml.Marshaller;
35 import org.exolab.castor.xml.Unmarshaller;
40 * @version $Revision$ $Date$
42 public class Annotation implements java.io.Serializable
45 // --------------------------/
46 // - Class/Member Variables -/
47 // --------------------------/
52 private boolean _graph;
55 * keeps track of state for field: _graph
57 private boolean _has_graph;
62 private int _graphType;
65 * keeps track of state for field: _graphType
67 private boolean _has_graphType;
70 * Field _annotationElementList.
72 private java.util.Vector _annotationElementList;
77 private java.lang.String _label;
82 private java.lang.String _description;
91 this._annotationElementList = new java.util.Vector();
101 * @param vAnnotationElement
102 * @throws java.lang.IndexOutOfBoundsException
103 * if the index given is outside the bounds of the collection
105 public void addAnnotationElement(
106 final jalview.binding.AnnotationElement vAnnotationElement)
107 throws java.lang.IndexOutOfBoundsException
109 this._annotationElementList.addElement(vAnnotationElement);
116 * @param vAnnotationElement
117 * @throws java.lang.IndexOutOfBoundsException
118 * if the index given is outside the bounds of the collection
120 public void addAnnotationElement(final int index,
121 final jalview.binding.AnnotationElement vAnnotationElement)
122 throws java.lang.IndexOutOfBoundsException
124 this._annotationElementList.add(index, vAnnotationElement);
129 public void deleteGraph()
131 this._has_graph = false;
136 public void deleteGraphType()
138 this._has_graphType = false;
142 * Method enumerateAnnotationElement.
144 * @return an Enumeration over all jalview.binding.AnnotationElement elements
146 public java.util.Enumeration enumerateAnnotationElement()
148 return this._annotationElementList.elements();
152 * Method getAnnotationElement.
155 * @throws java.lang.IndexOutOfBoundsException
156 * if the index given is outside the bounds of the collection
157 * @return the value of the jalview.binding.AnnotationElement at the given
160 public jalview.binding.AnnotationElement getAnnotationElement(
161 final int index) throws java.lang.IndexOutOfBoundsException
163 // check bounds for index
164 if (index < 0 || index >= this._annotationElementList.size())
166 throw new IndexOutOfBoundsException(
167 "getAnnotationElement: Index value '" + index
168 + "' not in range [0.."
169 + (this._annotationElementList.size() - 1) + "]");
172 return (jalview.binding.AnnotationElement) _annotationElementList
177 * Method getAnnotationElement.Returns the contents of the collection in an
180 * Note: Just in case the collection contents are changing in another thread,
181 * we pass a 0-length Array of the correct type into the API call. This way we
182 * <i>know</i> that the Array returned is of exactly the correct length.
184 * @return this collection as an Array
186 public jalview.binding.AnnotationElement[] getAnnotationElement()
188 jalview.binding.AnnotationElement[] array = new jalview.binding.AnnotationElement[0];
189 return (jalview.binding.AnnotationElement[]) this._annotationElementList
194 * Method getAnnotationElementCount.
196 * @return the size of this collection
198 public int getAnnotationElementCount()
200 return this._annotationElementList.size();
204 * Returns the value of field 'description'.
206 * @return the value of field 'Description'.
208 public java.lang.String getDescription()
210 return this._description;
214 * Returns the value of field 'graph'.
216 * @return the value of field 'Graph'.
218 public boolean getGraph()
224 * Returns the value of field 'graphType'.
226 * @return the value of field 'GraphType'.
228 public int getGraphType()
230 return this._graphType;
234 * Returns the value of field 'label'.
236 * @return the value of field 'Label'.
238 public java.lang.String getLabel()
246 * @return true if at least one Graph has been added
248 public boolean hasGraph()
250 return this._has_graph;
254 * Method hasGraphType.
256 * @return true if at least one GraphType has been added
258 public boolean hasGraphType()
260 return this._has_graphType;
264 * Returns the value of field 'graph'.
266 * @return the value of field 'Graph'.
268 public boolean isGraph()
276 * @return true if this object is valid according to the schema
278 public boolean isValid()
283 } catch (org.exolab.castor.xml.ValidationException vex)
294 * @throws org.exolab.castor.xml.MarshalException
295 * if object is null or if any SAXException is thrown during
297 * @throws org.exolab.castor.xml.ValidationException
298 * if this object is an invalid instance according to the schema
300 public void marshal(final java.io.Writer out)
301 throws org.exolab.castor.xml.MarshalException,
302 org.exolab.castor.xml.ValidationException
304 Marshaller.marshal(this, out);
311 * @throws java.io.IOException
312 * if an IOException occurs during marshaling
313 * @throws org.exolab.castor.xml.ValidationException
314 * if this object is an invalid instance according to the schema
315 * @throws org.exolab.castor.xml.MarshalException
316 * if object is null or if any SAXException is thrown during
319 public void marshal(final org.xml.sax.ContentHandler handler)
320 throws java.io.IOException,
321 org.exolab.castor.xml.MarshalException,
322 org.exolab.castor.xml.ValidationException
324 Marshaller.marshal(this, handler);
329 public void removeAllAnnotationElement()
331 this._annotationElementList.clear();
335 * Method removeAnnotationElement.
337 * @param vAnnotationElement
338 * @return true if the object was removed from the collection.
340 public boolean removeAnnotationElement(
341 final jalview.binding.AnnotationElement vAnnotationElement)
343 boolean removed = _annotationElementList.remove(vAnnotationElement);
348 * Method removeAnnotationElementAt.
351 * @return the element removed from the collection
353 public jalview.binding.AnnotationElement removeAnnotationElementAt(
356 java.lang.Object obj = this._annotationElementList.remove(index);
357 return (jalview.binding.AnnotationElement) obj;
364 * @param vAnnotationElement
365 * @throws java.lang.IndexOutOfBoundsException
366 * if the index given is outside the bounds of the collection
368 public void setAnnotationElement(final int index,
369 final jalview.binding.AnnotationElement vAnnotationElement)
370 throws java.lang.IndexOutOfBoundsException
372 // check bounds for index
373 if (index < 0 || index >= this._annotationElementList.size())
375 throw new IndexOutOfBoundsException(
376 "setAnnotationElement: Index value '" + index
377 + "' not in range [0.."
378 + (this._annotationElementList.size() - 1) + "]");
381 this._annotationElementList.set(index, vAnnotationElement);
387 * @param vAnnotationElementArray
389 public void setAnnotationElement(
390 final jalview.binding.AnnotationElement[] vAnnotationElementArray)
393 _annotationElementList.clear();
395 for (int i = 0; i < vAnnotationElementArray.length; i++)
397 this._annotationElementList.add(vAnnotationElementArray[i]);
402 * Sets the value of field 'description'.
405 * the value of field 'description'.
407 public void setDescription(final java.lang.String description)
409 this._description = description;
413 * Sets the value of field 'graph'.
416 * the value of field 'graph'.
418 public void setGraph(final boolean graph)
421 this._has_graph = true;
425 * Sets the value of field 'graphType'.
428 * the value of field 'graphType'.
430 public void setGraphType(final int graphType)
432 this._graphType = graphType;
433 this._has_graphType = true;
437 * Sets the value of field 'label'.
440 * the value of field 'label'.
442 public void setLabel(final java.lang.String label)
451 * @throws org.exolab.castor.xml.MarshalException
452 * if object is null or if any SAXException is thrown during
454 * @throws org.exolab.castor.xml.ValidationException
455 * if this object is an invalid instance according to the schema
456 * @return the unmarshaled jalview.binding.Annotation
458 public static jalview.binding.Annotation unmarshal(
459 final java.io.Reader reader)
460 throws org.exolab.castor.xml.MarshalException,
461 org.exolab.castor.xml.ValidationException
463 return (jalview.binding.Annotation) Unmarshaller
464 .unmarshal(jalview.binding.Annotation.class, reader);
470 * @throws org.exolab.castor.xml.ValidationException
471 * if this object is an invalid instance according to the schema
473 public void validate() throws org.exolab.castor.xml.ValidationException
475 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
476 validator.validate(this);