2 * This class was automatically generated with
\r
3 * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML
\r
9 * Jalview - A Sequence Alignment Editor and Viewer
\r
10 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
12 * This program is free software; you can redistribute it and/or
\r
13 * modify it under the terms of the GNU General Public License
\r
14 * as published by the Free Software Foundation; either version 2
\r
15 * of the License, or (at your option) any later version.
\r
17 * This program is distributed in the hope that it will be useful,
\r
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
20 * GNU General Public License for more details.
\r
22 * You should have received a copy of the GNU General Public License
\r
23 * along with this program; if not, write to the Free Software
\r
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
27 package jalview.binding;
\r
29 //---------------------------------/
\r
30 //- Imported classes and packages -/
\r
31 //---------------------------------/
\r
33 import java.io.IOException;
\r
34 import java.io.Reader;
\r
35 import java.io.Serializable;
\r
36 import java.io.Writer;
\r
37 import java.util.Enumeration;
\r
38 import java.util.Vector;
\r
39 import org.exolab.castor.xml.MarshalException;
\r
40 import org.exolab.castor.xml.Marshaller;
\r
41 import org.exolab.castor.xml.Unmarshaller;
\r
42 import org.exolab.castor.xml.ValidationException;
\r
43 import org.xml.sax.ContentHandler;
\r
48 * @version $Revision$ $Date$
\r
50 public class Annotation implements java.io.Serializable {
\r
53 //--------------------------/
\r
54 //- Class/Member Variables -/
\r
55 //--------------------------/
\r
60 private boolean _graph;
\r
63 * keeps track of state for field: _graph
\r
65 private boolean _has_graph;
\r
68 * Field _annotationElementList
\r
70 private java.util.Vector _annotationElementList;
\r
75 private java.lang.String _label;
\r
78 * Field _description
\r
80 private java.lang.String _description;
\r
87 public Annotation() {
\r
89 _annotationElementList = new Vector();
\r
90 } //-- jalview.binding.Annotation()
\r
98 * Method addAnnotationElement
\r
102 * @param vAnnotationElement
\r
104 public void addAnnotationElement(jalview.binding.AnnotationElement vAnnotationElement)
\r
105 throws java.lang.IndexOutOfBoundsException
\r
107 _annotationElementList.addElement(vAnnotationElement);
\r
108 } //-- void addAnnotationElement(jalview.binding.AnnotationElement)
\r
111 * Method addAnnotationElement
\r
116 * @param vAnnotationElement
\r
118 public void addAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)
\r
119 throws java.lang.IndexOutOfBoundsException
\r
121 _annotationElementList.insertElementAt(vAnnotationElement, index);
\r
122 } //-- void addAnnotationElement(int, jalview.binding.AnnotationElement)
\r
125 * Method deleteGraph
\r
128 public void deleteGraph()
\r
130 this._has_graph= false;
\r
131 } //-- void deleteGraph()
\r
134 * Method enumerateAnnotationElement
\r
138 * @return Enumeration
\r
140 public java.util.Enumeration enumerateAnnotationElement()
\r
142 return _annotationElementList.elements();
\r
143 } //-- java.util.Enumeration enumerateAnnotationElement()
\r
146 * Method getAnnotationElement
\r
151 * @return AnnotationElement
\r
153 public jalview.binding.AnnotationElement getAnnotationElement(int index)
\r
154 throws java.lang.IndexOutOfBoundsException
\r
156 //-- check bounds for index
\r
157 if ((index < 0) || (index > _annotationElementList.size())) {
\r
158 throw new IndexOutOfBoundsException();
\r
161 return (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);
\r
162 } //-- jalview.binding.AnnotationElement getAnnotationElement(int)
\r
165 * Method getAnnotationElement
\r
169 * @return AnnotationElement
\r
171 public jalview.binding.AnnotationElement[] getAnnotationElement()
\r
173 int size = _annotationElementList.size();
\r
174 jalview.binding.AnnotationElement[] mArray = new jalview.binding.AnnotationElement[size];
\r
175 for (int index = 0; index < size; index++) {
\r
176 mArray[index] = (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);
\r
179 } //-- jalview.binding.AnnotationElement[] getAnnotationElement()
\r
182 * Method getAnnotationElementCount
\r
188 public int getAnnotationElementCount()
\r
190 return _annotationElementList.size();
\r
191 } //-- int getAnnotationElementCount()
\r
194 * Returns the value of field 'description'.
\r
197 * @return the value of field 'description'.
\r
199 public java.lang.String getDescription()
\r
201 return this._description;
\r
202 } //-- java.lang.String getDescription()
\r
205 * Returns the value of field 'graph'.
\r
208 * @return the value of field 'graph'.
\r
210 public boolean getGraph()
\r
212 return this._graph;
\r
213 } //-- boolean getGraph()
\r
216 * Returns the value of field 'label'.
\r
219 * @return the value of field 'label'.
\r
221 public java.lang.String getLabel()
\r
223 return this._label;
\r
224 } //-- java.lang.String getLabel()
\r
233 public boolean hasGraph()
\r
235 return this._has_graph;
\r
236 } //-- boolean hasGraph()
\r
245 public boolean isValid()
\r
250 catch (org.exolab.castor.xml.ValidationException vex) {
\r
254 } //-- boolean isValid()
\r
263 public void marshal(java.io.Writer out)
\r
264 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
267 Marshaller.marshal(this, out);
\r
268 } //-- void marshal(java.io.Writer)
\r
277 public void marshal(org.xml.sax.ContentHandler handler)
\r
278 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
281 Marshaller.marshal(this, handler);
\r
282 } //-- void marshal(org.xml.sax.ContentHandler)
\r
285 * Method removeAllAnnotationElement
\r
288 public void removeAllAnnotationElement()
\r
290 _annotationElementList.removeAllElements();
\r
291 } //-- void removeAllAnnotationElement()
\r
294 * Method removeAnnotationElement
\r
299 * @return AnnotationElement
\r
301 public jalview.binding.AnnotationElement removeAnnotationElement(int index)
\r
303 java.lang.Object obj = _annotationElementList.elementAt(index);
\r
304 _annotationElementList.removeElementAt(index);
\r
305 return (jalview.binding.AnnotationElement) obj;
\r
306 } //-- jalview.binding.AnnotationElement removeAnnotationElement(int)
\r
309 * Method setAnnotationElement
\r
314 * @param vAnnotationElement
\r
316 public void setAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)
\r
317 throws java.lang.IndexOutOfBoundsException
\r
319 //-- check bounds for index
\r
320 if ((index < 0) || (index > _annotationElementList.size())) {
\r
321 throw new IndexOutOfBoundsException();
\r
323 _annotationElementList.setElementAt(vAnnotationElement, index);
\r
324 } //-- void setAnnotationElement(int, jalview.binding.AnnotationElement)
\r
327 * Method setAnnotationElement
\r
331 * @param annotationElementArray
\r
333 public void setAnnotationElement(jalview.binding.AnnotationElement[] annotationElementArray)
\r
336 _annotationElementList.removeAllElements();
\r
337 for (int i = 0; i < annotationElementArray.length; i++) {
\r
338 _annotationElementList.addElement(annotationElementArray[i]);
\r
340 } //-- void setAnnotationElement(jalview.binding.AnnotationElement)
\r
343 * Sets the value of field 'description'.
\r
345 * @param description the value of field 'description'.
\r
347 public void setDescription(java.lang.String description)
\r
349 this._description = description;
\r
350 } //-- void setDescription(java.lang.String)
\r
353 * Sets the value of field 'graph'.
\r
355 * @param graph the value of field 'graph'.
\r
357 public void setGraph(boolean graph)
\r
359 this._graph = graph;
\r
360 this._has_graph = true;
\r
361 } //-- void setGraph(boolean)
\r
364 * Sets the value of field 'label'.
\r
366 * @param label the value of field 'label'.
\r
368 public void setLabel(java.lang.String label)
\r
370 this._label = label;
\r
371 } //-- void setLabel(java.lang.String)
\r
381 public static java.lang.Object unmarshal(java.io.Reader reader)
\r
382 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
\r
384 return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);
\r
385 } //-- java.lang.Object unmarshal(java.io.Reader)
\r
391 public void validate()
\r
392 throws org.exolab.castor.xml.ValidationException
\r
394 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
395 validator.validate(this);
\r
396 } //-- void validate()
\r