2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
\r
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.schemabinding.version2;
\r
21 //---------------------------------/
\r
22 //- Imported classes and packages -/
\r
23 //---------------------------------/
\r
25 import org.exolab.castor.xml.Marshaller;
\r
26 import org.exolab.castor.xml.Unmarshaller;
\r
31 * @version $Revision$ $Date$
\r
33 public class Annotation implements java.io.Serializable {
\r
36 //--------------------------/
\r
37 //- Class/Member Variables -/
\r
38 //--------------------------/
\r
43 private boolean _graph;
\r
46 * keeps track of state for field: _graph
\r
48 private boolean _has_graph;
\r
53 private int _graphType;
\r
56 * keeps track of state for field: _graphType
\r
58 private boolean _has_graphType;
\r
61 * Field _sequenceRef.
\r
63 private java.lang.String _sequenceRef;
\r
66 * Field _graphColour.
\r
68 private int _graphColour;
\r
71 * keeps track of state for field: _graphColour
\r
73 private boolean _has_graphColour;
\r
76 * Field _graphGroup.
\r
78 private int _graphGroup;
\r
81 * keeps track of state for field: _graphGroup
\r
83 private boolean _has_graphGroup;
\r
88 private java.lang.String _id;
\r
93 private boolean _scoreOnly = false;
\r
96 * keeps track of state for field: _scoreOnly
\r
98 private boolean _has_scoreOnly;
\r
103 private double _score;
\r
106 * keeps track of state for field: _score
\r
108 private boolean _has_score;
\r
113 private boolean _visible;
\r
116 * keeps track of state for field: _visible
\r
118 private boolean _has_visible;
\r
121 * Field _annotationElementList.
\r
123 private java.util.Vector _annotationElementList;
\r
128 private java.lang.String _label;
\r
131 * Field _description.
\r
133 private java.lang.String _description;
\r
136 * Field _thresholdLine.
\r
138 private jalview.schemabinding.version2.ThresholdLine _thresholdLine;
\r
141 //----------------/
\r
142 //- Constructors -/
\r
143 //----------------/
\r
145 public Annotation() {
\r
147 this._annotationElementList = new java.util.Vector();
\r
158 * @param vAnnotationElement
\r
159 * @throws java.lang.IndexOutOfBoundsException if the index
\r
160 * given is outside the bounds of the collection
\r
162 public void addAnnotationElement(
\r
163 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
164 throws java.lang.IndexOutOfBoundsException {
\r
165 this._annotationElementList.addElement(vAnnotationElement);
\r
172 * @param vAnnotationElement
\r
173 * @throws java.lang.IndexOutOfBoundsException if the index
\r
174 * given is outside the bounds of the collection
\r
176 public void addAnnotationElement(
\r
178 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
179 throws java.lang.IndexOutOfBoundsException {
\r
180 this._annotationElementList.add(index, vAnnotationElement);
\r
185 public void deleteGraph(
\r
187 this._has_graph= false;
\r
192 public void deleteGraphColour(
\r
194 this._has_graphColour= false;
\r
199 public void deleteGraphGroup(
\r
201 this._has_graphGroup= false;
\r
206 public void deleteGraphType(
\r
208 this._has_graphType= false;
\r
213 public void deleteScore(
\r
215 this._has_score= false;
\r
220 public void deleteScoreOnly(
\r
222 this._has_scoreOnly= false;
\r
227 public void deleteVisible(
\r
229 this._has_visible= false;
\r
233 * Method enumerateAnnotationElement.
\r
235 * @return an Enumeration over all
\r
236 * jalview.schemabinding.version2.AnnotationElement elements
\r
238 public java.util.Enumeration enumerateAnnotationElement(
\r
240 return this._annotationElementList.elements();
\r
244 * Method getAnnotationElement.
\r
247 * @throws java.lang.IndexOutOfBoundsException if the index
\r
248 * given is outside the bounds of the collection
\r
249 * @return the value of the
\r
250 * jalview.schemabinding.version2.AnnotationElement at the
\r
253 public jalview.schemabinding.version2.AnnotationElement getAnnotationElement(
\r
255 throws java.lang.IndexOutOfBoundsException {
\r
256 // check bounds for index
\r
257 if (index < 0 || index >= this._annotationElementList.size()) {
\r
258 throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
\r
261 return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList.get(index);
\r
265 * Method getAnnotationElement.Returns the contents of the
\r
266 * collection in an Array. <p>Note: Just in case the
\r
267 * collection contents are changing in another thread, we pass
\r
268 * a 0-length Array of the correct type into the API call.
\r
269 * This way we <i>know</i> that the Array returned is of
\r
270 * exactly the correct length.
\r
272 * @return this collection as an Array
\r
274 public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement(
\r
276 jalview.schemabinding.version2.AnnotationElement[] array = new jalview.schemabinding.version2.AnnotationElement[0];
\r
277 return (jalview.schemabinding.version2.AnnotationElement[]) this._annotationElementList.toArray(array);
\r
281 * Method getAnnotationElementCount.
\r
283 * @return the size of this collection
\r
285 public int getAnnotationElementCount(
\r
287 return this._annotationElementList.size();
\r
291 * Returns the value of field 'description'.
\r
293 * @return the value of field 'Description'.
\r
295 public java.lang.String getDescription(
\r
297 return this._description;
\r
301 * Returns the value of field 'graph'.
\r
303 * @return the value of field 'Graph'.
\r
305 public boolean getGraph(
\r
307 return this._graph;
\r
311 * Returns the value of field 'graphColour'.
\r
313 * @return the value of field 'GraphColour'.
\r
315 public int getGraphColour(
\r
317 return this._graphColour;
\r
321 * Returns the value of field 'graphGroup'.
\r
323 * @return the value of field 'GraphGroup'.
\r
325 public int getGraphGroup(
\r
327 return this._graphGroup;
\r
331 * Returns the value of field 'graphType'.
\r
333 * @return the value of field 'GraphType'.
\r
335 public int getGraphType(
\r
337 return this._graphType;
\r
341 * Returns the value of field 'id'.
\r
343 * @return the value of field 'Id'.
\r
345 public java.lang.String getId(
\r
351 * Returns the value of field 'label'.
\r
353 * @return the value of field 'Label'.
\r
355 public java.lang.String getLabel(
\r
357 return this._label;
\r
361 * Returns the value of field 'score'.
\r
363 * @return the value of field 'Score'.
\r
365 public double getScore(
\r
367 return this._score;
\r
371 * Returns the value of field 'scoreOnly'.
\r
373 * @return the value of field 'ScoreOnly'.
\r
375 public boolean getScoreOnly(
\r
377 return this._scoreOnly;
\r
381 * Returns the value of field 'sequenceRef'.
\r
383 * @return the value of field 'SequenceRef'.
\r
385 public java.lang.String getSequenceRef(
\r
387 return this._sequenceRef;
\r
391 * Returns the value of field 'thresholdLine'.
\r
393 * @return the value of field 'ThresholdLine'.
\r
395 public jalview.schemabinding.version2.ThresholdLine getThresholdLine(
\r
397 return this._thresholdLine;
\r
401 * Returns the value of field 'visible'.
\r
403 * @return the value of field 'Visible'.
\r
405 public boolean getVisible(
\r
407 return this._visible;
\r
413 * @return true if at least one Graph has been added
\r
415 public boolean hasGraph(
\r
417 return this._has_graph;
\r
421 * Method hasGraphColour.
\r
423 * @return true if at least one GraphColour has been added
\r
425 public boolean hasGraphColour(
\r
427 return this._has_graphColour;
\r
431 * Method hasGraphGroup.
\r
433 * @return true if at least one GraphGroup has been added
\r
435 public boolean hasGraphGroup(
\r
437 return this._has_graphGroup;
\r
441 * Method hasGraphType.
\r
443 * @return true if at least one GraphType has been added
\r
445 public boolean hasGraphType(
\r
447 return this._has_graphType;
\r
453 * @return true if at least one Score has been added
\r
455 public boolean hasScore(
\r
457 return this._has_score;
\r
461 * Method hasScoreOnly.
\r
463 * @return true if at least one ScoreOnly has been added
\r
465 public boolean hasScoreOnly(
\r
467 return this._has_scoreOnly;
\r
471 * Method hasVisible.
\r
473 * @return true if at least one Visible has been added
\r
475 public boolean hasVisible(
\r
477 return this._has_visible;
\r
481 * Returns the value of field 'graph'.
\r
483 * @return the value of field 'Graph'.
\r
485 public boolean isGraph(
\r
487 return this._graph;
\r
491 * Returns the value of field 'scoreOnly'.
\r
493 * @return the value of field 'ScoreOnly'.
\r
495 public boolean isScoreOnly(
\r
497 return this._scoreOnly;
\r
503 * @return true if this object is valid according to the schema
\r
505 public boolean isValid(
\r
509 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
516 * Returns the value of field 'visible'.
\r
518 * @return the value of field 'Visible'.
\r
520 public boolean isVisible(
\r
522 return this._visible;
\r
529 * @throws org.exolab.castor.xml.MarshalException if object is
\r
530 * null or if any SAXException is thrown during marshaling
\r
531 * @throws org.exolab.castor.xml.ValidationException if this
\r
532 * object is an invalid instance according to the schema
\r
534 public void marshal(
\r
535 final java.io.Writer out)
\r
536 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
537 Marshaller.marshal(this, out);
\r
544 * @throws java.io.IOException if an IOException occurs during
\r
546 * @throws org.exolab.castor.xml.ValidationException if this
\r
547 * object is an invalid instance according to the schema
\r
548 * @throws org.exolab.castor.xml.MarshalException if object is
\r
549 * null or if any SAXException is thrown during marshaling
\r
551 public void marshal(
\r
552 final org.xml.sax.ContentHandler handler)
\r
553 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
554 Marshaller.marshal(this, handler);
\r
559 public void removeAllAnnotationElement(
\r
561 this._annotationElementList.clear();
\r
565 * Method removeAnnotationElement.
\r
567 * @param vAnnotationElement
\r
568 * @return true if the object was removed from the collection.
\r
570 public boolean removeAnnotationElement(
\r
571 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) {
\r
572 boolean removed = _annotationElementList.remove(vAnnotationElement);
\r
577 * Method removeAnnotationElementAt.
\r
580 * @return the element removed from the collection
\r
582 public jalview.schemabinding.version2.AnnotationElement removeAnnotationElementAt(
\r
584 java.lang.Object obj = this._annotationElementList.remove(index);
\r
585 return (jalview.schemabinding.version2.AnnotationElement) obj;
\r
592 * @param vAnnotationElement
\r
593 * @throws java.lang.IndexOutOfBoundsException if the index
\r
594 * given is outside the bounds of the collection
\r
596 public void setAnnotationElement(
\r
598 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
599 throws java.lang.IndexOutOfBoundsException {
\r
600 // check bounds for index
\r
601 if (index < 0 || index >= this._annotationElementList.size()) {
\r
602 throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
\r
605 this._annotationElementList.set(index, vAnnotationElement);
\r
611 * @param vAnnotationElementArray
\r
613 public void setAnnotationElement(
\r
614 final jalview.schemabinding.version2.AnnotationElement[] vAnnotationElementArray) {
\r
616 _annotationElementList.clear();
\r
618 for (int i = 0; i < vAnnotationElementArray.length; i++) {
\r
619 this._annotationElementList.add(vAnnotationElementArray[i]);
\r
624 * Sets the value of field 'description'.
\r
626 * @param description the value of field 'description'.
\r
628 public void setDescription(
\r
629 final java.lang.String description) {
\r
630 this._description = description;
\r
634 * Sets the value of field 'graph'.
\r
636 * @param graph the value of field 'graph'.
\r
638 public void setGraph(
\r
639 final boolean graph) {
\r
640 this._graph = graph;
\r
641 this._has_graph = true;
\r
645 * Sets the value of field 'graphColour'.
\r
647 * @param graphColour the value of field 'graphColour'.
\r
649 public void setGraphColour(
\r
650 final int graphColour) {
\r
651 this._graphColour = graphColour;
\r
652 this._has_graphColour = true;
\r
656 * Sets the value of field 'graphGroup'.
\r
658 * @param graphGroup the value of field 'graphGroup'.
\r
660 public void setGraphGroup(
\r
661 final int graphGroup) {
\r
662 this._graphGroup = graphGroup;
\r
663 this._has_graphGroup = true;
\r
667 * Sets the value of field 'graphType'.
\r
669 * @param graphType the value of field 'graphType'.
\r
671 public void setGraphType(
\r
672 final int graphType) {
\r
673 this._graphType = graphType;
\r
674 this._has_graphType = true;
\r
678 * Sets the value of field 'id'.
\r
680 * @param id the value of field 'id'.
\r
683 final java.lang.String id) {
\r
688 * Sets the value of field 'label'.
\r
690 * @param label the value of field 'label'.
\r
692 public void setLabel(
\r
693 final java.lang.String label) {
\r
694 this._label = label;
\r
698 * Sets the value of field 'score'.
\r
700 * @param score the value of field 'score'.
\r
702 public void setScore(
\r
703 final double score) {
\r
704 this._score = score;
\r
705 this._has_score = true;
\r
709 * Sets the value of field 'scoreOnly'.
\r
711 * @param scoreOnly the value of field 'scoreOnly'.
\r
713 public void setScoreOnly(
\r
714 final boolean scoreOnly) {
\r
715 this._scoreOnly = scoreOnly;
\r
716 this._has_scoreOnly = true;
\r
720 * Sets the value of field 'sequenceRef'.
\r
722 * @param sequenceRef the value of field 'sequenceRef'.
\r
724 public void setSequenceRef(
\r
725 final java.lang.String sequenceRef) {
\r
726 this._sequenceRef = sequenceRef;
\r
730 * Sets the value of field 'thresholdLine'.
\r
732 * @param thresholdLine the value of field 'thresholdLine'.
\r
734 public void setThresholdLine(
\r
735 final jalview.schemabinding.version2.ThresholdLine thresholdLine) {
\r
736 this._thresholdLine = thresholdLine;
\r
740 * Sets the value of field 'visible'.
\r
742 * @param visible the value of field 'visible'.
\r
744 public void setVisible(
\r
745 final boolean visible) {
\r
746 this._visible = visible;
\r
747 this._has_visible = true;
\r
751 * Method unmarshal.
\r
754 * @throws org.exolab.castor.xml.MarshalException if object is
\r
755 * null or if any SAXException is thrown during marshaling
\r
756 * @throws org.exolab.castor.xml.ValidationException if this
\r
757 * object is an invalid instance according to the schema
\r
758 * @return the unmarshaled
\r
759 * jalview.schemabinding.version2.Annotation
\r
761 public static jalview.schemabinding.version2.Annotation unmarshal(
\r
762 final java.io.Reader reader)
\r
763 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
764 return (jalview.schemabinding.version2.Annotation) Unmarshaller.unmarshal(jalview.schemabinding.version2.Annotation.class, reader);
\r
770 * @throws org.exolab.castor.xml.ValidationException if this
\r
771 * object is an invalid instance according to the schema
\r
773 public void validate(
\r
775 throws org.exolab.castor.xml.ValidationException {
\r
776 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
777 validator.validate(this);
\r