2 * Jalview - A Sequence Alignment Editor and Viewer (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
68 private java.lang.String _groupRef;
\r
71 * Field _graphColour.
\r
73 private int _graphColour;
\r
76 * keeps track of state for field: _graphColour
\r
78 private boolean _has_graphColour;
\r
81 * Field _graphGroup.
\r
83 private int _graphGroup;
\r
86 * keeps track of state for field: _graphGroup
\r
88 private boolean _has_graphGroup;
\r
93 private java.lang.String _id;
\r
98 private boolean _scoreOnly = false;
\r
101 * keeps track of state for field: _scoreOnly
\r
103 private boolean _has_scoreOnly;
\r
108 private double _score;
\r
111 * keeps track of state for field: _score
\r
113 private boolean _has_score;
\r
118 private boolean _visible;
\r
121 * keeps track of state for field: _visible
\r
123 private boolean _has_visible;
\r
126 * Field _centreColLabels.
\r
128 private boolean _centreColLabels;
\r
131 * keeps track of state for field: _centreColLabels
\r
133 private boolean _has_centreColLabels;
\r
136 * Field _scaleColLabels.
\r
138 private boolean _scaleColLabels;
\r
141 * keeps track of state for field: _scaleColLabels
\r
143 private boolean _has_scaleColLabels;
\r
146 * Field _showAllColLabels.
\r
148 private boolean _showAllColLabels;
\r
151 * keeps track of state for field: _showAllColLabels
\r
153 private boolean _has_showAllColLabels;
\r
156 * is an autocalculated annotation row
\r
158 private boolean _autoCalculated = false;
\r
161 * keeps track of state for field: _autoCalculated
\r
163 private boolean _has_autoCalculated;
\r
166 * Field _annotationElementList.
\r
168 private java.util.Vector _annotationElementList;
\r
173 private java.lang.String _label;
\r
176 * Field _description.
\r
178 private java.lang.String _description;
\r
181 * Field _thresholdLine.
\r
183 private jalview.schemabinding.version2.ThresholdLine _thresholdLine;
\r
186 //----------------/
\r
187 //- Constructors -/
\r
188 //----------------/
\r
190 public Annotation() {
\r
192 this._annotationElementList = new java.util.Vector();
\r
203 * @param vAnnotationElement
\r
204 * @throws java.lang.IndexOutOfBoundsException if the index
\r
205 * given is outside the bounds of the collection
\r
207 public void addAnnotationElement(
\r
208 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
209 throws java.lang.IndexOutOfBoundsException {
\r
210 this._annotationElementList.addElement(vAnnotationElement);
\r
217 * @param vAnnotationElement
\r
218 * @throws java.lang.IndexOutOfBoundsException if the index
\r
219 * given is outside the bounds of the collection
\r
221 public void addAnnotationElement(
\r
223 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
224 throws java.lang.IndexOutOfBoundsException {
\r
225 this._annotationElementList.add(index, vAnnotationElement);
\r
230 public void deleteAutoCalculated(
\r
232 this._has_autoCalculated= false;
\r
237 public void deleteCentreColLabels(
\r
239 this._has_centreColLabels= false;
\r
244 public void deleteGraph(
\r
246 this._has_graph= false;
\r
251 public void deleteGraphColour(
\r
253 this._has_graphColour= false;
\r
258 public void deleteGraphGroup(
\r
260 this._has_graphGroup= false;
\r
265 public void deleteGraphType(
\r
267 this._has_graphType= false;
\r
272 public void deleteScaleColLabels(
\r
274 this._has_scaleColLabels= false;
\r
279 public void deleteScore(
\r
281 this._has_score= false;
\r
286 public void deleteScoreOnly(
\r
288 this._has_scoreOnly= false;
\r
293 public void deleteShowAllColLabels(
\r
295 this._has_showAllColLabels= false;
\r
300 public void deleteVisible(
\r
302 this._has_visible= false;
\r
306 * Method enumerateAnnotationElement.
\r
308 * @return an Enumeration over all
\r
309 * jalview.schemabinding.version2.AnnotationElement elements
\r
311 public java.util.Enumeration enumerateAnnotationElement(
\r
313 return this._annotationElementList.elements();
\r
317 * Method getAnnotationElement.
\r
320 * @throws java.lang.IndexOutOfBoundsException if the index
\r
321 * given is outside the bounds of the collection
\r
322 * @return the value of the
\r
323 * jalview.schemabinding.version2.AnnotationElement at the
\r
326 public jalview.schemabinding.version2.AnnotationElement getAnnotationElement(
\r
328 throws java.lang.IndexOutOfBoundsException {
\r
329 // check bounds for index
\r
330 if (index < 0 || index >= this._annotationElementList.size()) {
\r
331 throw new IndexOutOfBoundsException("getAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
\r
334 return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList.get(index);
\r
338 * Method getAnnotationElement.Returns the contents of the
\r
339 * collection in an Array. <p>Note: Just in case the
\r
340 * collection contents are changing in another thread, we pass
\r
341 * a 0-length Array of the correct type into the API call.
\r
342 * This way we <i>know</i> that the Array returned is of
\r
343 * exactly the correct length.
\r
345 * @return this collection as an Array
\r
347 public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement(
\r
349 jalview.schemabinding.version2.AnnotationElement[] array = new jalview.schemabinding.version2.AnnotationElement[0];
\r
350 return (jalview.schemabinding.version2.AnnotationElement[]) this._annotationElementList.toArray(array);
\r
354 * Method getAnnotationElementCount.
\r
356 * @return the size of this collection
\r
358 public int getAnnotationElementCount(
\r
360 return this._annotationElementList.size();
\r
364 * Returns the value of field 'autoCalculated'. The field
\r
365 * 'autoCalculated' has the following description: is an
\r
366 * autocalculated annotation row
\r
368 * @return the value of field 'AutoCalculated'.
\r
370 public boolean getAutoCalculated(
\r
372 return this._autoCalculated;
\r
376 * Returns the value of field 'centreColLabels'.
\r
378 * @return the value of field 'CentreColLabels'.
\r
380 public boolean getCentreColLabels(
\r
382 return this._centreColLabels;
\r
386 * Returns the value of field 'description'.
\r
388 * @return the value of field 'Description'.
\r
390 public java.lang.String getDescription(
\r
392 return this._description;
\r
396 * Returns the value of field 'graph'.
\r
398 * @return the value of field 'Graph'.
\r
400 public boolean getGraph(
\r
402 return this._graph;
\r
406 * Returns the value of field 'graphColour'.
\r
408 * @return the value of field 'GraphColour'.
\r
410 public int getGraphColour(
\r
412 return this._graphColour;
\r
416 * Returns the value of field 'graphGroup'.
\r
418 * @return the value of field 'GraphGroup'.
\r
420 public int getGraphGroup(
\r
422 return this._graphGroup;
\r
426 * Returns the value of field 'graphType'.
\r
428 * @return the value of field 'GraphType'.
\r
430 public int getGraphType(
\r
432 return this._graphType;
\r
436 * Returns the value of field 'groupRef'.
\r
438 * @return the value of field 'GroupRef'.
\r
440 public java.lang.String getGroupRef(
\r
442 return this._groupRef;
\r
446 * Returns the value of field 'id'.
\r
448 * @return the value of field 'Id'.
\r
450 public java.lang.String getId(
\r
456 * Returns the value of field 'label'.
\r
458 * @return the value of field 'Label'.
\r
460 public java.lang.String getLabel(
\r
462 return this._label;
\r
466 * Returns the value of field 'scaleColLabels'.
\r
468 * @return the value of field 'ScaleColLabels'.
\r
470 public boolean getScaleColLabels(
\r
472 return this._scaleColLabels;
\r
476 * Returns the value of field 'score'.
\r
478 * @return the value of field 'Score'.
\r
480 public double getScore(
\r
482 return this._score;
\r
486 * Returns the value of field 'scoreOnly'.
\r
488 * @return the value of field 'ScoreOnly'.
\r
490 public boolean getScoreOnly(
\r
492 return this._scoreOnly;
\r
496 * Returns the value of field 'sequenceRef'.
\r
498 * @return the value of field 'SequenceRef'.
\r
500 public java.lang.String getSequenceRef(
\r
502 return this._sequenceRef;
\r
506 * Returns the value of field 'showAllColLabels'.
\r
508 * @return the value of field 'ShowAllColLabels'.
\r
510 public boolean getShowAllColLabels(
\r
512 return this._showAllColLabels;
\r
516 * Returns the value of field 'thresholdLine'.
\r
518 * @return the value of field 'ThresholdLine'.
\r
520 public jalview.schemabinding.version2.ThresholdLine getThresholdLine(
\r
522 return this._thresholdLine;
\r
526 * Returns the value of field 'visible'.
\r
528 * @return the value of field 'Visible'.
\r
530 public boolean getVisible(
\r
532 return this._visible;
\r
536 * Method hasAutoCalculated.
\r
538 * @return true if at least one AutoCalculated has been added
\r
540 public boolean hasAutoCalculated(
\r
542 return this._has_autoCalculated;
\r
546 * Method hasCentreColLabels.
\r
548 * @return true if at least one CentreColLabels has been added
\r
550 public boolean hasCentreColLabels(
\r
552 return this._has_centreColLabels;
\r
558 * @return true if at least one Graph has been added
\r
560 public boolean hasGraph(
\r
562 return this._has_graph;
\r
566 * Method hasGraphColour.
\r
568 * @return true if at least one GraphColour has been added
\r
570 public boolean hasGraphColour(
\r
572 return this._has_graphColour;
\r
576 * Method hasGraphGroup.
\r
578 * @return true if at least one GraphGroup has been added
\r
580 public boolean hasGraphGroup(
\r
582 return this._has_graphGroup;
\r
586 * Method hasGraphType.
\r
588 * @return true if at least one GraphType has been added
\r
590 public boolean hasGraphType(
\r
592 return this._has_graphType;
\r
596 * Method hasScaleColLabels.
\r
598 * @return true if at least one ScaleColLabels has been added
\r
600 public boolean hasScaleColLabels(
\r
602 return this._has_scaleColLabels;
\r
608 * @return true if at least one Score has been added
\r
610 public boolean hasScore(
\r
612 return this._has_score;
\r
616 * Method hasScoreOnly.
\r
618 * @return true if at least one ScoreOnly has been added
\r
620 public boolean hasScoreOnly(
\r
622 return this._has_scoreOnly;
\r
626 * Method hasShowAllColLabels.
\r
628 * @return true if at least one ShowAllColLabels has been added
\r
630 public boolean hasShowAllColLabels(
\r
632 return this._has_showAllColLabels;
\r
636 * Method hasVisible.
\r
638 * @return true if at least one Visible has been added
\r
640 public boolean hasVisible(
\r
642 return this._has_visible;
\r
646 * Returns the value of field 'autoCalculated'. The field
\r
647 * 'autoCalculated' has the following description: is an
\r
648 * autocalculated annotation row
\r
650 * @return the value of field 'AutoCalculated'.
\r
652 public boolean isAutoCalculated(
\r
654 return this._autoCalculated;
\r
658 * Returns the value of field 'centreColLabels'.
\r
660 * @return the value of field 'CentreColLabels'.
\r
662 public boolean isCentreColLabels(
\r
664 return this._centreColLabels;
\r
668 * Returns the value of field 'graph'.
\r
670 * @return the value of field 'Graph'.
\r
672 public boolean isGraph(
\r
674 return this._graph;
\r
678 * Returns the value of field 'scaleColLabels'.
\r
680 * @return the value of field 'ScaleColLabels'.
\r
682 public boolean isScaleColLabels(
\r
684 return this._scaleColLabels;
\r
688 * Returns the value of field 'scoreOnly'.
\r
690 * @return the value of field 'ScoreOnly'.
\r
692 public boolean isScoreOnly(
\r
694 return this._scoreOnly;
\r
698 * Returns the value of field 'showAllColLabels'.
\r
700 * @return the value of field 'ShowAllColLabels'.
\r
702 public boolean isShowAllColLabels(
\r
704 return this._showAllColLabels;
\r
710 * @return true if this object is valid according to the schema
\r
712 public boolean isValid(
\r
716 } catch (org.exolab.castor.xml.ValidationException vex) {
\r
723 * Returns the value of field 'visible'.
\r
725 * @return the value of field 'Visible'.
\r
727 public boolean isVisible(
\r
729 return this._visible;
\r
736 * @throws org.exolab.castor.xml.MarshalException if object is
\r
737 * null or if any SAXException is thrown during marshaling
\r
738 * @throws org.exolab.castor.xml.ValidationException if this
\r
739 * object is an invalid instance according to the schema
\r
741 public void marshal(
\r
742 final java.io.Writer out)
\r
743 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
744 Marshaller.marshal(this, out);
\r
751 * @throws java.io.IOException if an IOException occurs during
\r
753 * @throws org.exolab.castor.xml.ValidationException if this
\r
754 * object is an invalid instance according to the schema
\r
755 * @throws org.exolab.castor.xml.MarshalException if object is
\r
756 * null or if any SAXException is thrown during marshaling
\r
758 public void marshal(
\r
759 final org.xml.sax.ContentHandler handler)
\r
760 throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
761 Marshaller.marshal(this, handler);
\r
766 public void removeAllAnnotationElement(
\r
768 this._annotationElementList.clear();
\r
772 * Method removeAnnotationElement.
\r
774 * @param vAnnotationElement
\r
775 * @return true if the object was removed from the collection.
\r
777 public boolean removeAnnotationElement(
\r
778 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement) {
\r
779 boolean removed = _annotationElementList.remove(vAnnotationElement);
\r
784 * Method removeAnnotationElementAt.
\r
787 * @return the element removed from the collection
\r
789 public jalview.schemabinding.version2.AnnotationElement removeAnnotationElementAt(
\r
791 java.lang.Object obj = this._annotationElementList.remove(index);
\r
792 return (jalview.schemabinding.version2.AnnotationElement) obj;
\r
799 * @param vAnnotationElement
\r
800 * @throws java.lang.IndexOutOfBoundsException if the index
\r
801 * given is outside the bounds of the collection
\r
803 public void setAnnotationElement(
\r
805 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
806 throws java.lang.IndexOutOfBoundsException {
\r
807 // check bounds for index
\r
808 if (index < 0 || index >= this._annotationElementList.size()) {
\r
809 throw new IndexOutOfBoundsException("setAnnotationElement: Index value '" + index + "' not in range [0.." + (this._annotationElementList.size() - 1) + "]");
\r
812 this._annotationElementList.set(index, vAnnotationElement);
\r
818 * @param vAnnotationElementArray
\r
820 public void setAnnotationElement(
\r
821 final jalview.schemabinding.version2.AnnotationElement[] vAnnotationElementArray) {
\r
823 _annotationElementList.clear();
\r
825 for (int i = 0; i < vAnnotationElementArray.length; i++) {
\r
826 this._annotationElementList.add(vAnnotationElementArray[i]);
\r
831 * Sets the value of field 'autoCalculated'. The field
\r
832 * 'autoCalculated' has the following description: is an
\r
833 * autocalculated annotation row
\r
835 * @param autoCalculated the value of field 'autoCalculated'.
\r
837 public void setAutoCalculated(
\r
838 final boolean autoCalculated) {
\r
839 this._autoCalculated = autoCalculated;
\r
840 this._has_autoCalculated = true;
\r
844 * Sets the value of field 'centreColLabels'.
\r
846 * @param centreColLabels the value of field 'centreColLabels'.
\r
848 public void setCentreColLabels(
\r
849 final boolean centreColLabels) {
\r
850 this._centreColLabels = centreColLabels;
\r
851 this._has_centreColLabels = true;
\r
855 * Sets the value of field 'description'.
\r
857 * @param description the value of field 'description'.
\r
859 public void setDescription(
\r
860 final java.lang.String description) {
\r
861 this._description = description;
\r
865 * Sets the value of field 'graph'.
\r
867 * @param graph the value of field 'graph'.
\r
869 public void setGraph(
\r
870 final boolean graph) {
\r
871 this._graph = graph;
\r
872 this._has_graph = true;
\r
876 * Sets the value of field 'graphColour'.
\r
878 * @param graphColour the value of field 'graphColour'.
\r
880 public void setGraphColour(
\r
881 final int graphColour) {
\r
882 this._graphColour = graphColour;
\r
883 this._has_graphColour = true;
\r
887 * Sets the value of field 'graphGroup'.
\r
889 * @param graphGroup the value of field 'graphGroup'.
\r
891 public void setGraphGroup(
\r
892 final int graphGroup) {
\r
893 this._graphGroup = graphGroup;
\r
894 this._has_graphGroup = true;
\r
898 * Sets the value of field 'graphType'.
\r
900 * @param graphType the value of field 'graphType'.
\r
902 public void setGraphType(
\r
903 final int graphType) {
\r
904 this._graphType = graphType;
\r
905 this._has_graphType = true;
\r
909 * Sets the value of field 'groupRef'.
\r
911 * @param groupRef the value of field 'groupRef'.
\r
913 public void setGroupRef(
\r
914 final java.lang.String groupRef) {
\r
915 this._groupRef = groupRef;
\r
919 * Sets the value of field 'id'.
\r
921 * @param id the value of field 'id'.
\r
924 final java.lang.String id) {
\r
929 * Sets the value of field 'label'.
\r
931 * @param label the value of field 'label'.
\r
933 public void setLabel(
\r
934 final java.lang.String label) {
\r
935 this._label = label;
\r
939 * Sets the value of field 'scaleColLabels'.
\r
941 * @param scaleColLabels the value of field 'scaleColLabels'.
\r
943 public void setScaleColLabels(
\r
944 final boolean scaleColLabels) {
\r
945 this._scaleColLabels = scaleColLabels;
\r
946 this._has_scaleColLabels = true;
\r
950 * Sets the value of field 'score'.
\r
952 * @param score the value of field 'score'.
\r
954 public void setScore(
\r
955 final double score) {
\r
956 this._score = score;
\r
957 this._has_score = true;
\r
961 * Sets the value of field 'scoreOnly'.
\r
963 * @param scoreOnly the value of field 'scoreOnly'.
\r
965 public void setScoreOnly(
\r
966 final boolean scoreOnly) {
\r
967 this._scoreOnly = scoreOnly;
\r
968 this._has_scoreOnly = true;
\r
972 * Sets the value of field 'sequenceRef'.
\r
974 * @param sequenceRef the value of field 'sequenceRef'.
\r
976 public void setSequenceRef(
\r
977 final java.lang.String sequenceRef) {
\r
978 this._sequenceRef = sequenceRef;
\r
982 * Sets the value of field 'showAllColLabels'.
\r
984 * @param showAllColLabels the value of field 'showAllColLabels'
\r
986 public void setShowAllColLabels(
\r
987 final boolean showAllColLabels) {
\r
988 this._showAllColLabels = showAllColLabels;
\r
989 this._has_showAllColLabels = true;
\r
993 * Sets the value of field 'thresholdLine'.
\r
995 * @param thresholdLine the value of field 'thresholdLine'.
\r
997 public void setThresholdLine(
\r
998 final jalview.schemabinding.version2.ThresholdLine thresholdLine) {
\r
999 this._thresholdLine = thresholdLine;
\r
1003 * Sets the value of field 'visible'.
\r
1005 * @param visible the value of field 'visible'.
\r
1007 public void setVisible(
\r
1008 final boolean visible) {
\r
1009 this._visible = visible;
\r
1010 this._has_visible = true;
\r
1014 * Method unmarshal.
\r
1017 * @throws org.exolab.castor.xml.MarshalException if object is
\r
1018 * null or if any SAXException is thrown during marshaling
\r
1019 * @throws org.exolab.castor.xml.ValidationException if this
\r
1020 * object is an invalid instance according to the schema
\r
1021 * @return the unmarshaled
\r
1022 * jalview.schemabinding.version2.Annotation
\r
1024 public static jalview.schemabinding.version2.Annotation unmarshal(
\r
1025 final java.io.Reader reader)
\r
1026 throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
\r
1027 return (jalview.schemabinding.version2.Annotation) Unmarshaller.unmarshal(jalview.schemabinding.version2.Annotation.class, reader);
\r
1033 * @throws org.exolab.castor.xml.ValidationException if this
\r
1034 * object is an invalid instance according to the schema
\r
1036 public void validate(
\r
1038 throws org.exolab.castor.xml.ValidationException {
\r
1039 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
1040 validator.validate(this);
\r