2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML
\r
8 * Jalview - A Sequence Alignment Editor and Viewer
\r
9 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
11 * This program is free software; you can redistribute it and/or
\r
12 * modify it under the terms of the GNU General Public License
\r
13 * as published by the Free Software Foundation; either version 2
\r
14 * of the License, or (at your option) any later version.
\r
16 * This program is distributed in the hope that it will be useful,
\r
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
19 * GNU General Public License for more details.
\r
21 * You should have received a copy of the GNU General Public License
\r
22 * along with this program; if not, write to the Free Software
\r
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
25 package jalview.binding;
\r
27 import org.exolab.castor.xml.MarshalException;
\r
28 import org.exolab.castor.xml.Marshaller;
\r
29 import org.exolab.castor.xml.Unmarshaller;
\r
30 import org.exolab.castor.xml.ValidationException;
\r
32 import org.xml.sax.ContentHandler;
\r
34 //---------------------------------/
\r
35 //- Imported classes and packages -/
\r
36 //---------------------------------/
\r
37 import java.io.IOException;
\r
38 import java.io.Reader;
\r
39 import java.io.Serializable;
\r
40 import java.io.Writer;
\r
42 import java.util.Enumeration;
\r
43 import java.util.Vector;
\r
49 * @version $Revision$ $Date$
\r
51 public class Annotation implements java.io.Serializable {
\r
52 //--------------------------/
\r
53 //- Class/Member Variables -/
\r
54 //--------------------------/
\r
59 private boolean _graph;
\r
62 * keeps track of state for field: _graph
\r
64 private boolean _has_graph;
\r
67 * Field _annotationElementList
\r
69 private java.util.Vector _annotationElementList;
\r
74 private java.lang.String _label;
\r
77 * Field _description
\r
79 private java.lang.String _description;
\r
84 public Annotation() {
\r
86 _annotationElementList = new Vector();
\r
88 //-- jalview.binding.Annotation()
\r
91 public void addAnnotationElement(
\r
92 jalview.binding.AnnotationElement vAnnotationElement)
\r
93 throws java.lang.IndexOutOfBoundsException {
\r
94 _annotationElementList.addElement(vAnnotationElement);
\r
96 //-- void addAnnotationElement(jalview.binding.AnnotationElement)
\r
99 * Method addAnnotationElement
\r
104 * @param vAnnotationElement
\r
106 public void addAnnotationElement(int index,
\r
107 jalview.binding.AnnotationElement vAnnotationElement)
\r
108 throws java.lang.IndexOutOfBoundsException {
\r
109 _annotationElementList.insertElementAt(vAnnotationElement, index);
\r
111 //-- void addAnnotationElement(int, jalview.binding.AnnotationElement)
\r
114 * Method deleteGraph
\r
117 public void deleteGraph() {
\r
118 this._has_graph = false;
\r
120 //-- void deleteGraph()
\r
123 * Method enumerateAnnotationElement
\r
127 * @return Enumeration
\r
129 public java.util.Enumeration enumerateAnnotationElement() {
\r
130 return _annotationElementList.elements();
\r
132 //-- java.util.Enumeration enumerateAnnotationElement()
\r
135 * Method getAnnotationElement
\r
140 * @return AnnotationElement
\r
142 public jalview.binding.AnnotationElement getAnnotationElement(int index)
\r
143 throws java.lang.IndexOutOfBoundsException {
\r
144 //-- check bounds for index
\r
145 if ((index < 0) || (index > _annotationElementList.size())) {
\r
146 throw new IndexOutOfBoundsException();
\r
149 return (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);
\r
151 //-- jalview.binding.AnnotationElement getAnnotationElement(int)
\r
154 * Method getAnnotationElement
\r
158 * @return AnnotationElement
\r
160 public jalview.binding.AnnotationElement[] getAnnotationElement() {
\r
161 int size = _annotationElementList.size();
\r
162 jalview.binding.AnnotationElement[] mArray = new jalview.binding.AnnotationElement[size];
\r
164 for (int index = 0; index < size; index++) {
\r
165 mArray[index] = (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);
\r
170 //-- jalview.binding.AnnotationElement[] getAnnotationElement()
\r
173 * Method getAnnotationElementCount
\r
179 public int getAnnotationElementCount() {
\r
180 return _annotationElementList.size();
\r
182 //-- int getAnnotationElementCount()
\r
185 * Returns the value of field 'description'.
\r
188 * @return the value of field 'description'.
\r
190 public java.lang.String getDescription() {
\r
191 return this._description;
\r
193 //-- java.lang.String getDescription()
\r
196 * Returns the value of field 'graph'.
\r
199 * @return the value of field 'graph'.
\r
201 public boolean getGraph() {
\r
202 return this._graph;
\r
204 //-- boolean getGraph()
\r
207 * Returns the value of field 'label'.
\r
210 * @return the value of field 'label'.
\r
212 public java.lang.String getLabel() {
\r
213 return this._label;
\r
215 //-- java.lang.String getLabel()
\r
224 public boolean hasGraph() {
\r
225 return this._has_graph;
\r
227 //-- boolean hasGraph()
\r
236 public boolean isValid() {
\r
239 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
245 //-- boolean isValid()
\r
254 public void marshal(java.io.Writer out)
\r
255 throws org.exolab.castor.xml.MarshalException,
\r
256 org.exolab.castor.xml.ValidationException {
\r
257 Marshaller.marshal(this, out);
\r
259 //-- void marshal(java.io.Writer)
\r
268 public void marshal(org.xml.sax.ContentHandler handler)
\r
269 throws java.io.IOException, org.exolab.castor.xml.MarshalException,
\r
270 org.exolab.castor.xml.ValidationException {
\r
271 Marshaller.marshal(this, handler);
\r
273 //-- void marshal(org.xml.sax.ContentHandler)
\r
276 * Method removeAllAnnotationElement
\r
279 public void removeAllAnnotationElement() {
\r
280 _annotationElementList.removeAllElements();
\r
282 //-- void removeAllAnnotationElement()
\r
285 * Method removeAnnotationElement
\r
290 * @return AnnotationElement
\r
292 public jalview.binding.AnnotationElement removeAnnotationElement(int index) {
\r
293 java.lang.Object obj = _annotationElementList.elementAt(index);
\r
294 _annotationElementList.removeElementAt(index);
\r
296 return (jalview.binding.AnnotationElement) obj;
\r
298 //-- jalview.binding.AnnotationElement removeAnnotationElement(int)
\r
301 * Method setAnnotationElement
\r
306 * @param vAnnotationElement
\r
308 public void setAnnotationElement(int index,
\r
309 jalview.binding.AnnotationElement vAnnotationElement)
\r
310 throws java.lang.IndexOutOfBoundsException {
\r
311 //-- check bounds for index
\r
312 if ((index < 0) || (index > _annotationElementList.size())) {
\r
313 throw new IndexOutOfBoundsException();
\r
316 _annotationElementList.setElementAt(vAnnotationElement, index);
\r
318 //-- void setAnnotationElement(int, jalview.binding.AnnotationElement)
\r
321 * Method setAnnotationElement
\r
325 * @param annotationElementArray
\r
327 public void setAnnotationElement(
\r
328 jalview.binding.AnnotationElement[] annotationElementArray) {
\r
330 _annotationElementList.removeAllElements();
\r
332 for (int i = 0; i < annotationElementArray.length; i++) {
\r
333 _annotationElementList.addElement(annotationElementArray[i]);
\r
336 //-- void setAnnotationElement(jalview.binding.AnnotationElement)
\r
339 * Sets the value of field 'description'.
\r
341 * @param description the value of field 'description'.
\r
343 public void setDescription(java.lang.String description) {
\r
344 this._description = description;
\r
346 //-- void setDescription(java.lang.String)
\r
349 * Sets the value of field 'graph'.
\r
351 * @param graph the value of field 'graph'.
\r
353 public void setGraph(boolean graph) {
\r
354 this._graph = graph;
\r
355 this._has_graph = true;
\r
357 //-- void setGraph(boolean)
\r
360 * Sets the value of field 'label'.
\r
362 * @param label the value of field 'label'.
\r
364 public void setLabel(java.lang.String label) {
\r
365 this._label = label;
\r
367 //-- void setLabel(java.lang.String)
\r
377 public static java.lang.Object unmarshal(java.io.Reader reader)
\r
378 throws org.exolab.castor.xml.MarshalException,
\r
379 org.exolab.castor.xml.ValidationException {
\r
380 return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class,
\r
383 //-- java.lang.Object unmarshal(java.io.Reader)
\r
389 public void validate() throws org.exolab.castor.xml.ValidationException {
\r
390 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
391 validator.validate(this);
\r
393 //-- void validate()
\r