2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
\r
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
\r
11 * Jalview is distributed in the hope that it will be useful, but
\r
12 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
14 * PURPOSE. See the GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
18 package jalview.schemabinding.version2;
\r
20 //---------------------------------/
\r
21 //- Imported classes and packages -/
\r
22 //---------------------------------/
\r
24 import org.exolab.castor.xml.Marshaller;
\r
25 import org.exolab.castor.xml.Unmarshaller;
\r
30 * @version $Revision$ $Date$
\r
32 public class Annotation implements java.io.Serializable
\r
35 // --------------------------/
\r
36 // - Class/Member Variables -/
\r
37 // --------------------------/
\r
42 private boolean _graph;
\r
45 * keeps track of state for field: _graph
\r
47 private boolean _has_graph;
\r
52 private int _graphType;
\r
55 * keeps track of state for field: _graphType
\r
57 private boolean _has_graphType;
\r
60 * Field _sequenceRef.
\r
62 private java.lang.String _sequenceRef;
\r
67 private java.lang.String _groupRef;
\r
70 * Field _graphColour.
\r
72 private int _graphColour;
\r
75 * keeps track of state for field: _graphColour
\r
77 private boolean _has_graphColour;
\r
80 * Field _graphGroup.
\r
82 private int _graphGroup;
\r
85 * keeps track of state for field: _graphGroup
\r
87 private boolean _has_graphGroup;
\r
92 private java.lang.String _id;
\r
97 private boolean _scoreOnly = false;
\r
100 * keeps track of state for field: _scoreOnly
\r
102 private boolean _has_scoreOnly;
\r
107 private double _score;
\r
110 * keeps track of state for field: _score
\r
112 private boolean _has_score;
\r
117 private boolean _visible;
\r
120 * keeps track of state for field: _visible
\r
122 private boolean _has_visible;
\r
125 * Field _centreColLabels.
\r
127 private boolean _centreColLabels;
\r
130 * keeps track of state for field: _centreColLabels
\r
132 private boolean _has_centreColLabels;
\r
135 * Field _scaleColLabels.
\r
137 private boolean _scaleColLabels;
\r
140 * keeps track of state for field: _scaleColLabels
\r
142 private boolean _has_scaleColLabels;
\r
145 * Field _showAllColLabels.
\r
147 private boolean _showAllColLabels;
\r
150 * keeps track of state for field: _showAllColLabels
\r
152 private boolean _has_showAllColLabels;
\r
155 * is an autocalculated annotation row
\r
157 private boolean _autoCalculated = false;
\r
160 * keeps track of state for field: _autoCalculated
\r
162 private boolean _has_autoCalculated;
\r
165 * Field _annotationElementList.
\r
167 private java.util.Vector _annotationElementList;
\r
172 private java.lang.String _label;
\r
175 * Field _description.
\r
177 private java.lang.String _description;
\r
180 * Field _thresholdLine.
\r
182 private jalview.schemabinding.version2.ThresholdLine _thresholdLine;
\r
184 // ----------------/
\r
185 // - Constructors -/
\r
186 // ----------------/
\r
188 public Annotation()
\r
191 this._annotationElementList = new java.util.Vector();
\r
201 * @param vAnnotationElement
\r
202 * @throws java.lang.IndexOutOfBoundsException
\r
203 * if the index given is outside the bounds of the collection
\r
205 public void addAnnotationElement(
\r
206 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
207 throws java.lang.IndexOutOfBoundsException
\r
209 this._annotationElementList.addElement(vAnnotationElement);
\r
216 * @param vAnnotationElement
\r
217 * @throws java.lang.IndexOutOfBoundsException
\r
218 * if the index given is outside the bounds of the collection
\r
220 public void addAnnotationElement(
\r
222 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
223 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
\r
321 * if the index given is outside the bounds of the collection
\r
322 * @return the value of the jalview.schemabinding.version2.AnnotationElement
\r
323 * at the given index
\r
325 public jalview.schemabinding.version2.AnnotationElement getAnnotationElement(
\r
326 final int index) throws java.lang.IndexOutOfBoundsException
\r
328 // check bounds for index
\r
329 if (index < 0 || index >= this._annotationElementList.size())
\r
331 throw new IndexOutOfBoundsException(
\r
332 "getAnnotationElement: Index value '" + index
\r
333 + "' not in range [0.."
\r
334 + (this._annotationElementList.size() - 1) + "]");
\r
337 return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList
\r
342 * Method getAnnotationElement.Returns the contents of the collection in an
\r
345 * Note: Just in case the collection contents are changing in another thread,
\r
346 * we pass a 0-length Array of the correct type into the API call. This way we
\r
347 * <i>know</i> that the Array returned is of exactly the correct length.
\r
349 * @return this collection as an Array
\r
351 public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement()
\r
353 jalview.schemabinding.version2.AnnotationElement[] array = new jalview.schemabinding.version2.AnnotationElement[0];
\r
354 return (jalview.schemabinding.version2.AnnotationElement[]) this._annotationElementList
\r
359 * Method getAnnotationElementCount.
\r
361 * @return the size of this collection
\r
363 public int getAnnotationElementCount()
\r
365 return this._annotationElementList.size();
\r
369 * Returns the value of field 'autoCalculated'. The field 'autoCalculated' has
\r
370 * the following description: is an autocalculated annotation row
\r
372 * @return the value of field 'AutoCalculated'.
\r
374 public boolean getAutoCalculated()
\r
376 return this._autoCalculated;
\r
380 * Returns the value of field 'centreColLabels'.
\r
382 * @return the value of field 'CentreColLabels'.
\r
384 public boolean getCentreColLabels()
\r
386 return this._centreColLabels;
\r
390 * Returns the value of field 'description'.
\r
392 * @return the value of field 'Description'.
\r
394 public java.lang.String getDescription()
\r
396 return this._description;
\r
400 * Returns the value of field 'graph'.
\r
402 * @return the value of field 'Graph'.
\r
404 public boolean getGraph()
\r
406 return this._graph;
\r
410 * Returns the value of field 'graphColour'.
\r
412 * @return the value of field 'GraphColour'.
\r
414 public int getGraphColour()
\r
416 return this._graphColour;
\r
420 * Returns the value of field 'graphGroup'.
\r
422 * @return the value of field 'GraphGroup'.
\r
424 public int getGraphGroup()
\r
426 return this._graphGroup;
\r
430 * Returns the value of field 'graphType'.
\r
432 * @return the value of field 'GraphType'.
\r
434 public int getGraphType()
\r
436 return this._graphType;
\r
440 * Returns the value of field 'groupRef'.
\r
442 * @return the value of field 'GroupRef'.
\r
444 public java.lang.String getGroupRef()
\r
446 return this._groupRef;
\r
450 * Returns the value of field 'id'.
\r
452 * @return the value of field 'Id'.
\r
454 public java.lang.String getId()
\r
460 * Returns the value of field 'label'.
\r
462 * @return the value of field 'Label'.
\r
464 public java.lang.String getLabel()
\r
466 return this._label;
\r
470 * Returns the value of field 'scaleColLabels'.
\r
472 * @return the value of field 'ScaleColLabels'.
\r
474 public boolean getScaleColLabels()
\r
476 return this._scaleColLabels;
\r
480 * Returns the value of field 'score'.
\r
482 * @return the value of field 'Score'.
\r
484 public double getScore()
\r
486 return this._score;
\r
490 * Returns the value of field 'scoreOnly'.
\r
492 * @return the value of field 'ScoreOnly'.
\r
494 public boolean getScoreOnly()
\r
496 return this._scoreOnly;
\r
500 * Returns the value of field 'sequenceRef'.
\r
502 * @return the value of field 'SequenceRef'.
\r
504 public java.lang.String getSequenceRef()
\r
506 return this._sequenceRef;
\r
510 * Returns the value of field 'showAllColLabels'.
\r
512 * @return the value of field 'ShowAllColLabels'.
\r
514 public boolean getShowAllColLabels()
\r
516 return this._showAllColLabels;
\r
520 * Returns the value of field 'thresholdLine'.
\r
522 * @return the value of field 'ThresholdLine'.
\r
524 public jalview.schemabinding.version2.ThresholdLine getThresholdLine()
\r
526 return this._thresholdLine;
\r
530 * Returns the value of field 'visible'.
\r
532 * @return the value of field 'Visible'.
\r
534 public boolean getVisible()
\r
536 return this._visible;
\r
540 * Method hasAutoCalculated.
\r
542 * @return true if at least one AutoCalculated has been added
\r
544 public boolean hasAutoCalculated()
\r
546 return this._has_autoCalculated;
\r
550 * Method hasCentreColLabels.
\r
552 * @return true if at least one CentreColLabels has been added
\r
554 public boolean hasCentreColLabels()
\r
556 return this._has_centreColLabels;
\r
562 * @return true if at least one Graph has been added
\r
564 public boolean hasGraph()
\r
566 return this._has_graph;
\r
570 * Method hasGraphColour.
\r
572 * @return true if at least one GraphColour has been added
\r
574 public boolean hasGraphColour()
\r
576 return this._has_graphColour;
\r
580 * Method hasGraphGroup.
\r
582 * @return true if at least one GraphGroup has been added
\r
584 public boolean hasGraphGroup()
\r
586 return this._has_graphGroup;
\r
590 * Method hasGraphType.
\r
592 * @return true if at least one GraphType has been added
\r
594 public boolean hasGraphType()
\r
596 return this._has_graphType;
\r
600 * Method hasScaleColLabels.
\r
602 * @return true if at least one ScaleColLabels has been added
\r
604 public boolean hasScaleColLabels()
\r
606 return this._has_scaleColLabels;
\r
612 * @return true if at least one Score has been added
\r
614 public boolean hasScore()
\r
616 return this._has_score;
\r
620 * Method hasScoreOnly.
\r
622 * @return true if at least one ScoreOnly has been added
\r
624 public boolean hasScoreOnly()
\r
626 return this._has_scoreOnly;
\r
630 * Method hasShowAllColLabels.
\r
632 * @return true if at least one ShowAllColLabels has been added
\r
634 public boolean hasShowAllColLabels()
\r
636 return this._has_showAllColLabels;
\r
640 * Method hasVisible.
\r
642 * @return true if at least one Visible has been added
\r
644 public boolean hasVisible()
\r
646 return this._has_visible;
\r
650 * Returns the value of field 'autoCalculated'. The field 'autoCalculated' has
\r
651 * the following description: is an autocalculated annotation row
\r
653 * @return the value of field 'AutoCalculated'.
\r
655 public boolean isAutoCalculated()
\r
657 return this._autoCalculated;
\r
661 * Returns the value of field 'centreColLabels'.
\r
663 * @return the value of field 'CentreColLabels'.
\r
665 public boolean isCentreColLabels()
\r
667 return this._centreColLabels;
\r
671 * Returns the value of field 'graph'.
\r
673 * @return the value of field 'Graph'.
\r
675 public boolean isGraph()
\r
677 return this._graph;
\r
681 * Returns the value of field 'scaleColLabels'.
\r
683 * @return the value of field 'ScaleColLabels'.
\r
685 public boolean isScaleColLabels()
\r
687 return this._scaleColLabels;
\r
691 * Returns the value of field 'scoreOnly'.
\r
693 * @return the value of field 'ScoreOnly'.
\r
695 public boolean isScoreOnly()
\r
697 return this._scoreOnly;
\r
701 * Returns the value of field 'showAllColLabels'.
\r
703 * @return the value of field 'ShowAllColLabels'.
\r
705 public boolean isShowAllColLabels()
\r
707 return this._showAllColLabels;
\r
713 * @return true if this object is valid according to the schema
\r
715 public boolean isValid()
\r
720 } catch (org.exolab.castor.xml.ValidationException vex)
\r
728 * Returns the value of field 'visible'.
\r
730 * @return the value of field 'Visible'.
\r
732 public boolean isVisible()
\r
734 return this._visible;
\r
741 * @throws org.exolab.castor.xml.MarshalException
\r
742 * if object is null or if any SAXException is thrown during
\r
744 * @throws org.exolab.castor.xml.ValidationException
\r
745 * if this object is an invalid instance according to the schema
\r
747 public void marshal(final java.io.Writer out)
\r
748 throws org.exolab.castor.xml.MarshalException,
\r
749 org.exolab.castor.xml.ValidationException
\r
751 Marshaller.marshal(this, out);
\r
758 * @throws java.io.IOException
\r
759 * if an IOException occurs during marshaling
\r
760 * @throws org.exolab.castor.xml.ValidationException
\r
761 * if this object is an invalid instance according to the schema
\r
762 * @throws org.exolab.castor.xml.MarshalException
\r
763 * if object is null or if any SAXException is thrown during
\r
766 public void marshal(final org.xml.sax.ContentHandler handler)
\r
767 throws java.io.IOException,
\r
768 org.exolab.castor.xml.MarshalException,
\r
769 org.exolab.castor.xml.ValidationException
\r
771 Marshaller.marshal(this, handler);
\r
776 public void removeAllAnnotationElement()
\r
778 this._annotationElementList.clear();
\r
782 * Method removeAnnotationElement.
\r
784 * @param vAnnotationElement
\r
785 * @return true if the object was removed from the collection.
\r
787 public boolean removeAnnotationElement(
\r
788 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
790 boolean removed = _annotationElementList.remove(vAnnotationElement);
\r
795 * Method removeAnnotationElementAt.
\r
798 * @return the element removed from the collection
\r
800 public jalview.schemabinding.version2.AnnotationElement removeAnnotationElementAt(
\r
803 java.lang.Object obj = this._annotationElementList.remove(index);
\r
804 return (jalview.schemabinding.version2.AnnotationElement) obj;
\r
811 * @param vAnnotationElement
\r
812 * @throws java.lang.IndexOutOfBoundsException
\r
813 * if the index given is outside the bounds of the collection
\r
815 public void setAnnotationElement(
\r
817 final jalview.schemabinding.version2.AnnotationElement vAnnotationElement)
\r
818 throws java.lang.IndexOutOfBoundsException
\r
820 // check bounds for index
\r
821 if (index < 0 || index >= this._annotationElementList.size())
\r
823 throw new IndexOutOfBoundsException(
\r
824 "setAnnotationElement: Index value '" + index
\r
825 + "' not in range [0.."
\r
826 + (this._annotationElementList.size() - 1) + "]");
\r
829 this._annotationElementList.set(index, vAnnotationElement);
\r
835 * @param vAnnotationElementArray
\r
837 public void setAnnotationElement(
\r
838 final jalview.schemabinding.version2.AnnotationElement[] vAnnotationElementArray)
\r
841 _annotationElementList.clear();
\r
843 for (int i = 0; i < vAnnotationElementArray.length; i++)
\r
845 this._annotationElementList.add(vAnnotationElementArray[i]);
\r
850 * Sets the value of field 'autoCalculated'. The field 'autoCalculated' has
\r
851 * the following description: is an autocalculated annotation row
\r
853 * @param autoCalculated
\r
854 * the value of field 'autoCalculated'.
\r
856 public void setAutoCalculated(final boolean autoCalculated)
\r
858 this._autoCalculated = autoCalculated;
\r
859 this._has_autoCalculated = true;
\r
863 * Sets the value of field 'centreColLabels'.
\r
865 * @param centreColLabels
\r
866 * the value of field 'centreColLabels'.
\r
868 public void setCentreColLabels(final boolean centreColLabels)
\r
870 this._centreColLabels = centreColLabels;
\r
871 this._has_centreColLabels = true;
\r
875 * Sets the value of field 'description'.
\r
877 * @param description
\r
878 * the value of field 'description'.
\r
880 public void setDescription(final java.lang.String description)
\r
882 this._description = description;
\r
886 * Sets the value of field 'graph'.
\r
889 * the value of field 'graph'.
\r
891 public void setGraph(final boolean graph)
\r
893 this._graph = graph;
\r
894 this._has_graph = true;
\r
898 * Sets the value of field 'graphColour'.
\r
900 * @param graphColour
\r
901 * the value of field 'graphColour'.
\r
903 public void setGraphColour(final int graphColour)
\r
905 this._graphColour = graphColour;
\r
906 this._has_graphColour = true;
\r
910 * Sets the value of field 'graphGroup'.
\r
912 * @param graphGroup
\r
913 * the value of field 'graphGroup'.
\r
915 public void setGraphGroup(final int graphGroup)
\r
917 this._graphGroup = graphGroup;
\r
918 this._has_graphGroup = true;
\r
922 * Sets the value of field 'graphType'.
\r
925 * the value of field 'graphType'.
\r
927 public void setGraphType(final int graphType)
\r
929 this._graphType = graphType;
\r
930 this._has_graphType = true;
\r
934 * Sets the value of field 'groupRef'.
\r
937 * the value of field 'groupRef'.
\r
939 public void setGroupRef(final java.lang.String groupRef)
\r
941 this._groupRef = groupRef;
\r
945 * Sets the value of field 'id'.
\r
948 * the value of field 'id'.
\r
950 public void setId(final java.lang.String id)
\r
956 * Sets the value of field 'label'.
\r
959 * the value of field 'label'.
\r
961 public void setLabel(final java.lang.String label)
\r
963 this._label = label;
\r
967 * Sets the value of field 'scaleColLabels'.
\r
969 * @param scaleColLabels
\r
970 * the value of field 'scaleColLabels'.
\r
972 public void setScaleColLabels(final boolean scaleColLabels)
\r
974 this._scaleColLabels = scaleColLabels;
\r
975 this._has_scaleColLabels = true;
\r
979 * Sets the value of field 'score'.
\r
982 * the value of field 'score'.
\r
984 public void setScore(final double score)
\r
986 this._score = score;
\r
987 this._has_score = true;
\r
991 * Sets the value of field 'scoreOnly'.
\r
994 * the value of field 'scoreOnly'.
\r
996 public void setScoreOnly(final boolean scoreOnly)
\r
998 this._scoreOnly = scoreOnly;
\r
999 this._has_scoreOnly = true;
\r
1003 * Sets the value of field 'sequenceRef'.
\r
1005 * @param sequenceRef
\r
1006 * the value of field 'sequenceRef'.
\r
1008 public void setSequenceRef(final java.lang.String sequenceRef)
\r
1010 this._sequenceRef = sequenceRef;
\r
1014 * Sets the value of field 'showAllColLabels'.
\r
1016 * @param showAllColLabels
\r
1017 * the value of field 'showAllColLabels'
\r
1019 public void setShowAllColLabels(final boolean showAllColLabels)
\r
1021 this._showAllColLabels = showAllColLabels;
\r
1022 this._has_showAllColLabels = true;
\r
1026 * Sets the value of field 'thresholdLine'.
\r
1028 * @param thresholdLine
\r
1029 * the value of field 'thresholdLine'.
\r
1031 public void setThresholdLine(
\r
1032 final jalview.schemabinding.version2.ThresholdLine thresholdLine)
\r
1034 this._thresholdLine = thresholdLine;
\r
1038 * Sets the value of field 'visible'.
\r
1041 * the value of field 'visible'.
\r
1043 public void setVisible(final boolean visible)
\r
1045 this._visible = visible;
\r
1046 this._has_visible = true;
\r
1050 * Method unmarshal.
\r
1053 * @throws org.exolab.castor.xml.MarshalException
\r
1054 * if object is null or if any SAXException is thrown during
\r
1056 * @throws org.exolab.castor.xml.ValidationException
\r
1057 * if this object is an invalid instance according to the schema
\r
1058 * @return the unmarshaled jalview.schemabinding.version2.Annotation
\r
1060 public static jalview.schemabinding.version2.Annotation unmarshal(
\r
1061 final java.io.Reader reader)
\r
1062 throws org.exolab.castor.xml.MarshalException,
\r
1063 org.exolab.castor.xml.ValidationException
\r
1065 return (jalview.schemabinding.version2.Annotation) Unmarshaller
\r
1066 .unmarshal(jalview.schemabinding.version2.Annotation.class,
\r
1073 * @throws org.exolab.castor.xml.ValidationException
\r
1074 * if this object is an invalid instance according to the schema
\r
1076 public void validate() throws org.exolab.castor.xml.ValidationException
\r
1078 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
\r
1079 validator.validate(this);
\r