2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.schemabinding.version2;
23 //---------------------------------/
24 //- Imported classes and packages -/
25 //---------------------------------/
27 import jalview.util.MessageManager;
29 import org.exolab.castor.xml.Marshaller;
30 import org.exolab.castor.xml.Unmarshaller;
35 * @version $Revision$ $Date$
37 public class JGroup implements java.io.Serializable
40 // --------------------------/
41 // - Class/Member Variables -/
42 // --------------------------/
50 * keeps track of state for field: _start
52 private boolean _has_start;
60 * keeps track of state for field: _end
62 private boolean _has_end;
67 private java.lang.String _name;
72 private java.lang.String _colour;
75 * Field _consThreshold.
77 private int _consThreshold;
80 * keeps track of state for field: _consThreshold
82 private boolean _has_consThreshold;
85 * Field _pidThreshold.
87 private int _pidThreshold;
90 * keeps track of state for field: _pidThreshold
92 private boolean _has_pidThreshold;
95 * Field _outlineColour.
97 private int _outlineColour;
100 * keeps track of state for field: _outlineColour
102 private boolean _has_outlineColour;
105 * Field _displayBoxes.
107 private boolean _displayBoxes;
110 * keeps track of state for field: _displayBoxes
112 private boolean _has_displayBoxes;
115 * Field _displayText.
117 private boolean _displayText;
120 * keeps track of state for field: _displayText
122 private boolean _has_displayText;
127 private boolean _colourText;
130 * keeps track of state for field: _colourText
132 private boolean _has_colourText;
137 private int _textCol1;
140 * keeps track of state for field: _textCol1
142 private boolean _has_textCol1;
147 private int _textCol2;
150 * keeps track of state for field: _textCol2
152 private boolean _has_textCol2;
155 * Field _textColThreshold.
157 private int _textColThreshold;
160 * keeps track of state for field: _textColThreshold
162 private boolean _has_textColThreshold;
165 * Field _showUnconserved.
167 private boolean _showUnconserved;
170 * keeps track of state for field: _showUnconserved
172 private boolean _has_showUnconserved;
175 * Field _ignoreGapsinConsensus.
177 private boolean _ignoreGapsinConsensus = true;
180 * keeps track of state for field: _ignoreGapsinConsensus
182 private boolean _has_ignoreGapsinConsensus;
185 * Field _showConsensusHistogram.
187 private boolean _showConsensusHistogram = true;
190 * keeps track of state for field: _showConsensusHistogram
192 private boolean _has_showConsensusHistogram;
195 * Field _showSequenceLogo.
197 private boolean _showSequenceLogo = false;
200 * keeps track of state for field: _showSequenceLogo
202 private boolean _has_showSequenceLogo;
205 * Field _normaliseSequenceLogo.
207 private boolean _normaliseSequenceLogo = false;
210 * keeps track of state for field: _normaliseSequenceLogo
212 private boolean _has_normaliseSequenceLogo;
215 * Optional sequence group ID (only needs to be unique for this alignment)
218 private java.lang.String _id;
223 private java.util.Vector _seqList;
226 * Field _annotationColours.
228 private jalview.schemabinding.version2.AnnotationColours _annotationColours;
237 this._seqList = new java.util.Vector();
248 * @throws java.lang.IndexOutOfBoundsException
249 * if the index given is outside the bounds of the collection
251 public void addSeq(final java.lang.String vSeq)
252 throws java.lang.IndexOutOfBoundsException
254 this._seqList.addElement(vSeq);
262 * @throws java.lang.IndexOutOfBoundsException
263 * if the index given is outside the bounds of the collection
265 public void addSeq(final int index, final java.lang.String vSeq)
266 throws java.lang.IndexOutOfBoundsException
268 this._seqList.add(index, vSeq);
273 public void deleteColourText()
275 this._has_colourText = false;
280 public void deleteConsThreshold()
282 this._has_consThreshold = false;
287 public void deleteDisplayBoxes()
289 this._has_displayBoxes = false;
294 public void deleteDisplayText()
296 this._has_displayText = false;
301 public void deleteEnd()
303 this._has_end = false;
308 public void deleteIgnoreGapsinConsensus()
310 this._has_ignoreGapsinConsensus = false;
315 public void deleteNormaliseSequenceLogo()
317 this._has_normaliseSequenceLogo = false;
322 public void deleteOutlineColour()
324 this._has_outlineColour = false;
329 public void deletePidThreshold()
331 this._has_pidThreshold = false;
336 public void deleteShowConsensusHistogram()
338 this._has_showConsensusHistogram = false;
343 public void deleteShowSequenceLogo()
345 this._has_showSequenceLogo = false;
350 public void deleteShowUnconserved()
352 this._has_showUnconserved = false;
357 public void deleteStart()
359 this._has_start = false;
364 public void deleteTextCol1()
366 this._has_textCol1 = false;
371 public void deleteTextCol2()
373 this._has_textCol2 = false;
378 public void deleteTextColThreshold()
380 this._has_textColThreshold = false;
384 * Method enumerateSeq.
386 * @return an Enumeration over all java.lang.String elements
388 public java.util.Enumeration enumerateSeq()
390 return this._seqList.elements();
394 * Returns the value of field 'annotationColours'.
396 * @return the value of field 'AnnotationColours'.
398 public jalview.schemabinding.version2.AnnotationColours getAnnotationColours()
400 return this._annotationColours;
404 * Returns the value of field 'colour'.
406 * @return the value of field 'Colour'.
408 public java.lang.String getColour()
414 * Returns the value of field 'colourText'.
416 * @return the value of field 'ColourText'.
418 public boolean getColourText()
420 return this._colourText;
424 * Returns the value of field 'consThreshold'.
426 * @return the value of field 'ConsThreshold'.
428 public int getConsThreshold()
430 return this._consThreshold;
434 * Returns the value of field 'displayBoxes'.
436 * @return the value of field 'DisplayBoxes'.
438 public boolean getDisplayBoxes()
440 return this._displayBoxes;
444 * Returns the value of field 'displayText'.
446 * @return the value of field 'DisplayText'.
448 public boolean getDisplayText()
450 return this._displayText;
454 * Returns the value of field 'end'.
456 * @return the value of field 'End'.
464 * Returns the value of field 'id'. The field 'id' has the following
465 * description: Optional sequence group ID (only needs to be unique for this
469 * @return the value of field 'Id'.
471 public java.lang.String getId()
477 * Returns the value of field 'ignoreGapsinConsensus'.
479 * @return the value of field 'IgnoreGapsinConsensus'.
481 public boolean getIgnoreGapsinConsensus()
483 return this._ignoreGapsinConsensus;
487 * Returns the value of field 'name'.
489 * @return the value of field 'Name'.
491 public java.lang.String getName()
497 * Returns the value of field 'normaliseSequenceLogo'.
499 * @return the value of field 'NormaliseSequenceLogo'.
501 public boolean getNormaliseSequenceLogo()
503 return this._normaliseSequenceLogo;
507 * Returns the value of field 'outlineColour'.
509 * @return the value of field 'OutlineColour'.
511 public int getOutlineColour()
513 return this._outlineColour;
517 * Returns the value of field 'pidThreshold'.
519 * @return the value of field 'PidThreshold'.
521 public int getPidThreshold()
523 return this._pidThreshold;
530 * @throws java.lang.IndexOutOfBoundsException
531 * if the index given is outside the bounds of the collection
532 * @return the value of the java.lang.String at the given index
534 public java.lang.String getSeq(final int index)
535 throws java.lang.IndexOutOfBoundsException
537 // check bounds for index
538 if (index < 0 || index >= this._seqList.size())
540 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
542 Integer.valueOf(index).toString(),
543 Integer.valueOf((this._seqList.size() - 1)).toString()
547 return (java.lang.String) _seqList.get(index);
551 * Method getSeq.Returns the contents of the collection in an Array.
553 * Note: Just in case the collection contents are changing in another thread,
554 * we pass a 0-length Array of the correct type into the API call. This way we
555 * <i>know</i> that the Array returned is of exactly the correct length.
557 * @return this collection as an Array
559 public java.lang.String[] getSeq()
561 java.lang.String[] array = new java.lang.String[0];
562 return (java.lang.String[]) this._seqList.toArray(array);
566 * Method getSeqCount.
568 * @return the size of this collection
570 public int getSeqCount()
572 return this._seqList.size();
576 * Returns the value of field 'showConsensusHistogram'.
578 * @return the value of field 'ShowConsensusHistogram'.
580 public boolean getShowConsensusHistogram()
582 return this._showConsensusHistogram;
586 * Returns the value of field 'showSequenceLogo'.
588 * @return the value of field 'ShowSequenceLogo'.
590 public boolean getShowSequenceLogo()
592 return this._showSequenceLogo;
596 * Returns the value of field 'showUnconserved'.
598 * @return the value of field 'ShowUnconserved'.
600 public boolean getShowUnconserved()
602 return this._showUnconserved;
606 * Returns the value of field 'start'.
608 * @return the value of field 'Start'.
610 public int getStart()
616 * Returns the value of field 'textCol1'.
618 * @return the value of field 'TextCol1'.
620 public int getTextCol1()
622 return this._textCol1;
626 * Returns the value of field 'textCol2'.
628 * @return the value of field 'TextCol2'.
630 public int getTextCol2()
632 return this._textCol2;
636 * Returns the value of field 'textColThreshold'.
638 * @return the value of field 'TextColThreshold'.
640 public int getTextColThreshold()
642 return this._textColThreshold;
646 * Method hasColourText.
648 * @return true if at least one ColourText has been added
650 public boolean hasColourText()
652 return this._has_colourText;
656 * Method hasConsThreshold.
658 * @return true if at least one ConsThreshold has been added
660 public boolean hasConsThreshold()
662 return this._has_consThreshold;
666 * Method hasDisplayBoxes.
668 * @return true if at least one DisplayBoxes has been added
670 public boolean hasDisplayBoxes()
672 return this._has_displayBoxes;
676 * Method hasDisplayText.
678 * @return true if at least one DisplayText has been added
680 public boolean hasDisplayText()
682 return this._has_displayText;
688 * @return true if at least one End has been added
690 public boolean hasEnd()
692 return this._has_end;
696 * Method hasIgnoreGapsinConsensus.
698 * @return true if at least one IgnoreGapsinConsensus has been added
700 public boolean hasIgnoreGapsinConsensus()
702 return this._has_ignoreGapsinConsensus;
706 * Method hasNormaliseSequenceLogo.
708 * @return true if at least one NormaliseSequenceLogo has been added
710 public boolean hasNormaliseSequenceLogo()
712 return this._has_normaliseSequenceLogo;
716 * Method hasOutlineColour.
718 * @return true if at least one OutlineColour has been added
720 public boolean hasOutlineColour()
722 return this._has_outlineColour;
726 * Method hasPidThreshold.
728 * @return true if at least one PidThreshold has been added
730 public boolean hasPidThreshold()
732 return this._has_pidThreshold;
736 * Method hasShowConsensusHistogram.
738 * @return true if at least one ShowConsensusHistogram has been added
740 public boolean hasShowConsensusHistogram()
742 return this._has_showConsensusHistogram;
746 * Method hasShowSequenceLogo.
748 * @return true if at least one ShowSequenceLogo has been added
750 public boolean hasShowSequenceLogo()
752 return this._has_showSequenceLogo;
756 * Method hasShowUnconserved.
758 * @return true if at least one ShowUnconserved has been added
760 public boolean hasShowUnconserved()
762 return this._has_showUnconserved;
768 * @return true if at least one Start has been added
770 public boolean hasStart()
772 return this._has_start;
776 * Method hasTextCol1.
778 * @return true if at least one TextCol1 has been added
780 public boolean hasTextCol1()
782 return this._has_textCol1;
786 * Method hasTextCol2.
788 * @return true if at least one TextCol2 has been added
790 public boolean hasTextCol2()
792 return this._has_textCol2;
796 * Method hasTextColThreshold.
798 * @return true if at least one TextColThreshold has been added
800 public boolean hasTextColThreshold()
802 return this._has_textColThreshold;
806 * Returns the value of field 'colourText'.
808 * @return the value of field 'ColourText'.
810 public boolean isColourText()
812 return this._colourText;
816 * Returns the value of field 'displayBoxes'.
818 * @return the value of field 'DisplayBoxes'.
820 public boolean isDisplayBoxes()
822 return this._displayBoxes;
826 * Returns the value of field 'displayText'.
828 * @return the value of field 'DisplayText'.
830 public boolean isDisplayText()
832 return this._displayText;
836 * Returns the value of field 'ignoreGapsinConsensus'.
838 * @return the value of field 'IgnoreGapsinConsensus'.
840 public boolean isIgnoreGapsinConsensus()
842 return this._ignoreGapsinConsensus;
846 * Returns the value of field 'normaliseSequenceLogo'.
848 * @return the value of field 'NormaliseSequenceLogo'.
850 public boolean isNormaliseSequenceLogo()
852 return this._normaliseSequenceLogo;
856 * Returns the value of field 'showConsensusHistogram'.
858 * @return the value of field 'ShowConsensusHistogram'.
860 public boolean isShowConsensusHistogram()
862 return this._showConsensusHistogram;
866 * Returns the value of field 'showSequenceLogo'.
868 * @return the value of field 'ShowSequenceLogo'.
870 public boolean isShowSequenceLogo()
872 return this._showSequenceLogo;
876 * Returns the value of field 'showUnconserved'.
878 * @return the value of field 'ShowUnconserved'.
880 public boolean isShowUnconserved()
882 return this._showUnconserved;
888 * @return true if this object is valid according to the schema
890 public boolean isValid()
895 } catch (org.exolab.castor.xml.ValidationException vex)
906 * @throws org.exolab.castor.xml.MarshalException
907 * if object is null or if any SAXException is thrown during
909 * @throws org.exolab.castor.xml.ValidationException
910 * if this object is an invalid instance according to the schema
912 public void marshal(final java.io.Writer out)
913 throws org.exolab.castor.xml.MarshalException,
914 org.exolab.castor.xml.ValidationException
916 Marshaller.marshal(this, out);
923 * @throws java.io.IOException
924 * if an IOException occurs during marshaling
925 * @throws org.exolab.castor.xml.ValidationException
926 * if this object is an invalid instance according to the schema
927 * @throws org.exolab.castor.xml.MarshalException
928 * if object is null or if any SAXException is thrown during
931 public void marshal(final org.xml.sax.ContentHandler handler)
932 throws java.io.IOException,
933 org.exolab.castor.xml.MarshalException,
934 org.exolab.castor.xml.ValidationException
936 Marshaller.marshal(this, handler);
941 public void removeAllSeq()
943 this._seqList.clear();
950 * @return true if the object was removed from the collection.
952 public boolean removeSeq(final java.lang.String vSeq)
954 boolean removed = _seqList.remove(vSeq);
959 * Method removeSeqAt.
962 * @return the element removed from the collection
964 public java.lang.String removeSeqAt(final int index)
966 java.lang.Object obj = this._seqList.remove(index);
967 return (java.lang.String) obj;
971 * Sets the value of field 'annotationColours'.
973 * @param annotationColours
974 * the value of field 'annotationColours'.
976 public void setAnnotationColours(
977 final jalview.schemabinding.version2.AnnotationColours annotationColours)
979 this._annotationColours = annotationColours;
983 * Sets the value of field 'colour'.
986 * the value of field 'colour'.
988 public void setColour(final java.lang.String colour)
990 this._colour = colour;
994 * Sets the value of field 'colourText'.
997 * the value of field 'colourText'.
999 public void setColourText(final boolean colourText)
1001 this._colourText = colourText;
1002 this._has_colourText = true;
1006 * Sets the value of field 'consThreshold'.
1008 * @param consThreshold
1009 * the value of field 'consThreshold'.
1011 public void setConsThreshold(final int consThreshold)
1013 this._consThreshold = consThreshold;
1014 this._has_consThreshold = true;
1018 * Sets the value of field 'displayBoxes'.
1020 * @param displayBoxes
1021 * the value of field 'displayBoxes'.
1023 public void setDisplayBoxes(final boolean displayBoxes)
1025 this._displayBoxes = displayBoxes;
1026 this._has_displayBoxes = true;
1030 * Sets the value of field 'displayText'.
1032 * @param displayText
1033 * the value of field 'displayText'.
1035 public void setDisplayText(final boolean displayText)
1037 this._displayText = displayText;
1038 this._has_displayText = true;
1042 * Sets the value of field 'end'.
1045 * the value of field 'end'.
1047 public void setEnd(final int end)
1050 this._has_end = true;
1054 * Sets the value of field 'id'. The field 'id' has the following description:
1055 * Optional sequence group ID (only needs to be unique for this alignment)
1059 * the value of field 'id'.
1061 public void setId(final java.lang.String id)
1067 * Sets the value of field 'ignoreGapsinConsensus'.
1069 * @param ignoreGapsinConsensus
1070 * the value of field 'ignoreGapsinConsensus'.
1072 public void setIgnoreGapsinConsensus(final boolean ignoreGapsinConsensus)
1074 this._ignoreGapsinConsensus = ignoreGapsinConsensus;
1075 this._has_ignoreGapsinConsensus = true;
1079 * Sets the value of field 'name'.
1082 * the value of field 'name'.
1084 public void setName(final java.lang.String name)
1090 * Sets the value of field 'normaliseSequenceLogo'.
1092 * @param normaliseSequenceLogo
1093 * the value of field 'normaliseSequenceLogo'.
1095 public void setNormaliseSequenceLogo(final boolean normaliseSequenceLogo)
1097 this._normaliseSequenceLogo = normaliseSequenceLogo;
1098 this._has_normaliseSequenceLogo = true;
1102 * Sets the value of field 'outlineColour'.
1104 * @param outlineColour
1105 * the value of field 'outlineColour'.
1107 public void setOutlineColour(final int outlineColour)
1109 this._outlineColour = outlineColour;
1110 this._has_outlineColour = true;
1114 * Sets the value of field 'pidThreshold'.
1116 * @param pidThreshold
1117 * the value of field 'pidThreshold'.
1119 public void setPidThreshold(final int pidThreshold)
1121 this._pidThreshold = pidThreshold;
1122 this._has_pidThreshold = true;
1130 * @throws java.lang.IndexOutOfBoundsException
1131 * if the index given is outside the bounds of the collection
1133 public void setSeq(final int index, final java.lang.String vSeq)
1134 throws java.lang.IndexOutOfBoundsException
1136 // check bounds for index
1137 if (index < 0 || index >= this._seqList.size())
1139 throw new IndexOutOfBoundsException(MessageManager.formatMessage("exception.index_value_not_in_range", new String[]{
1141 Integer.valueOf(index).toString(),
1142 Integer.valueOf((this._seqList.size() - 1)).toString()
1146 this._seqList.set(index, vSeq);
1154 public void setSeq(final java.lang.String[] vSeqArray)
1159 for (int i = 0; i < vSeqArray.length; i++)
1161 this._seqList.add(vSeqArray[i]);
1166 * Sets the value of field 'showConsensusHistogram'.
1168 * @param showConsensusHistogram
1169 * the value of field 'showConsensusHistogram'.
1171 public void setShowConsensusHistogram(final boolean showConsensusHistogram)
1173 this._showConsensusHistogram = showConsensusHistogram;
1174 this._has_showConsensusHistogram = true;
1178 * Sets the value of field 'showSequenceLogo'.
1180 * @param showSequenceLogo
1181 * the value of field 'showSequenceLogo'
1183 public void setShowSequenceLogo(final boolean showSequenceLogo)
1185 this._showSequenceLogo = showSequenceLogo;
1186 this._has_showSequenceLogo = true;
1190 * Sets the value of field 'showUnconserved'.
1192 * @param showUnconserved
1193 * the value of field 'showUnconserved'.
1195 public void setShowUnconserved(final boolean showUnconserved)
1197 this._showUnconserved = showUnconserved;
1198 this._has_showUnconserved = true;
1202 * Sets the value of field 'start'.
1205 * the value of field 'start'.
1207 public void setStart(final int start)
1209 this._start = start;
1210 this._has_start = true;
1214 * Sets the value of field 'textCol1'.
1217 * the value of field 'textCol1'.
1219 public void setTextCol1(final int textCol1)
1221 this._textCol1 = textCol1;
1222 this._has_textCol1 = true;
1226 * Sets the value of field 'textCol2'.
1229 * the value of field 'textCol2'.
1231 public void setTextCol2(final int textCol2)
1233 this._textCol2 = textCol2;
1234 this._has_textCol2 = true;
1238 * Sets the value of field 'textColThreshold'.
1240 * @param textColThreshold
1241 * the value of field 'textColThreshold'
1243 public void setTextColThreshold(final int textColThreshold)
1245 this._textColThreshold = textColThreshold;
1246 this._has_textColThreshold = true;
1253 * @throws org.exolab.castor.xml.MarshalException
1254 * if object is null or if any SAXException is thrown during
1256 * @throws org.exolab.castor.xml.ValidationException
1257 * if this object is an invalid instance according to the schema
1258 * @return the unmarshaled jalview.schemabinding.version2.JGroup
1260 public static jalview.schemabinding.version2.JGroup unmarshal(
1261 final java.io.Reader reader)
1262 throws org.exolab.castor.xml.MarshalException,
1263 org.exolab.castor.xml.ValidationException
1265 return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(
1266 jalview.schemabinding.version2.JGroup.class, reader);
1272 * @throws org.exolab.castor.xml.ValidationException
1273 * if this object is an invalid instance according to the schema
1275 public void validate() throws org.exolab.castor.xml.ValidationException
1277 org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
1278 validator.validate(this);